Delete::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 45
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 22
c 0
b 0
f 0
nc 1
nop 21
dl 0
loc 45
rs 9.568

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;
6
7
use LAG\AdminBundle\Bridge\Doctrine\ORM\State\ORMDataProcessor;
8
use LAG\AdminBundle\Bridge\Doctrine\ORM\State\ORMDataProvider;
9
10
class Delete extends Operation
11
{
12
    public function __construct(
13
        ?string $name = 'delete',
14
        ?string $title = null,
15
        ?string $description = null,
16
        ?string $icon = null,
17
        ?string $template = '@LAGAdmin/crud/delete.html.twig',
18
        ?array $permissions = [],
19
        ?string $controller = \LAG\AdminBundle\Controller\Delete::class,
20
        ?string $route = null,
21
        ?array $routeParameters = null,
22
        array $methods = ['POST', 'GET'],
23
        string $path = '/delete',
24
        ?string $targetRoute = null,
25
        ?array $targetRouteParameters = null,
26
        array $properties = [],
27
        ?string $formType = null,
28
        array $formOptions = [],
29
        string $processor = ORMDataProcessor::class,
30
        string $provider = ORMDataProvider::class,
31
        array $identifiers = [],
32
        ?array $contextualActions = null,
33
        ?array $itemActions = null
34
    ) {
35
        parent::__construct(
36
            $name,
37
            $title,
38
            $description,
39
            $icon,
40
            $template,
41
            $permissions,
42
            $controller,
43
            $route,
44
            $routeParameters,
45
            $methods,
46
            $path,
47
            $targetRoute,
48
            $targetRouteParameters,
49
            $properties,
50
            $formType,
51
            $formOptions,
52
            $processor,
53
            $provider,
54
            $identifiers,
55
            $contextualActions,
56
            $itemActions,
57
        );
58
    }
59
}
60