Backoffice/BusinessRules/Strategies/NodeStrategy.php
Function canChangeToPublishStatus
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
public function canChangeToPublishStatus(NodeInterface $node, array $parameters)
{
$areas = $node->getAreas();
$routePattern = $node->getRoutePattern();
foreach ($areas as $area) {
- 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
Avoid unused parameters such as '$parameters'. Open
Open
public function canDeleteVersion(NodeInterface $node, array $parameters)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$parameters'. Open
Open
public function canDelete(NodeInterface $node, array $parameters)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$parameters'. Open
Open
public function canEdit(NodeInterface $node, array $parameters)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Call to method hasNodeIdWithoutAutoUnpublishToState
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
false === $this->nodeRepository->hasNodeIdWithoutAutoUnpublishToState($node->getNodeId(), $node->getSiteId()) &&
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ENTITY_TYPE
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return NodeInterface::ENTITY_TYPE;
- Create a ticketCreate a ticket
- Exclude checks
Call to method getStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return !$node->getStatus()->isBlockedEdition();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
public function canDelete(NodeInterface $node, array $parameters)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return $this->nodeRepository->countNotDeletedVersions($node->getNodeId(), $node->getLanguage(), $node->getSiteId()) > 1 && !$node->getStatus()->isPublishedState();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
$this->nodeRepository->countByParentId($node->getNodeId(), $node->getSiteId()) == 0;
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
public function canDeleteVersion(NodeInterface $node, array $parameters)
- Create a ticketCreate a ticket
- Exclude checks
Call to method countNotDeletedVersions
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
return $this->nodeRepository->countNotDeletedVersions($node->getNodeId(), $node->getLanguage(), $node->getSiteId()) > 1 && !$node->getStatus()->isPublishedState();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
if ($node->getStatus() instanceof StatusInterface && $node->getStatus()->isPublishedState()) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
public function canChangeToPublishStatus(NodeInterface $node, array $parameters)
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ROOT_NODE_ID
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return $node->getNodeId() !== NodeInterface::ROOT_NODE_ID &&
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
false === $this->nodeRepository->hasNodeIdWithoutAutoUnpublishToState($node->getNodeId(), $node->getSiteId()) &&
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
public function canEdit(NodeInterface $node, array $parameters)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getRoutePattern
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
$routePattern = $node->getRoutePattern();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
false === $this->nodeRepository->hasNodeIdWithoutAutoUnpublishToState($node->getNodeId(), $node->getSiteId()) &&
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
$this->nodeRepository->countByParentId($node->getNodeId(), $node->getSiteId()) == 0;
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return $this->nodeRepository->countNotDeletedVersions($node->getNodeId(), $node->getLanguage(), $node->getSiteId()) > 1 && !$node->getStatus()->isPublishedState();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return $this->nodeRepository->countNotDeletedVersions($node->getNodeId(), $node->getLanguage(), $node->getSiteId()) > 1 && !$node->getStatus()->isPublishedState();
- Create a ticketCreate a ticket
- Exclude checks
Call to method countByParentId
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
$this->nodeRepository->countByParentId($node->getNodeId(), $node->getSiteId()) == 0;
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
public function canChangeStatus(NodeInterface $node, array $parameters)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $nodeRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return $this->nodeRepository->countNotDeletedVersions($node->getNodeId(), $node->getLanguage(), $node->getSiteId()) > 1 && !$node->getStatus()->isPublishedState();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
return $node->getNodeId() !== NodeInterface::ROOT_NODE_ID &&
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\StatusInterface
Open
Open
if ($node->getStatus() instanceof StatusInterface && $node->getStatus()->isPublishedState()) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getAreas
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
Open
$areas = $node->getAreas();
- Create a ticketCreate a ticket
- Exclude checks
PHP keywords must be lowercase; expected "const" but found "CONST" Open
Open
CONST CHANGE_TO_PUBLISH_STATUS = 'CHANGE_TO_PUBLISH_STATUS';
- Create a ticketCreate a ticket
- Exclude checks
PHP keywords must be lowercase; expected "const" but found "CONST" Open
Open
CONST CHANGE_STATUS = 'CHANGE_STATUS';
- Create a ticketCreate a ticket
- Exclude checks
PHP keywords must be lowercase; expected "const" but found "CONST" Open
Open
CONST DELETE_VERSION = 'DELETE_VERSION';
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
Open
false === $this->nodeRepository->hasNodeIdWithoutAutoUnpublishToState($node->getNodeId(), $node->getSiteId()) &&
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
Open
return $this->nodeRepository->countNotDeletedVersions($node->getNodeId(), $node->getLanguage(), $node->getSiteId()) > 1 && !$node->getStatus()->isPublishedState();
- Create a ticketCreate a ticket
- Exclude checks