chamilo/chamilo-lms

View on GitHub
public/main/exercise/export/scorm/ScormAnswerMultipleChoice.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            $jstmpc = '';

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

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

        } else {
            $id = 1;
            $jstmp = '';
            $jstmpc = '';
            foreach ($this->answer as $i => $answer) {

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

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

                $identifier_name = 'question_'.$questionId.'_unique_answer';

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

                    <input name="'.$identifier_name.'" id="'.$identifier.'" value="'.$i.'" type="checkbox"/>

The variable $identifier_name is not named in camelCase.
Open

    public function export()
    {
        $js = [];
        $type = $this->getQuestionType();
        $questionId = $this->questionJSId;

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

    public function export()
    {
        $js = [];
        $type = $this->getQuestionType();
        $questionId = $this->questionJSId;

CamelCaseVariableName

Since: 0.2

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

Example

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

Source

There are no issues that match your filters.

Category
Status