public/main/survey/ch_open.php
The method render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$content = $answers;
}
- 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
The class ch_open is not named in CamelCase. Open
Open
class ch_open extends survey_question
{
/**
* @param array $questionData
* @param string|array $answers
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Doc comment for parameter $answers does not match actual variable name $questionData Open
Open
* @param string|array $answers
- Exclude checks
Doc comment for parameter $questionData does not match actual variable name $form Open
Open
* @param array $questionData
- Exclude checks
Expected 8 spaces after parameter type; 2 found Open
Open
* @param array $questionData
- Exclude checks
Class name "ch_open" is not in camel caps format Open
Open
class ch_open extends survey_question
- Exclude checks