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 {
$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array(\'false\');'."\n";
}
- 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
Variable "identifier_false" is not in valid camel caps format Open
<input name="'.$identifier_false.'" id="'.$identifier_false.'" value="'.$this->falseGrade.'" type="radio" />
- Exclude checks
Variable "identifier_true" is not in valid camel caps format Open
<label for="'.$identifier_true.'">'.get_lang('True').'</label>
- Exclude checks
Variable "identifier_true" is not in valid camel caps format Open
<input name="'.$identifier_true.'" id="'.$identifier_true.'" value="'.$this->trueGrade.'" type="radio" />
- Exclude checks
Variable "identifier_false" is not in valid camel caps format Open
$identifier_false = $identifier.'_false';
- Exclude checks
Variable "identifier_false" is not in valid camel caps format Open
<input name="'.$identifier_false.'" id="'.$identifier_false.'" value="'.$this->falseGrade.'" type="radio" />
- Exclude checks
Variable "identifier_true" is not in valid camel caps format Open
<input name="'.$identifier_true.'" id="'.$identifier_true.'" value="'.$this->trueGrade.'" type="radio" />
- Exclude checks
Variable "identifier_false" is not in valid camel caps format Open
<label for="'.$identifier_false.'">'.get_lang('False').'</label>
- Exclude checks
Variable "identifier_true" is not in valid camel caps format Open
$identifier_true = $identifier.'_true';
- Exclude checks
The variable $identifier_false is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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 $identifier_true is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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 $identifier_true is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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 $identifier_true is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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 $identifier_false is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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 $identifier_false is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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 $identifier_true is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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 $identifier_false is not named in camelCase. Open
public function export()
{
$js = '';
$html = '<tr><td colspan="2"><table width="100%">';
$identifier = 'question_'.$this->questionJSId.'_tf';
- 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();
}
}