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';
}
- Read upRead up
- Exclude checks
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 = '')
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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 = '')
- Read upRead up
- Exclude checks
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) {
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
$out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n";
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
$out .= '<simpleChoice identifier="answer_'.$current_answer['id'].'" fixed="false">
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
foreach ($this->answerList as $current_answer) {
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
foreach ($this->answerList as $current_answer) {
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
if (isset($current_answer['comment']) && '' != $current_answer['comment']) {
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
$out .= '<feedbackInline identifier="answer_'.$current_answer['id'].'">
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
<![CDATA['.formatExerciseQtiText($current_answer['answer']).']]>';
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
$out .= ' <value>answer_'.$current_answer['id'].'</value>'."\n";
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
if (isset($current_answer['grade'])) {
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
if (isset($current_answer['comment']) && '' != $current_answer['comment']) {
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
<![CDATA['.formatExerciseQtiText($current_answer['comment']).']]>
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
if ($current_answer['correct']) {
- Exclude checks
Variable "current_answer" is not in valid camel caps format Open
$out .= ' <mapEntry mapKey="answer_'.$current_answer['id'].'" mappedValue="'.$current_answer['grade'].'" />'."\n";
- Exclude checks
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";
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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";
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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";
- Read upRead up
- Exclude checks
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";
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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";
- Read upRead up
- Exclude checks
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";
- Read upRead up
- Exclude checks
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";
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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) {
- Read upRead up
- Exclude checks
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();
}
}