steeffeen/FancyManiaLinks

View on GitHub
FML/Components/CheckBox.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

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

        } else {
            $checkBoxDesign = new CheckBoxDesign($style, $subStyle);
            $this->feature->setDisabledDesign($checkBoxDesign);
        }
Severity: Minor
Found in FML/Components/CheckBox.php by phpmd

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 using static access to class '\FML\Script\Features\ScriptFeature' in method 'getScriptFeatures'.
Open

        return ScriptFeature::collect($this->feature, $this->getQuad(), $this->getEntry());
Severity: Minor
Found in FML/Components/CheckBox.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

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

        } else {
            $checkBoxDesign = new CheckBoxDesign($style, $subStyle);
            $this->feature->setEnabledDesign($checkBoxDesign);
        }
Severity: Minor
Found in FML/Components/CheckBox.php by phpmd

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 closing brace for the class must go on the next line after the body
Open

}
Severity: Minor
Found in FML/Components/CheckBox.php by phpcodesniffer

The 'getDefault()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getDefault()
    {
        return $this->feature->getDefault();
    }
Severity: Minor
Found in FML/Components/CheckBox.php by phpmd

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

There are no issues that match your filters.

Category
Status