src/CoreBundle/Security/Authorization/Voter/ResourceNodeVoter.php
The method voteOnAttribute() has an NPath complexity of 382379429376000. The configured NPath complexity threshold is 200. Open
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();
- Read upRead up
- Exclude checks
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
Open
class ResourceNodeVoter extends Voter
{
public const VIEW = 'VIEW';
public const CREATE = 'CREATE';
public const EDIT = 'EDIT';
- Read upRead up
- Exclude checks
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
Open
declare(strict_types=1);
- Exclude checks
Missing function doc comment Open
Open
public function __construct(
- Exclude checks
Missing function doc comment Open
Open
public static function getEditorMask(): int
- Exclude checks
Closing brace must be on a line by itself Open
Open
) {}
- Exclude checks
Missing function doc comment Open
Open
public static function getReaderMask(): int
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private RequestStack $requestStack,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private Security $security,
- Exclude checks
Closing brace must be on a line by itself Open
Open
) {}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
Open
private SettingsManager $settingsManager
- Exclude checks