Backoffice/EventSubscriber/UpdateNodeSiteAliasSubscriber.php
Function updateNodeOnSiteAliasUpdate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function updateNodeOnSiteAliasUpdate(SiteEvent $event)
{
$languages = array();
foreach ($event->getOldAliases() as $alias) {
$languages[] = $alias->getLanguage();
- 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
Parameter $nodeRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getOldAliases
from undeclared class \OpenOrchestra\ModelInterface\Event\SiteEvent
Open
Open
foreach ($event->getOldAliases() as $alias) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method flush
from undeclared class \Doctrine\Common\Persistence\ObjectManager
Open
Open
$this->objectManager->flush();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSite
from undeclared class \OpenOrchestra\ModelInterface\Event\SiteEvent
Open
Open
$nodes = $this->nodeRepository->findLastVersionByLanguage($event->getSite()->getSiteId(), $languageReference);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $objectManager
has undeclared type \Doctrine\Common\Persistence\ObjectManager
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Parameter $event
has undeclared type \OpenOrchestra\ModelInterface\Event\SiteEvent
Open
Open
public function updateNodeOnSiteAliasUpdate(SiteEvent $event)
- Create a ticketCreate a ticket
- Exclude checks
Class implements undeclared interface \Symfony\Component\EventDispatcher\EventSubscriberInterface
Open
Open
class UpdateNodeSiteAliasSubscriber implements EventSubscriberInterface
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSite
from undeclared class \OpenOrchestra\ModelInterface\Event\SiteEvent
Open
Open
$languages = array_diff($event->getSite()->getLanguages(), $languages);
- Create a ticketCreate a ticket
- Exclude checks
Call to method findLastVersionByLanguage
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
$nodes = $this->nodeRepository->findLastVersionByLanguage($event->getSite()->getSiteId(), $languageReference);
- Create a ticketCreate a ticket
- Exclude checks
Call to method persist
from undeclared class \Doctrine\Common\Persistence\ObjectManager
Open
Open
$this->objectManager->persist($this->nodeManager->createNewLanguageNode($node, $language));
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant SITE_UPDATE
from undeclared class \OpenOrchestra\ModelInterface\SiteEvents
Open
Open
SiteEvents::SITE_UPDATE => 'updateNodeOnSiteAliasUpdate',
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
Open
$nodes = $this->nodeRepository->findLastVersionByLanguage($event->getSite()->getSiteId(), $languageReference);
- Create a ticketCreate a ticket
- Exclude checks