chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/webservices/Rest.php

Summary

Maintainability
A
0 mins
Test Coverage

The method Rest::updateUserFromUserName() calls the typical debug function print_r() which is mostly only used during development.
Open

                                        throw new Exception(get_lang('CouldNotUpdateExtraFieldValue').': '.print_r($field, true));

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

The method createSessionFromModel() has an NPath complexity of 23040. The configured NPath complexity threshold is 200.
Open

    public function createSessionFromModel($modelSessionId, $sessionName, $startDate, $endDate, array $extraFields = [])
    {
        if (empty($modelSessionId) || empty($sessionName) || empty($startDate) || empty($endDate)) {
            throw new Exception(get_lang('NoData'));
        }

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method addUser() has an NPath complexity of 1536. The configured NPath complexity threshold is 200.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method updateUserFromUserName() has an NPath complexity of 33408. The configured NPath complexity threshold is 200.
Open

    public function updateUserFromUserName($parameters)
    {
        // find user
        $userId = null;
        if (!is_array($parameters) || empty($parameters)) {

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method addCourse() has an NPath complexity of 1920. The configured NPath complexity threshold is 200.
Open

    public function addCourse(array $courseParam): array
    {
        $idCampus = isset($courseParam['id_campus']) ? $courseParam['id_campus'] : 1;
        $title = isset($courseParam['title']) ? $courseParam['title'] : '';
        $wantedCode = isset($courseParam['wanted_code']) ? $courseParam['wanted_code'] : null;

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method getCourseLearnPaths() has an NPath complexity of 1738. The configured NPath complexity threshold is 200.
Open

    public function getCourseLearnPaths()
    {
        $sessionId = $this->session ? $this->session->getId() : 0;
        $categoriesTempList = learnpath::getCategories($this->course->getId());

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using undefined variables such as '$loggedUser' which will lead to PHP notices.
Open

        $loggedUser['user_id'] = $this->user->getId();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$loggedUser' which will lead to PHP notices.
Open

        $loggedUser['status'] = $this->user->getStatus();

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$loggedUser' which will lead to PHP notices.
Open

        ChamiloSession::write('_user', $loggedUser);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$loggedUser' which will lead to PHP notices.
Open

        $loggedUser['uidReset'] = true;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

The class Rest has a coupling between objects value of 33. Consider to reduce the number of dependencies under 13.
Open

class Rest extends WebService
{
    public const SERVICE_NAME = 'MsgREST';
    public const EXTRA_FIELD_GCM_REGISTRATION = 'gcm_registration_id';

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Missing class import via use statement (line '1622', column '23').
Open

            throw new Exception(get_lang('ModelSessionDoesNotExist'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1722', column '23').
Open

            throw new Exception(get_lang('SessionNotFound'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '204', column '32').
Open

        $extraFieldValue = new ExtraFieldValue('user');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '532', column '23').
Open

        $agenda = new Agenda(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '776', column '27').
Open

        $fieldValue = new ExtraFieldValue('user');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1809', column '23').
Open

            throw new Exception(get_lang('CouldNotLoadUser'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '124', column '27').
Open

        $extraField = new ExtraField('user');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '190', column '23').
Open

            throw new Exception(get_lang('NoSession'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1260', column '37').
Open

            $extraFieldValues = new ExtraFieldValue('course');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1657', column '23').
Open

            throw new Exception(get_lang('SessionNotRegistered'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1767', column '23').
Open

            throw new Exception(get_lang('NoSessionMatched'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '166', column '23').
Open

            throw new Exception(get_lang('NoCourse'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1690', column '23').
Open

            throw new Exception(get_lang('CoursesNotAddedToSession'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1931', column '51').
Open

                                        throw new Exception(get_lang('CouldNotUpdateExtraFieldValue').': '.$fieldName);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1958', column '31').
Open

                    throw new Exception(get_lang('UnsupportedUpdate')." '$name'");

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1318', column '23').
Open

            throw new Exception(get_lang('UserNameNotAvailable'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1727', column '23').
Open

            throw new Exception(get_lang('UserNotFound'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '543', column '20').
Open

        $end = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '543', column '57').
Open

        $end = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1339', column '23').
Open

            throw new Exception(get_lang('UserNotRegistered'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '113', column '23').
Open

            throw new Exception(get_lang('InvalidApiKey'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '693', column '23').
Open

            throw new Exception(get_lang('NoForum'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1737', column '23').
Open

            throw new Exception(get_lang('UserNotSubscribed'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1925', column '51').
Open

                                        throw new Exception(get_lang('CouldNotUpdateExtraFieldValue').': '.print_r($field, true));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1875', column '35').
Open

                        throw new Exception(get_lang('LanguageUnavailable'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '503', column '23').
Open

            throw new Exception(get_lang('NoAnnouncement'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '540', column '59').
Open

        $start = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1756', column '27').
Open

        $valueModel = new ExtraFieldValue('session');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1884', column '29').
Open

                        new DateTime(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1772', column '23').
Open

            throw new Exception(get_lang('MoreThanOneSessionMatched'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1793', column '23').
Open

            throw new Exception('NoData');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1661', column '23').
Open

            throw new Exception($newSessionId);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1799', column '31').
Open

                    throw new Exception(get_lang('UserNotFound'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1886', column '33').
Open

                            new DateTimeZone('UTC')

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '540', column '22').
Open

        $start = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '396', column '27').
Open

                throw new Exception('NoDataAvailable');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '821', column '34').
Open

            $learnPathList = new LearnpathList(

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1618', column '23').
Open

            throw new Exception(get_lang('NoData'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '1805', column '23').
Open

            throw new Exception(get_lang('NoData'));

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method editCampusURL uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                UrlManager::update($url_id, $urlCampus.'/', $description, $active);
            }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method createSessionFromModel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            UrlManager::add_session_to_url($newSessionId, 1);
        }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method addUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                UrlManager::add_user_to_url($userId, 1);
            }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method createCampusURL uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $url = UrlManager::add($urlCampus.'/', $description, $active, true);
        }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method updateUserFromUserName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                            } else {
                                foreach ($value as $fieldName => $fieldValue) {
                                    if (!UserManager::update_extra_field_value($userId, $fieldName, $fieldValue)) {
                                        throw new Exception(get_lang('CouldNotUpdateExtraFieldValue').': '.$fieldName);
                                    }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method addCourse uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $results['status'] = false;
            $results['message'] = get_lang('CourseCreationFailed');
        }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method addSession uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $out = [
                'status' => false,
                'message' => get_lang('ErrorOccurred'),
            ];

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method addUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            // We add by default the access_url_user table with access_url_id = 1
            UrlManager::add_user_to_url($userId, 1);
        }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method deleteCampusURL uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return [
                'status' => false,
                'message' => get_lang('Error'),
            ];

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method createSessionFromModel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                UrlManager::add_session_to_url($newSessionId, 1);
            }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused local variables such as '$courseInfo'.
Open

        $courseInfo = api_get_course_info_by_id($this->course->getId());

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused local variables such as '$path'.
Open

        $path = '/';

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Missing function doc comment
Open

    public function processMessage(Message $message)

Missing function doc comment
Open

    public function getCourseLpProgress()

Doc comment for parameter $forumId does not match actual variable name $postValues
Open

     * @param int $forumId

Variable "extra_field_name" is not in valid camel caps format
Open

                $extra_field_name = $extra['field_name'];

Missing parameter name
Open

     * @param $modelSessionId

Missing parameter name
Open

     * @param $sessionName

Variable "extra_field_value" is not in valid camel caps format
Open

                $extra_field_value = $extra['field_value'];

Variable "course_code" is not in valid camel caps format
Open

        $course_code = $params['course_code'];

Variable "url_id" is not in valid camel caps format
Open

        $url_id = isset($params['id']) ? intval($params['id']) : 0;

Doc comment for parameter $forumId does not match actual variable name $values
Open

     * @param int $forumId

Variable "auth_source" is not in valid camel caps format
Open

        $auth_source = $userParam['auth_source'] ?? PLATFORM_AUTH_SOURCE;

Variable "extra_list" is not in valid camel caps format
Open

        $extra_list = isset($userParam['extra']) ? $userParam['extra'] : [];

Variable "extra_field_name" is not in valid camel caps format
Open

                    $extra_field_name,

Variable "course_id" is not in valid camel caps format
Open

        if (!$course_id && !$course_code) {

Missing function doc comment
Open

    public function unSubscribeUserToCourse(array $params): array

Missing parameter name
Open

     * @param $endDate

Variable "original_user_id_name" is not in valid camel caps format
Open

            $original_user_id_name,

Variable "original_user_id_value" is not in valid camel caps format
Open

            $original_user_id_value

Variable "course_id" is not in valid camel caps format
Open

        $course_id = $params['course_id'];

Variable "course_code" is not in valid camel caps format
Open

            $course_code = CourseManager::get_course_code_from_course_id($course_id);

Variable "user_id" is not in valid camel caps format
Open

        if (CourseManager::subscribeUser($user_id, $course_code, $status, 0, 0, false)) {

Variable "url_id" is not in valid camel caps format
Open

            if (1 == $url_id) {

Missing function doc comment
Open

    public function addCourse(array $courseParam): array

Variable "original_user_id_name" is not in valid camel caps format
Open

        $original_user_id_name = $userParam['original_user_id_name'];

Variable "user_id" is not in valid camel caps format
Open

        $user_id = $params['user_id'];

Variable "course_code" is not in valid camel caps format
Open

        if (!$course_code) {

Missing function doc comment
Open

    public function getUsersSubscribedToCourse()

Variable "original_user_id_name" is not in valid camel caps format
Open

            $original_user_id_name,

Variable "extra_list" is not in valid camel caps format
Open

        if (is_array($extra_list) && count($extra_list) > 0) {

Variable "course_code" is not in valid camel caps format
Open

        if (CourseManager::subscribeUser($user_id, $course_code, $status, 0, 0, false)) {

Missing parameter name
Open

     * @param array Params Campus

Variable "official_code" is not in valid camel caps format
Open

        $official_code = '';

Variable "expiration_date" is not in valid camel caps format
Open

        $expiration_date = '';

Variable "extra_list" is not in valid camel caps format
Open

            foreach ($extra_list as $extra) {

Variable "extra_field_name" is not in valid camel caps format
Open

                    $extra_field_name,

Variable "url_id" is not in valid camel caps format
Open

        if (!empty($url_id)) {

Missing parameter name
Open

     * @param $startDate

Variable "coach_username" is not in valid camel caps format
Open

        $coach_username = (int) $params['coach_username'];

Variable "course_code" is not in valid camel caps format
Open

        if (!$course_id && !$course_code) {

Variable "original_user_id_value" is not in valid camel caps format
Open

        $original_user_id_value = $userParam['original_user_id_value'];

Variable "expiration_date" is not in valid camel caps format
Open

            $expiration_date = $userParam['expiration_date'];

Variable "extra_field_name" is not in valid camel caps format
Open

                    $extra_field_name,

Variable "url_id" is not in valid camel caps format
Open

                UrlManager::update($url_id, $urlCampus, $description, $active);

Missing parameter name
Open

     * @param array Params Campus

Variable "hr_dept_id" is not in valid camel caps format
Open

        $hr_dept_id = 0;

Variable "picture_uri" is not in valid camel caps format
Open

            $picture_uri,

Variable "auth_source" is not in valid camel caps format
Open

            $auth_source,

Variable "picture_uri" is not in valid camel caps format
Open

        $picture_uri = '';

Variable "extra_list" is not in valid camel caps format
Open

        if (is_array($extra_list) && count($extra_list) > 0) {

Variable "extra_field_value" is not in valid camel caps format
Open

                    $extra_field_value

Variable "course_id" is not in valid camel caps format
Open

            $course_code = CourseManager::get_course_code_from_course_id($course_id);

Variable "coach_username" is not in valid camel caps format
Open

            [$coach_username],

Variable "official_code" is not in valid camel caps format
Open

            $official_code,

Variable "expiration_date" is not in valid camel caps format
Open

            $expiration_date,

Variable "hr_dept_id" is not in valid camel caps format
Open

            $hr_dept_id

Missing parameter name
Open

     * @param $fieldName

Missing parameter name
Open

     * @param $fieldValue

Missing parameter name
Open

     * @param $userParam

Variable "original_user_id_name" is not in valid camel caps format
Open

            $original_user_id_name,

Missing parameter name
Open

     * @param array Params Campus

Variable "url_id" is not in valid camel caps format
Open

        $url_id = isset($params['id']) ? intval($params['id']) : 0;

Variable "url_id" is not in valid camel caps format
Open

                UrlManager::update($url_id, $urlCampus.'/', $description, $active);

Variable "url_id" is not in valid camel caps format
Open

        $result = UrlManager::delete($url_id);

The variable $url_id is not named in camelCase.
Open

    public function editCampusURL($params)
    {
        $urlCampus = Security::remove_XSS($params['url']);
        $description = Security::remove_XSS($params['description']);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_field_value is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $url_id is not named in camelCase.
Open

    public function editCampusURL($params)
    {
        $urlCampus = Security::remove_XSS($params['url']);
        $description = Security::remove_XSS($params['description']);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $official_code is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $expiration_date is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $original_user_id_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $original_user_id_value is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $url_id is not named in camelCase.
Open

    public function deleteCampusURL($params)
    {
        $url_id = isset($params['id']) ? intval($params['id']) : 0;

        $result = UrlManager::delete($url_id);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $coach_username is not named in camelCase.
Open

    public function addSession(array $params)
    {
        $name = $params['name'];
        $coach_username = (int) $params['coach_username'];
        $startDate = $params['access_start_date'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $hr_dept_id is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $original_user_id_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_code is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $url_id is not named in camelCase.
Open

    public function editCampusURL($params)
    {
        $urlCampus = Security::remove_XSS($params['url']);
        $description = Security::remove_XSS($params['description']);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $coach_username is not named in camelCase.
Open

    public function addSession(array $params)
    {
        $name = $params['name'];
        $coach_username = (int) $params['coach_username'];
        $startDate = $params['access_start_date'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $expiration_date is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_list is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $user_id is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $auth_source is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_field_value is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_code is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $official_code is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $url_id is not named in camelCase.
Open

    public function editCampusURL($params)
    {
        $urlCampus = Security::remove_XSS($params['url']);
        $description = Security::remove_XSS($params['description']);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $user_id is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $url_id is not named in camelCase.
Open

    public function deleteCampusURL($params)
    {
        $url_id = isset($params['id']) ? intval($params['id']) : 0;

        $result = UrlManager::delete($url_id);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $picture_uri is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $auth_source is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_list is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_field_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_code is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $original_user_id_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_list is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $url_id is not named in camelCase.
Open

    public function editCampusURL($params)
    {
        $urlCampus = Security::remove_XSS($params['url']);
        $description = Security::remove_XSS($params['description']);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $hr_dept_id is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_list is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_field_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $picture_uri is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_field_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_id is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $original_user_id_value is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $expiration_date is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_code is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $course_code is not named in camelCase.
Open

    public function subscribeUserToCourse($params)
    {
        $course_id = $params['course_id'];
        $course_code = $params['course_code'];
        $user_id = $params['user_id'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_field_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $original_user_id_name is not named in camelCase.
Open

    public function addUser($userParam)
    {
        $firstName = $userParam['firstname'];
        $lastName = $userParam['lastname'];
        $status = $userParam['status'];

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status