chamilo/chamilo-lms

View on GitHub
src/CoreBundle/Component/Utils/AssetDirectoryNamer.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using undefined variables such as '$parts' which will lead to PHP notices.
Open

        $parts[] = $category;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$parts' which will lead to PHP notices.
Open

                $parts[] = substr($fileName, $start, $this->charsPerDir);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$parts' which will lead to PHP notices.
Open

            $parts[] = $fileName;

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$parts' which will lead to PHP notices.
Open

        return implode('/', $parts);

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

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

        } else {
            $parts[] = $fileName;
        }

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

Missing function doc comment
Open

    public function directoryName($object, PropertyMapping $mapping): string

Missing class doc comment
Open

class AssetDirectoryNamer implements DirectoryNamerInterface, ConfigurableInterface

Add a single space around assignment operators
Open

declare(strict_types=1);

Missing function doc comment
Open

    public function __construct(?PropertyAccessorInterface $propertyAccessor, ?AssetRepository $assetRepository = null, ?RequestStack $requestStack = null)

There are no issues that match your filters.

Category
Status