open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Form/Type/NodeType.php

Summary

Maintainability
C
1 day
Test Coverage

Method buildForm has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('nodeId', 'hidden', array(
                'disabled' => true,
Severity: Major
Found in Backoffice/Form/Type/NodeType.php - About 5 hrs to fix

Method configureOptions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function configureOptions(OptionsResolver $resolver)
    {
        $subGroupRender = array(
            'properties' => array(
                'rank' => 0,
Severity: Major
Found in Backoffice/Form/Type/NodeType.php - About 2 hrs to fix

File NodeType.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace OpenOrchestra\Backoffice\Form\Type;

use OpenOrchestra\Backoffice\Context\ContextBackOfficeInterface;
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php - About 2 hrs to fix

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        NodeManager $nodeManager,
        ContextBackOfficeInterface $contextManager,
        SiteRepositoryInterface $siteRepository,
        TemplateManager $templateManager,
        $nodeClass,
Severity: Major
Found in Backoffice/Form/Type/NodeType.php - About 50 mins to fix

The method buildForm() has 145 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('nodeId', 'hidden', array(
                'disabled' => true,
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phpmd

Avoid unused parameters such as '$key'.
Open

                    'choice_label' => function ($value, $key) {
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phpmd

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

Reference to constant SCHEME_HTTPS from undeclared class \OpenOrchestra\ModelInterface\Model\SchemeableInterface
Open

            SchemeableInterface::SCHEME_HTTPS => SchemeableInterface::SCHEME_HTTPS
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Parameter $form has undeclared type \Symfony\Component\Form\FormInterface
Open

    public function buildView(FormView $view, FormInterface $form, array $options)
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Parameter $builder has undeclared type \Symfony\Component\Form\FormBuilderInterface
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Call to method setAttribute from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

            $builder->setAttribute('disabled', $options['disabled']);
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Call to method setDefaults from undeclared class \Symfony\Component\OptionsResolver\OptionsResolver
Open

        $resolver->setDefaults(array(
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Reference to instance property vars from undeclared class \Symfony\Component\Form\FormView
Open

        $view->vars['delete_help_text'] = $options['delete_help_text'];
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Reference to instance property vars from undeclared class \Symfony\Component\Form\FormView
Open

        $view->vars['enable_delete_button'] = $options['enable_delete_button'];
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Reference to instance property vars from undeclared class \Symfony\Component\Form\FormView
Open

        $view->vars['delete_button'] = $options['delete_button'];
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Parameter $specialPageChoiceStatusSubscriber has undeclared type \Symfony\Component\EventDispatcher\EventSubscriberInterface
Open

    public function __construct(
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Reference to constant SCHEME_HTTP from undeclared class \OpenOrchestra\ModelInterface\Model\SchemeableInterface
Open

            SchemeableInterface::SCHEME_HTTP => SchemeableInterface::SCHEME_HTTP,
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Call to method add from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

                $builder->add('frontRoles', 'choice', array(
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Call to method addEventSubscriber from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

        $builder->addEventSubscriber($this->specialPageChoiceStatusSubscriber);
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Parameter $resolver has undeclared type \Symfony\Component\OptionsResolver\OptionsResolver
Open

    public function configureOptions(OptionsResolver $resolver)
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Reference to constant SCHEME_DEFAULT from undeclared class \OpenOrchestra\ModelInterface\Model\SchemeableInterface
Open

            SchemeableInterface::SCHEME_DEFAULT => 'open_orchestra_backoffice.form.node.default_scheme',
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Call to method add from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

        $builder
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Call to method addEventSubscriber from undeclared class \Symfony\Component\Form\FormBuilderInterface
Open

            $builder->addEventSubscriber(new NodeTemplateSelectionSubscriber(
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Class extends undeclared class \Symfony\Component\Form\AbstractType
Open

class NodeType extends AbstractType
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

Parameter $siteRepository has undeclared type \OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface
Open

    public function __construct(
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Parameter $view has undeclared type \Symfony\Component\Form\FormView
Open

    public function buildView(FormView $view, FormInterface $form, array $options)
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phan

Reference to undeclared class \Symfony\Component\Form\AbstractType
Open

        parent::buildView($view, $form, $options);
Severity: Critical
Found in Backoffice/Form/Type/NodeType.php by phan

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

    protected $specialPageChoiceStatusSubscriber;
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phpmd

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

        EventSubscriberInterface $specialPageChoiceStatusSubscriber,
Severity: Minor
Found in Backoffice/Form/Type/NodeType.php by phpmd

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

Closing brace indented incorrectly; expected 4 spaces, found 3
Open

   }

Line indented incorrectly; expected 8 spaces, found 12
Open

            if (!empty($this->frontRoles)) {

Line indented incorrectly; expected 8 spaces, found 12
Open

            }

Line indented incorrectly; expected 4 spaces, found 3
Open

   }

Line indented incorrectly; expected 16 spaces, found 20
Open

                    },

There are no issues that match your filters.

Category
Status