BooleanProperty::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 11
c 1
b 0
f 1
nc 1
nop 10
dl 0
loc 23
rs 9.9

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace LAG\AdminBundle\Metadata\Property;
6
7
class BooleanProperty extends AbstractProperty
8
{
9
    public function __construct(
10
        string $name,
11
        ?string $propertyPath = null,
12
        ?string $label = null,
13
        ?string $template = '@LAGAdmin/fields/boolean.html.twig',
14
        bool $mapped = true,
15
        bool $sortable = true,
16
        bool $translation = false,
17
        ?string $translationDomain = 'admin',
18
        array $attr = [],
19
        array $headerAttr = [],
20
    ) {
21
        parent::__construct(
22
            $name,
23
            $propertyPath,
24
            $label,
25
            $template,
26
            $mapped,
27
            $sortable,
28
            $translation,
29
            $translationDomain,
30
            $attr,
31
            $headerAttr,
32
        );
33
    }
34
}
35