open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/GeneratePerimeter/Strategy/NodeGeneratePerimeterStrategy.php

Summary

Maintainability
A
0 mins
Test Coverage

The method formatConfiguration uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $children = $treeNodes['child'];
            unset($treeNodes['child']);
            foreach ($children as $child) {
                $treeNodes['children'][] = $this->formatConfiguration($child);

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

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

        return NodeInterface::ENTITY_TYPE;

Call to method findTreeNode from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open

        $treeNodes = $this->nodeRepository->findTreeNode(

Parameter $nodeRepository has undeclared type \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open

    public function __construct(NodeRepositoryInterface $nodeRepository, ContextBackOfficeInterface $contextManager)

Call to method findTreeNode from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open

        $treeNodes = $this->nodeRepository->findTreeNode(

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

            NodeInterface::ROOT_PARENT_ID

When fetching an array index from a value of type array|array<int>|array<int>,</int></int> found an array index of type 'child', but expected the index to be of type int
Open

        foreach ($treeNodes['child'] as &$child) {

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

            NodeInterface::ROOT_PARENT_ID

There are no issues that match your filters.

Category
Status