Backoffice/Security/Authorization/Voter/AbstractPerimeterVoter.php
Function getAgglomeratedPerimeter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function getAgglomeratedPerimeter(UserInterface $user, $entityType)
{
if (false === $this->hasCachedPerimeters($user, $entityType)) {
$cachedPerimeter = $this->perimeterManager->createPerimeter($entityType);
foreach ($user->getGroups() as $group) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Call to method getGroups
from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
Open
foreach ($user->getGroups() as $group) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
Open
$this->cachedPerimeters[$user->getId()][$entityType] = $cachedPerimeter;
- Create a ticketCreate a ticket
- Exclude checks
Parameter $decisionManager
has undeclared type \Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface
Open
Open
public function __construct(AccessDecisionManagerInterface $decisionManager, PerimeterManager $perimeterManager)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
Open
$userId = $user->getId();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $user
has undeclared type \OpenOrchestra\UserBundle\Model\UserInterface
Open
Open
protected function hasCachedPerimeters(UserInterface $user, $entityType)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open
Open
return $this->cachedPerimeters[$user->getId()][$entityType];
- Create a ticketCreate a ticket
- Exclude checks
Parameter $user
has undeclared type \OpenOrchestra\UserBundle\Model\UserInterface
Open
Open
protected function getAgglomeratedPerimeter(UserInterface $user, $entityType)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $user
has undeclared type \OpenOrchestra\UserBundle\Model\UserInterface
Open
Open
protected function isSubjectInPerimeter($subjectKey, UserInterface $user, $entityType)
- Create a ticketCreate a ticket
- Exclude checks