open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/EventSubscriber/UpdateEmbeddedStatusSubscriber.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '24', column '27').
Open

                throw new \InvalidArgumentException('Repository should be an instance of StatusableContainerRepositoryInterface');

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Repository\StatusableContainerRepositoryInterface
Open

            if (! $statusableRepository instanceof StatusableContainerRepositoryInterface) {

Parameter $event has undeclared type \OpenOrchestra\ModelInterface\Event\StatusEvent
Open

    public function updateEmbeddedStatus(StatusEvent $event)

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

class UpdateEmbeddedStatusSubscriber implements EventSubscriberInterface

Reference to constant STATUS_UPDATE from undeclared class \OpenOrchestra\ModelInterface\StatusEvents
Open

            StatusEvents::STATUS_UPDATE => 'updateEmbeddedStatus',

Call to method getStatus from undeclared class \OpenOrchestra\ModelInterface\Event\StatusEvent
Open

        $status = $event->getStatus();

Avoid excessively long variable names like $statusableRepositories. Keep variable name length under 20.
Open

    public function __construct(array $statusableRepositories)

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $statusableRepositories. Keep variable name length under 20.
Open

    protected $statusableRepositories;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

The closing brace for the class must go on the next line after the body
Open

}

Line exceeds 120 characters; contains 130 characters
Open

                throw new \InvalidArgumentException('Repository should be an instance of StatusableContainerRepositoryInterface');

There are no issues that match your filters.

Category
Status