open-orchestra/open-orchestra-cms-bundle

View on GitHub
GroupBundle/Form/Type/GroupType.php

Summary

Maintainability
B
5 hrs
Test Coverage

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

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('labels', 'oo_multi_languages', array(
                'label' => 'open_orchestra_group.form.group.label',
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.php - About 1 hr to fix

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

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            array(
                'data_class' => $this->groupClass,
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.php - About 1 hr to fix

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

        EventSubscriberInterface $groupPerimeterSubscriber,
        EventDispatcherInterface $eventDispatcher,
        DataTransformerInterface $groupRoleTransformer,
        DataTransformerInterface $groupPerimeterTransformer,
        GeneratePerimeterManager $generatePerimeterManager,
Severity: Major
Found in GroupBundle/Form/Type/GroupType.php - About 50 mins to fix

Avoid using static access to class '\OpenOrchestra\Backoffice\GeneratePerimeter\GeneratePerimeterManager' in method 'buildForm'.
Open

                $path = GeneratePerimeterManager::changePathToName($path);
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

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

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

            $builder->addEventSubscriber($this->groupPerimeterSubscriber);
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.php by phan

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

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

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

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

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

class GroupType extends AbstractType
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.php by phan

Parameter $eventDispatcher has undeclared type \Symfony\Component\EventDispatcher\EventDispatcherInterface
Open

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

Parameter $groupPerimeterTransformer has undeclared type \Symfony\Component\Form\DataTransformerInterface
Open

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

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

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

Call to method dispatch from undeclared class \Symfony\Component\EventDispatcher\EventDispatcherInterface
Open

            $this->eventDispatcher->dispatch(GroupFormEvents::GROUP_FORM_CREATION, new GroupFormEvent($builder));
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.php by phan

Parameter $groupRoleTransformer has undeclared type \Symfony\Component\Form\DataTransformerInterface
Open

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

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

            $builder->get('roles')->addModelTransformer($this->groupRoleTransformer);
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.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 GroupBundle/Form/Type/GroupType.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 GroupBundle/Form/Type/GroupType.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 GroupBundle/Form/Type/GroupType.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 GroupBundle/Form/Type/GroupType.php by phan

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

        $builder
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.php by phan

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

        $view->vars['new_button'] = $options['new_button'];
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.php by phan

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

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

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

            $builder
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.php by phan

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

        $resolver->setDefaults(
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.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 GroupBundle/Form/Type/GroupType.php by phan

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

            $builder->get('perimeters')->addModelTransformer($this->groupPerimeterTransformer);
Severity: Critical
Found in GroupBundle/Form/Type/GroupType.php by phan

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        parent::buildView($view, $form, $options);
        $view->vars['delete_button'] = $options['delete_button'];
        $view->vars['enable_delete_button'] = $options['enable_delete_button'];
Severity: Major
Found in GroupBundle/Form/Type/GroupType.php and 2 other locations - About 1 hr to fix
Backoffice/Form/Type/ContentType.php on lines 90..97
Backoffice/Form/Type/ContentTypeType.php on lines 189..196

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 106.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    protected $generatePerimeterManager;
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.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 $groupPerimeterTransformer. Keep variable name length under 20.
Open

        DataTransformerInterface $groupPerimeterTransformer,
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.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 $groupPerimeterTransformer. Keep variable name length under 20.
Open

    protected $groupPerimeterTransformer;
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.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 $groupPerimeterSubscriber. Keep variable name length under 20.
Open

    protected $groupPerimeterSubscriber;
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.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 $generatePerimeterManager. Keep variable name length under 20.
Open

        GeneratePerimeterManager $generatePerimeterManager,
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.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 $groupPerimeterSubscriber. Keep variable name length under 20.
Open

        EventSubscriberInterface $groupPerimeterSubscriber,
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.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 $groupMemberSubscriber. Keep variable name length under 20.
Open

    protected $groupMemberSubscriber;
Severity: Minor
Found in GroupBundle/Form/Type/GroupType.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

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

}

Expected 1 space after FUNCTION keyword; 0 found
Open

            array_walk_recursive($configuration, function(&$path) {

Line exceeds 120 characters; contains 121 characters
Open

            $configuration = $this->generatePerimeterManager->getPerimetersConfiguration($group->getSite()->getSiteId());

There are no issues that match your filters.

Category
Status