open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/EventSubscriber/CreateMandatoryNodesSubscriber.php

Summary

Maintainability
A
35 mins
Test Coverage

Method createErrorNodeWithStatus has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function createErrorNodeWithStatus(StatusInterface $status, $nodeId, $name, $language, SiteInterface $site)
Severity: Minor
Found in Backoffice/EventSubscriber/CreateMandatoryNodesSubscriber.php - About 35 mins to fix

Parameter $translator has undeclared type \Symfony\Component\Translation\TranslatorInterface
Open

    public function __construct(

Parameter $site has undeclared type \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

    protected function createErrorNodeWithStatus(StatusInterface $status, $nodeId, $name, $language, SiteInterface $site)

Call to method getTemplateNodeRoot from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

        $errorNode = $this->nodeManager->createNewErrorNode($nodeId, $name, NodeInterface::ROOT_PARENT_ID, $site->getSiteId(), $language, $site->getTemplateNodeRoot());

Reference to constant ERROR_503_NODE_ID from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

                $this->createErrorNodeWithStatus($status, NodeInterface::ERROR_503_NODE_ID, self::ERROR_503_NAME, $language, $site);

Call to method getSiteId from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

        $rootNode = $this->nodeManager->createRootNode($site->getSiteId(), $language, self::ROOT_NAME, self::ROOT_NODE_PATTERN, $site->getTemplateNodeRoot());

Class implements undeclared interface \Symfony\Component\EventDispatcher\EventSubscriberInterface
Open

class CreateMandatoryNodesSubscriber implements EventSubscriberInterface

Parameter $node has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

    protected function createMandatoryNode(NodeInterface $node, StatusInterface $status)

Call to method flush from undeclared class \Doctrine\Common\Persistence\ObjectManager
Open

            $this->objectManager->flush();

Parameter $status has undeclared type \OpenOrchestra\ModelInterface\Model\StatusInterface
Open

    protected function createRootNodeWithStatus(StatusInterface $status, $language, SiteInterface $site)

Parameter $statusRepository has undeclared type \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open

    public function __construct(

Call to method findOneByTranslationState from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open

            $status = $this->statusRepository->findOneByTranslationState();

Parameter $status has undeclared type \OpenOrchestra\ModelInterface\Model\StatusInterface
Open

    protected function createErrorNodeWithStatus(StatusInterface $status, $nodeId, $name, $language, SiteInterface $site)

Call to method getSiteId from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

        $errorNode = $this->nodeManager->createNewErrorNode($nodeId, $name, NodeInterface::ROOT_PARENT_ID, $site->getSiteId(), $language, $site->getTemplateNodeRoot());

Reference to constant ROOT_PARENT_ID from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

        $errorNode = $this->nodeManager->createNewErrorNode($nodeId, $name, NodeInterface::ROOT_PARENT_ID, $site->getSiteId(), $language, $site->getTemplateNodeRoot());

Parameter $siteEvent has undeclared type \OpenOrchestra\ModelInterface\Event\SiteEvent
Open

    public function createMandatoryNodes(SiteEvent $siteEvent)

Parameter $site has undeclared type \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

    protected function createRootNodeWithStatus(StatusInterface $status, $language, SiteInterface $site)

Parameter $status has undeclared type \OpenOrchestra\ModelInterface\Model\StatusInterface
Open

    protected function createMandatoryNode(NodeInterface $node, StatusInterface $status)

Reference to constant ERROR_404_NODE_ID from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

                $this->createErrorNodeWithStatus($status, NodeInterface::ERROR_404_NODE_ID, self::ERROR_404_NAME, $language, $site);

Method \OpenOrchestra\Backoffice\EventSubscriber\CreateMandatoryNodesSubscriber::createErrorNodeWithStatus is declared to return \OpenOrchestra\ModelInterface\Model\NodeInterface but has no return value
Open

    protected function createErrorNodeWithStatus(StatusInterface $status, $nodeId, $name, $language, SiteInterface $site)

Call to method getTemplateNodeRoot from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

        $rootNode = $this->nodeManager->createRootNode($site->getSiteId(), $language, self::ROOT_NAME, self::ROOT_NODE_PATTERN, $site->getTemplateNodeRoot());

Method \OpenOrchestra\Backoffice\EventSubscriber\CreateMandatoryNodesSubscriber::createRootNodeWithStatus is declared to return \OpenOrchestra\ModelInterface\Model\NodeInterface but has no return value
Open

    protected function createRootNodeWithStatus(StatusInterface $status, $language, SiteInterface $site)

Return type of createRootNodeWithStatus() is undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

    protected function createRootNodeWithStatus(StatusInterface $status, $language, SiteInterface $site)

Reference to constant SITE_CREATE from undeclared class \OpenOrchestra\ModelInterface\SiteEvents
Open

            SiteEvents::SITE_CREATE => 'createMandatoryNodes',

Parameter $objectManager has undeclared type \Doctrine\Common\Persistence\ObjectManager
Open

    public function __construct(

Call to method getSite from undeclared class \OpenOrchestra\ModelInterface\Event\SiteEvent
Open

        $site = $siteEvent->getSite();

Return type of createErrorNodeWithStatus() is undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

    protected function createErrorNodeWithStatus(StatusInterface $status, $nodeId, $name, $language, SiteInterface $site)

Call to method setStatus from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open

        $node->setStatus($status);

Call to method persist from undeclared class \Doctrine\Common\Persistence\ObjectManager
Open

        $this->objectManager->persist($node);

There must be a single space between the closing parenthesis and the opening brace of a multi-line function declaration; found 0 spaces
Open

    ){

Line exceeds 120 characters; contains 132 characters
Open

                $this->createErrorNodeWithStatus($status, NodeInterface::ERROR_404_NODE_ID, self::ERROR_404_NAME, $language, $site);

Line exceeds 120 characters; contains 121 characters
Open

    protected function createErrorNodeWithStatus(StatusInterface $status, $nodeId, $name, $language, SiteInterface $site)

Line exceeds 120 characters; contains 132 characters
Open

                $this->createErrorNodeWithStatus($status, NodeInterface::ERROR_503_NODE_ID, self::ERROR_503_NAME, $language, $site);

Line exceeds 120 characters; contains 168 characters
Open

        $errorNode = $this->nodeManager->createNewErrorNode($nodeId, $name, NodeInterface::ROOT_PARENT_ID, $site->getSiteId(), $language, $site->getTemplateNodeRoot());

Line exceeds 120 characters; contains 158 characters
Open

        $rootNode = $this->nodeManager->createRootNode($site->getSiteId(), $language, self::ROOT_NAME, self::ROOT_NODE_PATTERN, $site->getTemplateNodeRoot());

There are no issues that match your filters.

Category
Status