chamilo/chamilo-lms

View on GitHub
public/main/exercise/export/qti2/ImsAnswerMultipleChoice.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        } else {
            $cardinality = 'single';
        }

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')

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

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

            foreach ($this->answerList as $current_answer) {

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

                    $out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n";

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

                $out .= '<simpleChoice identifier="answer_'.$current_answer['id'].'" fixed="false">

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

            foreach ($this->answerList as $current_answer) {

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

            foreach ($this->answerList as $current_answer) {

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

                if (isset($current_answer['comment']) && '' != $current_answer['comment']) {

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

                    $out .= '<feedbackInline identifier="answer_'.$current_answer['id'].'">

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

                         <![CDATA['.formatExerciseQtiText($current_answer['answer']).']]>';

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

                    $out .= '      <value>answer_'.$current_answer['id'].'</value>'."\n";

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

                if (isset($current_answer['grade'])) {

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

                if (isset($current_answer['comment']) && '' != $current_answer['comment']) {

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

                             <![CDATA['.formatExerciseQtiText($current_answer['comment']).']]>

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

                if ($current_answer['correct']) {

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

                    $out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n";

The variable $current_answer is not named in camelCase.
Open

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
    {
        // @todo getAnswersList() converts the answers using api_html_entity_decode()
        $this->answerList = $this->getAnswersList(true);
        $out = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)
    {
        $this->answerList = $this->getAnswersList(true);
        $type = $this->getQuestionType();
        if (MCMA == $type) {

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)
    {
        $this->answerList = $this->getAnswersList(true);
        $type = $this->getQuestionType();
        if (MCMA == $type) {

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
    {
        // @todo getAnswersList() converts the answers using api_html_entity_decode()
        $this->answerList = $this->getAnswersList(true);
        $out = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)
    {
        $this->answerList = $this->getAnswersList(true);
        $type = $this->getQuestionType();
        if (MCMA == $type) {

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
    {
        // @todo getAnswersList() converts the answers using api_html_entity_decode()
        $this->answerList = $this->getAnswersList(true);
        $out = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
    {
        // @todo getAnswersList() converts the answers using api_html_entity_decode()
        $this->answerList = $this->getAnswersList(true);
        $out = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)
    {
        $this->answerList = $this->getAnswersList(true);
        $type = $this->getQuestionType();
        if (MCMA == $type) {

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
    {
        // @todo getAnswersList() converts the answers using api_html_entity_decode()
        $this->answerList = $this->getAnswersList(true);
        $out = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
    {
        // @todo getAnswersList() converts the answers using api_html_entity_decode()
        $this->answerList = $this->getAnswersList(true);
        $out = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";

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

    public function imsExportResponses($questionIdent, $questionStatment, $questionDesc = '', $questionMedia = '')
    {
        // @todo getAnswersList() converts the answers using api_html_entity_decode()
        $this->answerList = $this->getAnswersList(true);
        $out = '    <choiceInteraction responseIdentifier="'.$questionIdent.'" >'."\n";

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)
    {
        $this->answerList = $this->getAnswersList(true);
        $type = $this->getQuestionType();
        if (MCMA == $type) {

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)
    {
        $this->answerList = $this->getAnswersList(true);
        $type = $this->getQuestionType();
        if (MCMA == $type) {

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

    public function imsExportResponsesDeclaration($questionIdent, Question $question = null)
    {
        $this->answerList = $this->getAnswersList(true);
        $type = $this->getQuestionType();
        if (MCMA == $type) {

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