chamilo/chamilo-lms

View on GitHub
public/plugin/positioning/src/Positioning.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            } else {
                return false;
            }

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

        } else {
            $params = [
                'exercise_id' => $exerciseId,
                'c_id' => $courseId,
                'session_id' => $sessionId,

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

        } else {
            $sql .= ' AND is_final = 0 ';
        }

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

        } else {
            $sql .= ' AND is_initial = 0 ';
        }

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

Missing function doc comment
Open

    public function getInitialExercise($courseId, $sessionId)

Missing function doc comment
Open

    public static function create()

Missing function doc comment
Open

    public function getPositionData($exerciseId, $courseId, $sessionId)

Missing function doc comment
Open

    public function blockFinalExercise($userId, $exerciseId, $courseId, $sessionId)

Missing function doc comment
Open

    public function isInitialExercise($exerciseId, $courseId, $sessionId)

Missing function doc comment
Open

    public function setFinalExercise($exerciseId, $courseId, $sessionId)

Missing function doc comment
Open

    public function install()

Missing function doc comment
Open

    public function isFinalExercise($exerciseId, $courseId, $sessionId)

Missing function doc comment
Open

    public function getFinalExercise($courseId, $sessionId)

You must use "/**" style comments for a class comment
Open

class Positioning extends Plugin

Missing function doc comment
Open

    public function uninstall()

Missing function doc comment
Open

    public function setInitialExercise($exerciseId, $courseId, $sessionId)

There are no issues that match your filters.

Category
Status