open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
B
5 hrs
Test Coverage

Function buildForm has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $configuration = array();
        $maxColumns = 0;

Severity: Minor
Found in GroupBundle/Form/Type/GroupRoleType.php - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $configuration = array();
        $maxColumns = 0;

Severity: Minor
Found in GroupBundle/Form/Type/GroupRoleType.php - About 1 hr to fix

Function buildView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        foreach ($this->groupRolesConfiguration as $fieldset => $tableConfiguration) {
            foreach ($tableConfiguration as $table => $configuration) {
                if (!empty($configuration)) {
Severity: Minor
Found in GroupBundle/Form/Type/GroupRoleType.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid unused local variables such as '$fieldset'.
Open

        foreach ($this->groupRolesConfiguration as $fieldset => $tables) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused parameters such as '$options'.
Open

    public function buildView(FormView $view, FormInterface $form, array $options)

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

Avoid unused parameters such as '$form'.
Open

    public function buildView(FormView $view, FormInterface $form, array $options)

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

Avoid unused parameters such as '$options'.
Open

    public function buildForm(FormBuilderInterface $builder, array $options)

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

Parameter $translator has undeclared type \Symfony\Component\Translation\TranslatorInterface
Open

    public function __construct(

Call to method trans from undeclared class \Symfony\Component\Translation\TranslatorInterface
Open

                        $configuration[$tableName]['column'][$chekListName] = $this->translator->trans('open_orchestra_backoffice.form.role.' . $chekListName);
Severity: Critical
Found in GroupBundle/Form/Type/GroupRoleType.php by phan

Call to method trans from undeclared class \Symfony\Component\Translation\TranslatorInterface
Open

                            $configuration[$tableName]['help'][] = $this->translator->trans($columnConfiguration['help']);
Severity: Critical
Found in GroupBundle/Form/Type/GroupRoleType.php by phan

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

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

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

    public function buildView(FormView $view, FormInterface $form, array $options)

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

    public function buildView(FormView $view, FormInterface $form, array $options)

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

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

Call to method trans from undeclared class \Symfony\Component\Translation\TranslatorInterface
Open

                        $configuration[$tableName]['row'][] = $this->translator->trans($columnConfiguration['label']);
Severity: Critical
Found in GroupBundle/Form/Type/GroupRoleType.php by phan

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

                    $view->vars['configuration'][$fieldset][] = $table;

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

    public function buildForm(FormBuilderInterface $builder, array $options)

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

        array $groupRolesConfiguration

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

    protected $groupRolesConfiguration;

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

Line exceeds 120 characters; contains 122 characters
Open

                            $configuration[$tableName]['help'][] = $this->translator->trans($columnConfiguration['help']);

Line exceeds 120 characters; contains 159 characters
Open

                        $configuration[$tableName]['column'][$chekListName] = $this->translator->trans('open_orchestra_backoffice.form.role.' . $chekListName);

There are no issues that match your filters.

Category
Status