public/main/lp/scormMetadata.class.php
The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
Open
} else {
$this->text[$element->tagName] = $child->textContent;
}
- 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 scormMetadata is not named in CamelCase. Open
Open
class scormMetadata
{
public $lom = '';
public $schema = '';
public $schemaversion = '';
- 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
Spaces must be used for alignment; tabs are not allowed Open
Open
* @param mixed Depending on the type, can be the DB ID of the learnpath item or
- Exclude checks
Missing parameter name Open
Open
* @param string Type of creation required. Can be 'db' or 'manifest' (default)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @param string Type of creation required. Can be 'db' or 'manifest' (default)
- Exclude checks
Missing parameter name Open
Open
* @param mixed Depending on the type, can be the DB ID of the learnpath item or
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @param mixed Depending on the type, can be the DB ID of the learnpath item or
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
* @param string Type of creation required. Can be 'db' or 'manifest' (default)
- Exclude checks
Arguments with default values must be at the end of the argument list Open
Open
public function __construct($type = 'manifest', &$element)
- Exclude checks
Class name "scormMetadata" is not in camel caps format Open
Open
class scormMetadata
- Exclude checks