chamilo/chamilo-lms

View on GitHub
src/CoreBundle/Security/Authorization/Voter/ResourceNodeVoter.php

Summary

Maintainability
A
0 mins
Test Coverage

The method voteOnAttribute() has an NPath complexity of 382379429376000. The configured NPath complexity threshold is 200.
Open

    protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
    {
        // Make sure there is a user object (i.e. that the user is logged in)
        // Update. No, anons can enter a node depending in the visibility.
        // $user = $token->getUser();

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The class ResourceNodeVoter has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
Open

class ResourceNodeVoter extends Voter
{
    public const VIEW = 'VIEW';
    public const CREATE = 'CREATE';
    public const EDIT = 'EDIT';

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Add a single space around assignment operators
Open

declare(strict_types=1);

Missing function doc comment
Open

    public function __construct(

Missing function doc comment
Open

    public static function getEditorMask(): int

Closing brace must be on a line by itself
Open

    ) {}

Missing function doc comment
Open

    public static function getReaderMask(): int

Line indented incorrectly; expected 4 spaces, found 8
Open

        private RequestStack $requestStack,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private Security $security,

Closing brace must be on a line by itself
Open

    ) {}

Line indented incorrectly; expected 4 spaces, found 8
Open

        private SettingsManager $settingsManager

There are no issues that match your filters.

Category
Status