public static function get_user_competency($userid, $competencyid) {
        static::require_enabled();
        $existing = user_competency::get_multiple($userid, array($competencyid));
        $uc = array_pop($existing);

        if (!$uc) {
            $uc = user_competency::create_relation($userid, $competencyid);
            $uc->create();
        }

        if (!$uc->can_read()) {
            throw new required_capability_exception($uc->get_context(), 'moodle/competency:usercompetencyview',
                'nopermissions', '');
        }
        return $uc;
    }
public static function get_user_competency($userid, $competencyid) {
        static::require_enabled();
        $existing = user_competency::get_multiple($userid, array($competencyid));
        $uc = array_pop($existing);

        if (!$uc) {
            $uc = user_competency::create_relation($userid, $competencyid);
            $uc->create();
        }

        if (!$uc->can_read()) {
            throw new required_capability_exception($uc->get_context(), 'moodle/competency:usercompetencyview',
                'nopermissions', '');
        }
        return $uc;
    }
public static function get_user_competency ( $ userid , $ competencyid ) { static :: require_enabled ( ) ; $ existing = user_competency :: get_multiple ( $ userid , array ( $ competencyid ) ) ; $ uc = array_pop ( $ existing ) ; if ( ! $ uc ) { $ uc = user_competency :: create_relation ( $ userid , $ competencyid ) ; $ uc -> create ( ) ; } if ( ! $ uc -> can_read ( ) ) { throw new required_capability_exception ( $ uc -> get_context ( ) , 'moodle/competency:usercompetencyview' , 'nopermissions' , '' ) ; } return $ uc ; }
Get a user competency.

@param int $userid The user ID.
@param int $competencyid The competency ID.
@return user_competency
Get a user competency .