YetiForceCompany/YetiForcePDF

View on GitHub
lib/Style/Normalizer/BorderStyle.php

Summary

Maintainability
A
0 mins
Test Coverage

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

            } else {
                $style = 'none';
            }
Severity: Minor
Found in lib/Style/Normalizer/BorderStyle.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 unused parameters such as '$ruleName'.
Open

    public function normalize($ruleValue, string $ruleName = ''): array
Severity: Minor
Found in lib/Style/Normalizer/BorderStyle.php by phpmd

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

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

                'border-top-style' => $style,

Spaces must be used to indent lines; tabs are not allowed
Open

            } else {

Spaces must be used to indent lines; tabs are not allowed
Open

                'border-bottom-style' => $style,

Spaces must be used to indent lines; tabs are not allowed
Open

                $style = $ruleValue;

Spaces must be used to indent lines; tabs are not allowed
Open

                $style = 'none';

Spaces must be used to indent lines; tabs are not allowed
Open

            ];

Spaces must be used to indent lines; tabs are not allowed
Open

                'border-right-style' => $style,

Spaces must be used to indent lines; tabs are not allowed
Open

                'border-left-style' => $style,

Spaces must be used to indent lines; tabs are not allowed
Open

        if (null === $this->normalized) {

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

            if (\in_array($ruleValue, ['none', 'solid', 'dashed', 'dotted'])) {

Spaces must be used to indent lines; tabs are not allowed
Open

            return $this->normalized = [

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->normalized;

Spaces must be used to indent lines; tabs are not allowed
Open

            }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function normalize($ruleValue, string $ruleName = ''): array

There are no issues that match your filters.

Category
Status