chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/career.lib.php

Summary

Maintainability
A
0 mins
Test Coverage

The method parseColumnList() has an NPath complexity of 1154. The configured NPath complexity threshold is 200.
Open

    public static function parseColumnList($groupCourseList, $columnList, &$graph, &$connections, $userResult)
    {
        $graphHtml = '';
        $oldGroup = null;
        $newOrder = [];
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public static function renderDiagramByColumn($careerInfo, $tpl, $loadUserIdData = 0)
    {
        $careerId = isset($careerInfo['id']) ? $careerInfo['id'] : 0;
        if (empty($careerId)) {
            return '';
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public static function renderDiagram($careerInfo, $graph)
    {
        if (!($graph instanceof Graph)) {
            return '';
        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public static function parseSubGroups(
        $groupCourseList,
        $group,
        $groupLabel,
        $showGroupLine,
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public static function parseVertexList($groupCourseList, $vertexList, $addRow, &$graph, $group, &$connections, $userResult)
    {
        if (empty($vertexList)) {
            return '';
        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '$newOrder' which will lead to PHP notices.
Open

                $newOrder[$newGroup]['label'] = $label;
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '$params' which will lead to PHP notices.
Open

                $params['id'] = $item['id'];
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '$params' which will lead to PHP notices.
Open

                $params['status'] = $status;
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '$newOrder' which will lead to PHP notices.
Open

                $newOrder[$newGroup]['items'][] = $subGroupList;
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '$params' which will lead to PHP notices.
Open

                $promotion->update($params);
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '$params' which will lead to PHP notices.
Open

                $promotion->update_all_sessions_status_by_promotion_id($params['id'], $status);
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 Career has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13.
Open

class Career extends Model
{
    public $table;
    public $columns = [
        'id',
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '140', column '31').
Open

            $extraField = new ExtraField('career');
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '114', column '21').
Open

        $form = new FormValidator('career', 'post', $url);
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '622', column '22').
Open

        $graph = new stdClass();
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '274', column '37').
Open

            $extraFieldValues = new ExtraFieldValue('career');
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

        $extraFieldValue = new ExtraFieldValue('career');
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '60', column '26').
Open

        $promotion = new Promotion();
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 '201', column '30').
Open

            $promotion = new Promotion();
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                        } else {
                            $defaultSubGroup = (int) $subGroup;
                        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                                    } else {
                                        // Course block (row_123 id)
                                        if (!empty($explode[0])) {
                                            $firstConnection = 'row_'.(int) $explode[0];
                                        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 assigning values to variables in if clauses and the like (line '1058', column '40').
Open

    public static function parseVertexList($groupCourseList, $vertexList, $addRow, &$graph, $group, &$connections, $userResult)
    {
        if (empty($vertexList)) {
            return '';
        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

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

        } else {
            $form->addButtonCreate(get_lang('Add'));
        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                                } else {
                                    // subgroup__123 id
                                    $firstConnection = 'subgroup_'.(int) str_replace('SG', '', $explode[0]);
                                }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                            } else {
                                // Course block (row_123 id)
                                if (!empty($explode[0])) {
                                    $simpleFirstConnection = 'v'.$explode[0];
                                }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                                    } else {
                                        // Course block (row_123 id)
                                        if (!empty($explode[0])) {
                                            $secondConnection = 'row_'.(int) $explode[1];
                                        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                    } else {
                        $subGroupCountList[$defaultSubGroup]++;
                    }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                            } else {
                                // Course block (row_123 id)
                                if (!empty($explode[0]) && isset($explode[1])) {
                                    $simpleSecondConnection = 'v'.(int) $explode[1];
                                }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                                } else {
                                    $parts = explode('SG', $arrow);
                                    if (empty($parts[0]) && 2 == count($parts)) {
                                        $subGroupArrow = $parts[1];
                                        $graphHtml .= self::createConnection(
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                        } else {
                            $simpleSecondConnection = 'sg'.(int) str_replace('SG', '', $explode[1]);
                        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                        } else {
                            // subgroup__123 id
                            $simpleFirstConnection = 'sg'.(int) str_replace('SG', '', $explode[0]);
                        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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 assigning values to variables in if clauses and the like (line '1063', column '40').
Open

    public static function parseVertexList($groupCourseList, $vertexList, $addRow, &$graph, $group, &$connections, $userResult)
    {
        if (empty($vertexList)) {
            return '';
        }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

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

                            } else {
                                $subGroupAdded[$subGroup]++;
                            }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                                } else {
                                    $secondConnection = 'subgroup_'.(int) str_replace('SG', '', $explode[1]);
                                }
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                } else {
                    // Case is only one subgroup value example: SG1
                    $parts = explode('SG', $arrow);
                    if (empty($parts[0]) && 2 == count($parts)) {
                        $subGroupArrow = $parts[1];
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function save($params, $showQuery = false)
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

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

        $topValue = 90;
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

        foreach ($columnList as $key => $subGroupList) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

        $oldGroup = null;
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

                $size = 2;
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public static function renderDiagram($careerInfo, $graph)
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function update_all_promotion_status_by_career_id($career_id, $status)
    {
        $promotion = new Promotion();
        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);
        if (!empty($promotion_list)) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function copy($id, $copy_promotions = false)
    {
        $career = $this->get($id);
        $new = [];
        foreach ($career as $key => $val) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_status($career_id)
    {
        $table = Database::get_main_table(TABLE_CAREER);
        $career_id = (int) $career_id;
        $sql = "SELECT status FROM $table WHERE id = '$career_id'";
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

Missing class doc comment
Open

class Career extends Model

Method name "Career::get_status_list" is not in camel caps format
Open

    public function get_status_list()

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

    public function get_status($career_id)

Missing parameter name
Open

     * @param $widthGroup

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

        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);

Missing parameter name
Open

     * @param   bool     Whether or not to copy the promotions inside

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

    public function copy($id, $copy_promotions = false)

Method name "Career::update_all_promotion_status_by_career_id" is not in camel caps format
Open

    public function update_all_promotion_status_by_career_id($career_id, $status)

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

            foreach ($promotion_list as $item) {

Missing parameter name
Open

     * @param $graph

Expected 6 spaces after parameter type; 2 found
Open

     * @param array  $subGroupList

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

        $form->addSelect('status', get_lang('Status'), $status_list);

Missing function doc comment
Open

    public function get_all(array $options = []): array

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

                foreach ($promo_list as $item) {

Missing parameter name
Open

     * @param $userResult

Expected 6 spaces after parameter type; 2 found
Open

     * @param array  $groupCourseList list of groups and their courses

Method name "Career::get_all" is not in camel caps format
Open

    public function get_all(array $options = []): array

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

    public function update_all_promotion_status_by_career_id($career_id, $status)

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

        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);

Method name "Career::return_form" is not in camel caps format
Open

    public function return_form($url, $action)

Missing parameter name
Open

     * @param   int     Career ID

Missing parameter name
Open

     * @param array

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

        if (!empty($promotion_list)) {

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

        $status_list = $this->get_status_list();

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

            $promo_list = $promotion->get_all_promotions_by_career_id($id);

Missing parameter name
Open

     * @param $connections

Expected 7 spaces after parameter type; 3 found
Open

     * @param bool   $showGroupLine

Missing function doc comment
Open

    public function __construct()

Method name "Career::get_count" is not in camel caps format
Open

    public function get_count()

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

        if ($copy_promotions) {

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

        $career_id = (int) $career_id;

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

            if (!empty($promo_list)) {

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

        $sql = "SELECT status FROM $table WHERE id = '$career_id'";

Missing parameter name
Open

     * @param $groupCourseList

Expected 5 spaces after parameter type; 1 found
Open

     * @param string $groupLabel

Expected 8 spaces after parameter type; 4 found
Open

     * @param int    $group

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

        $career_id = (int) $career_id;

Method name "Career::get_status" is not in camel caps format
Open

    public function get_status($career_id)

Missing parameter name
Open

     * @param $columnList

The 'get_status()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function get_status($career_id)
    {
        $table = Database::get_main_table(TABLE_CAREER);
        $career_id = (int) $career_id;
        $sql = "SELECT status FROM $table WHERE id = '$career_id'";
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

The variable $promotion_list is not named in camelCase.
Open

    public function update_all_promotion_status_by_career_id($career_id, $status)
    {
        $promotion = new Promotion();
        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);
        if (!empty($promotion_list)) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function update_all_promotion_status_by_career_id($career_id, $status)
    {
        $promotion = new Promotion();
        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);
        if (!empty($promotion_list)) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function update_all_promotion_status_by_career_id($career_id, $status)
    {
        $promotion = new Promotion();
        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);
        if (!empty($promotion_list)) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function update_all_promotion_status_by_career_id($career_id, $status)
    {
        $promotion = new Promotion();
        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);
        if (!empty($promotion_list)) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function return_form($url, $action)
    {
        $form = new FormValidator('career', 'post', $url);
        // Setting the form elements
        $header = get_lang('Add');
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function copy($id, $copy_promotions = false)
    {
        $career = $this->get($id);
        $new = [];
        foreach ($career as $key => $val) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_status($career_id)
    {
        $table = Database::get_main_table(TABLE_CAREER);
        $career_id = (int) $career_id;
        $sql = "SELECT status FROM $table WHERE id = '$career_id'";
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_status($career_id)
    {
        $table = Database::get_main_table(TABLE_CAREER);
        $career_id = (int) $career_id;
        $sql = "SELECT status FROM $table WHERE id = '$career_id'";
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function copy($id, $copy_promotions = false)
    {
        $career = $this->get($id);
        $new = [];
        foreach ($career as $key => $val) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_status($career_id)
    {
        $table = Database::get_main_table(TABLE_CAREER);
        $career_id = (int) $career_id;
        $sql = "SELECT status FROM $table WHERE id = '$career_id'";
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function return_form($url, $action)
    {
        $form = new FormValidator('career', 'post', $url);
        // Setting the form elements
        $header = get_lang('Add');
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function copy($id, $copy_promotions = false)
    {
        $career = $this->get($id);
        $new = [];
        foreach ($career as $key => $val) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function copy($id, $copy_promotions = false)
    {
        $career = $this->get($id);
        $new = [];
        foreach ($career as $key => $val) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_count()
    {
        $row = Database::select(
            'count(*) as count',
            $this->table,
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_all(array $options = []): array
    {
        return Database::select(
            '*',
            $this->table,
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function update_all_promotion_status_by_career_id($career_id, $status)
    {
        $promotion = new Promotion();
        $promotion_list = $promotion->get_all_promotions_by_career_id($career_id);
        if (!empty($promotion_list)) {
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function return_form($url, $action)
    {
        $form = new FormValidator('career', 'post', $url);
        // Setting the form elements
        $header = get_lang('Add');
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_status_list()
    {
        return [
            CareerEntity::CAREER_STATUS_ACTIVE => get_lang('Unarchived'),
            CareerEntity::CAREER_STATUS_INACTIVE => get_lang('Archived'),
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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

    public function get_status($career_id)
    {
        $table = Database::get_main_table(TABLE_CAREER);
        $career_id = (int) $career_id;
        $sql = "SELECT status FROM $table WHERE id = '$career_id'";
Severity: Minor
Found in public/main/inc/lib/career.lib.php by phpmd

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