chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/CoursesAndSessionsCatalog.class.php

Summary

Maintainability
A
0 mins
Test Coverage

The method getFormattedSessionsBlock() has an NPath complexity of 769. The configured NPath complexity threshold is 200.
Open

    public static function getFormattedSessionsBlock(array $sessions)
    {
        $extraFieldValue = new ExtraFieldValue('session');
        $userId = api_get_user_id();
        $sessionsBlocks = [];

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 searchCourses() has an NPath complexity of 288. The configured NPath complexity threshold is 200.
Open

    public static function searchCourses($categoryCode, $keyword, $limit, $justVisible = false, $conditions = [])
    {
        $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
        $limitFilter = self::getLimitFilterFromArray($limit);
        $avoidCoursesCondition = self::getAvoidCourseCondition();

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 searchAndSortCourses() has an NPath complexity of 3915. The configured NPath complexity threshold is 200.
Open

    public static function searchAndSortCourses(
        $categoryCode,
        $keyword,
        $limit,
        $justVisible = false,

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 getCatalogUrl() has an NPath complexity of 5760. The configured NPath complexity threshold is 200.
Open

    public static function getCatalogUrl(
        $pageCurrent,
        $pageLength,
        $categoryCode = null,
        $action = 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 class CoursesAndSessionsCatalog has a coupling between objects value of 21. Consider to reduce the number of dependencies under 13.
Open

class CoursesAndSessionsCatalog
{
    public const PAGE_LENGTH = 12;

    /**

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 '804', column '27').
Open

        $extraField = new \ExtraField('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 '1390', column '20').
Open

        $tpl = new Template();

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 '1524', column '20').
Open

        $tpl = new Template();

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 '1565', column '32').
Open

        $extraFieldValue = 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 '1429', column '20').
Open

        $tpl = new Template();

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 return_teacher uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $html .= '<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'" title="'.$name.'">
                        <img src="'.$value['avatar'].'" title="'.$name.'" alt="'.get_lang('UserPicture').'"/></a>';
                    $html .= '<div class="teachers-details"><h5>
                        <a href="'.$value['url'].'" class="ajax" data-title="'.$name.'">'

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 getCoursesInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $limitFilter = self::getLimitFilterFromArray($limit);
            $categoryCode = Database::escape_string($categoryCode);
            $listCode = self::childrenCategories($categoryCode);
            $conditionCode = ' ';

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 searchCourses uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $categoryFilter = ' AND category_code = "'.$categoryCode.'" ';
        }

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 getCoursesInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $sql = "SELECT *, id as real_id FROM $tbl_course course
                        WHERE
                            $conditionCode
                            $avoidCoursesCondition

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 return_teacher uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            foreach ($teachers as $value) {
                $name = $value['firstname'].' '.$value['lastname'];
                if ($length > 2) {
                    $html .= '<a href="'.$value['url'].'" class="ajax" data-title="'.$name.'" title="'.$name.'">

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 getFormattedSessionsBlock uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $catName = $cat->getTitle();
            }

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 getCoursesInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $id_in = "$id";
                }

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 getCoursesInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $sql = "SELECT *, course.id real_id FROM $tbl_course as course
                            INNER JOIN $tbl_url_rel_course as url_rel_course
                            ON (url_rel_course.c_id = course.id)
                            WHERE

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 getCoursesInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $sql = "SELECT id, id as real_id
                        FROM $tbl_course course
                        WHERE
                            RAND()*$num_records< $randomValue

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 getCatalogPagination uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $pageItemAttributes = [];
            }

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 getCoursesInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $conditionCode .= " category_code='$categoryCode' ";
                }

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 getCoursesInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                foreach ($listCode as $code) {
                    $conditionCode .= " category_code='$code' OR ";
                }
                $conditionCode .= " category_code='$categoryCode' ";

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 getRegisteredInSessionButton uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $url .= 'inc/email_editor.php?';
            $url .= http_build_query([
                'action' => 'subscribe_me_to_session',
                'session' => Security::remove_XSS($sessionName),

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 '$urlCondition'.
Open

                $urlCondition = ' access_url_id = '.$urlId.' AND';

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 parameters such as '$course'.
Open

    public static function returnThumbnail($course)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

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

The parameter $search_term is not named in camelCase.
Open

    public static function return_register_button($course, $stok, $categoryCode, $search_term)
    {
        $title = get_lang('Subscribe');
        $action = 'subscribe_course';
        if (!empty($course['registration_code'])) {

CamelCaseParameterName

Since: 0.2

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

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $search_term is not named in camelCase.
Open

    public static function return_unregister_button($course, $stok, $search_term, $categoryCode, $sessionId = 0)
    {
        $title = get_lang('Unsubscription');
        $search_term = Security::remove_XSS($search_term);
        $categoryCode = Security::remove_XSS($categoryCode);

CamelCaseParameterName

Since: 0.2

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

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

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

            $sql = "SELECT COUNT(*) FROM $tbl_course";

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

                            RAND()*$num_records< $randomValue

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

            $sql = "SELECT *, id as real_id FROM $tbl_course WHERE id IN($id_in)";

Missing parameter name
Open

     * @param $search_term

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'avatar' => UserManager::getUserPicture($coach->getId(), USER_IMAGE_SIZE_SMALL),

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

        $TABLE_COURSE_FIELD = Database::get_main_table(TABLE_EXTRA_FIELD);

Missing function doc comment
Open

    public static function getCourseCategoriesTree()

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

            list($num_records) = Database::fetch_row($result);

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

                $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);

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

                        FROM $tbl_course course

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

                    $sql = "SELECT *, course.id real_id FROM $tbl_course as course

Expected 6 spaces after parameter type; 2 found
Open

     * @param array  $sortKeys

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

        $sql = "SELECT item_id FROM $TABLE_COURSE_FIELD_VALUE tcfv

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

                            RAND()*$num_records< $randomValue

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

                            INNER JOIN $tbl_url_rel_course as url_rel_course

Method name "CoursesAndSessionsCatalog::return_already_registered_label" is not in camel caps format
Open

    public static function return_already_registered_label($status)

Method name "CoursesAndSessionsCatalog::return_register_button" is not in camel caps format
Open

    public static function return_register_button($course, $stok, $categoryCode, $search_term)

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

            '&course_code='.$course['code'].'&search_term='.$search_term.'&category_code='.$categoryCode,

Method name "CoursesAndSessionsCatalog::return_unregister_button" is not in camel caps format
Open

    public static function return_unregister_button($course, $stok, $search_term, $categoryCode, $sessionId = 0)

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'id' => $coach->getId(),

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

                        INNER JOIN $tbl_url_rel_course as url_rel_course

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

            if (null === $id_in) {

Method name "CoursesAndSessionsCatalog::return_teacher" is not in camel caps format
Open

    public static function return_teacher($courseInfo)

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

                        FROM $tbl_course course

Expected 5 spaces after parameter type; 1 found
Open

     * @param string $action

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

                'count_users' => $count_users,

Missing parameter name
Open

     * @param $stok

Missing function doc comment
Open

    public static function getCatalogSearchSettings()

Expected 6 spaces after parameter type; 2 found
Open

     * @param array  $liAttributes

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

                            FROM $tbl_course as course

Missing parameter name
Open

     * @param $categoryCode

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

    public static function return_unregister_button($course, $stok, $search_term, $categoryCode, $sessionId = 0)

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'name' => $coach->getFullname(),

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

        $TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);

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

                        INNER JOIN $tbl_url_rel_course as url_rel_course

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

                $sql = "SELECT *, id as real_id FROM $tbl_course course

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

                        INNER JOIN $tbl_url_rel_course as url_rel_course

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

                INNER JOIN $TABLE_COURSE_FIELD tcf

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

            $id_in = null;

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

                    $id_in = "$id";

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

            $sql = "SELECT *, id as real_id FROM $tbl_course WHERE id IN($id_in)";

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

                            INNER JOIN $tbl_url_rel_course as url_rel_course

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

            $count_users = CourseManager::get_users_count_in_course($row['code']);

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

                $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);

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

                    $id_in .= ",$id";

Missing function doc comment
Open

    public static function getRequirements($id, $type, $includeText, $class, $sessionId = 0)

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

        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);

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

                        FROM $tbl_course course

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            $qb->expr()->eq('url.accessUrlId ', $urlId))

Missing function doc comment
Open

    public static function getSessionPagination($action, $countSessions, $limit)

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

                list($num_records) = Database::fetch_row($result);

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

                        FROM $tbl_course course

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

                $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);

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

        $search_term = Security::remove_XSS($search_term);

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

            '&search_term='.$search_term.'&category_code='.$categoryCode;

Missing parameter name
Open

     * @param $status

Multi-line function call not indented correctly; expected 24 spaces but found 32
Open

                                .http_build_query(['a' => 'get_user_popup', 'user_id' => $coach->getId()]),

Missing parameter name
Open

     * @param $pageLength

Expected 6 spaces after parameter type; 2 found
Open

     * @param array  $fields

Missing parameter name
Open

     * @param $course

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'url' => api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?'

Expected 5 spaces after parameter type; 1 found
Open

     * @param string $content

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

    public static function return_register_button($course, $stok, $categoryCode, $search_term)

Missing parameter name
Open

     * @param $pageNumber

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

                if ($id_in) {

Missing function doc comment
Open

    public static function courseSortOrder()

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

        $search_term = Security::remove_XSS($search_term);

Expected 5 spaces after parameter type; 1 found
Open

     * @param string $categoryCode

Only one argument is allowed per line in a multi-line function call
Open

                            'avatar' => UserManager::getUserPicture($coach->getId(), USER_IMAGE_SIZE_SMALL),

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'avatar' => UserManager::getUserPicture($coach->getId(), USER_IMAGE_SIZE_SMALL),

Multi-line function call not indented correctly; expected 24 spaces but found 32
Open

                                .http_build_query(['a' => 'get_user_popup', 'user_id' => $coach->getId()]),

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'url' => api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?'

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            $qb->expr()->eq('url.accessUrlId ', $urlId))

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'id' => $coach->getId(),

Multi-line function call not indented correctly; expected 24 spaces but found 28
Open

                            'name' => $coach->getFullname(),

Closing parenthesis of a multi-line function call must be on a line by itself
Open

                            $qb->expr()->eq('url.accessUrlId ', $urlId))

The variable $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $count_users is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $TABLE_COURSE_FIELD_VALUE is not named in camelCase.
Open

    public static function getCoursesToAvoid()
    {
        $TABLE_COURSE_FIELD = Database::get_main_table(TABLE_EXTRA_FIELD);
        $TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $search_term is not named in camelCase.
Open

    public static function return_unregister_button($course, $stok, $search_term, $categoryCode, $sessionId = 0)
    {
        $title = get_lang('Unsubscription');
        $search_term = Security::remove_XSS($search_term);
        $categoryCode = Security::remove_XSS($categoryCode);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $num_records is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $TABLE_COURSE_FIELD_VALUE is not named in camelCase.
Open

    public static function getCoursesToAvoid()
    {
        $TABLE_COURSE_FIELD = Database::get_main_table(TABLE_EXTRA_FIELD);
        $TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $num_records is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $count_users is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $TABLE_COURSE_FIELD is not named in camelCase.
Open

    public static function getCoursesToAvoid()
    {
        $TABLE_COURSE_FIELD = Database::get_main_table(TABLE_EXTRA_FIELD);
        $TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $num_records is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $search_term is not named in camelCase.
Open

    public static function return_register_button($course, $stok, $categoryCode, $search_term)
    {
        $title = get_lang('Subscribe');
        $action = 'subscribe_course';
        if (!empty($course['registration_code'])) {

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 $num_records is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function searchCourses($categoryCode, $keyword, $limit, $justVisible = false, $conditions = [])
    {
        $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
        $limitFilter = self::getLimitFilterFromArray($limit);
        $avoidCoursesCondition = self::getAvoidCourseCondition();

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 $TABLE_COURSE_FIELD is not named in camelCase.
Open

    public static function getCoursesToAvoid()
    {
        $TABLE_COURSE_FIELD = Database::get_main_table(TABLE_EXTRA_FIELD);
        $TABLE_COURSE_FIELD_VALUE = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);

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 $id_in is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $id_in is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $search_term is not named in camelCase.
Open

    public static function return_unregister_button($course, $stok, $search_term, $categoryCode, $sessionId = 0)
    {
        $title = get_lang('Unsubscription');
        $search_term = Security::remove_XSS($search_term);
        $categoryCode = Security::remove_XSS($categoryCode);

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 $id_in is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $id_in is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $id_in is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $search_term is not named in camelCase.
Open

    public static function return_unregister_button($course, $stok, $search_term, $categoryCode, $sessionId = 0)
    {
        $title = get_lang('Unsubscription');
        $search_term = Security::remove_XSS($search_term);
        $categoryCode = Security::remove_XSS($categoryCode);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_course is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 $tbl_url_rel_course is not named in camelCase.
Open

    public static function searchCourses($categoryCode, $keyword, $limit, $justVisible = false, $conditions = [])
    {
        $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
        $limitFilter = self::getLimitFilterFromArray($limit);
        $avoidCoursesCondition = self::getAvoidCourseCondition();

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 $id_in is not named in camelCase.
Open

    public static function getCoursesInCategory($categoryCode, $randomValue = null, $limit = [])
    {
        $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
        $avoidCoursesCondition = self::getAvoidCourseCondition();
        $visibilityCondition = CourseManager::getCourseVisibilitySQLCondition('course', true);

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 method return_teacher is not named in camelCase.
Open

    public static function return_teacher($courseInfo)
    {
        $teachers = CourseManager::getTeachersFromCourse($courseInfo['real_id']);
        $length = count($teachers);

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method return_register_button is not named in camelCase.
Open

    public static function return_register_button($course, $stok, $categoryCode, $search_term)
    {
        $title = get_lang('Subscribe');
        $action = 'subscribe_course';
        if (!empty($course['registration_code'])) {

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method return_already_registered_label is not named in camelCase.
Open

    public static function return_already_registered_label($status)
    {
        $icon = '<em class="fa fa-check"></em>';
        $title = get_lang('YouAreATeacherOfThisCourse');
        if ('student' === $status) {

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method return_unregister_button is not named in camelCase.
Open

    public static function return_unregister_button($course, $stok, $search_term, $categoryCode, $sessionId = 0)
    {
        $title = get_lang('Unsubscription');
        $search_term = Security::remove_XSS($search_term);
        $categoryCode = Security::remove_XSS($categoryCode);

CamelCaseMethodName

Since: 0.2

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

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status