open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/EventSubscriber/WebSiteNodeTemplateSubscriber.php

Summary

Maintainability
A
1 hr
Test Coverage

Method onPreSetData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function onPreSetData(FormEvent $event)
    {
        $form = $event->getForm();
        $data = $event->getData();
        $disabled = null !== $data->getSiteId();
Severity: Minor
Found in Backoffice/EventSubscriber/WebSiteNodeTemplateSubscriber.php - About 1 hr to fix

Parameter $event has undeclared type \Symfony\Component\Form\FormEvent
Open

    public function onPreSetData(FormEvent $event)

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

class WebSiteNodeTemplateSubscriber implements EventSubscriberInterface

Call to method getData from undeclared class \Symfony\Component\Form\FormEvent
Open

        $data = $event->getData();

Saw an @param annotation for templateSetParameters, but it was not found in the param list of function __construct(\OpenOrchestra\Backoffice\Manager\TemplateManager $templateManager)
Open

     * @param array $templateSetParameters

Call to method getForm from undeclared class \Symfony\Component\Form\FormEvent
Open

        $form = $event->getForm();

Reference to constant PRE_SET_DATA from undeclared class \Symfony\Component\Form\FormEvents
Open

            FormEvents::PRE_SET_DATA => 'onPreSetData',

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

        $templateSetParameters = $this->templateManager->getTemplateSetParameters();

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 $templateSetParameters. Keep variable name length under 20.
Open

        $templateSetParameters = $this->templateManager->getTemplateSetParameters();

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

There are no issues that match your filters.

Category
Status