CorePlugin::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 40
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 13
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 37
dl 0
loc 40
rs 10
c 13
b 0
f 0

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
/**
4
 * This file is part of byrokrat\giroapp.
5
 *
6
 * byrokrat\giroapp is free software: you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License as published
8
 * by the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * byrokrat\giroapp is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with byrokrat\giroapp. If not, see <http://www.gnu.org/licenses/>.
18
 *
19
 * Copyright 2016-21 Hannes Forsgård
20
 */
21
22
declare(strict_types=1);
23
24
namespace byrokrat\giroapp\Plugin;
25
26
use byrokrat\giroapp\Console;
27
use byrokrat\giroapp\Db;
28
use byrokrat\giroapp\Filter;
29
use byrokrat\giroapp\Formatter;
30
use byrokrat\giroapp\Sorter;
31
32
final class CorePlugin extends Plugin
33
{
34
    public function __construct(
35
        Console\AddConsole $addConsole,
36
        Console\ConfConsole $confConsole,
37
        Console\DeleteAttributeConsole $deleteAttributeConsole,
38
        Console\EditConsole $editConsole,
39
        Console\EditAmountConsole $editAmountConsole,
40
        Console\EditPayerNumberConsole $editPayerNumberConsole,
41
        Console\EditStateConsole $editStateConsole,
42
        Console\ExportConsole $expotConsole,
43
        Console\HistoryConsole $historyConsole,
44
        Console\ImportConsole $importConsole,
45
        Console\ImportXmlMandatesConsole $importXmlMandatesConsole,
46
        Console\InitConsole $initConsole,
47
        Console\ListConsole $listConsole,
48
        Console\PauseConsole $pauseConsole,
49
        Console\RemoveConsole $removeConsole,
50
        Console\RevokeConsole $revokeConsole,
51
        Console\ShowConsole $showConsole,
52
        Console\StatusConsole $statusConsole,
53
        Db\Json\JsonDriverFactory $jsonDriverFactory,
54
        Filter\ActiveFilter $activeFilter,
55
        Filter\RevokedFilter $revokedFilter,
56
        Filter\ExportableFilter $exportableFilter,
57
        Filter\ErrorFilter $errorFilter,
58
        Filter\PausedFilter $pausedFilter,
59
        Filter\AwaitingResponseFilter $awaitingFilter,
60
        Formatter\ListFormatter $listFormatter,
61
        Formatter\CsvFormatter $csvFormatter,
62
        Formatter\HumanFormatter $humanFormatter,
63
        Formatter\JsonFormatter $jsonFormatter,
64
        Formatter\MailStringFormatter $mailStringFormatter,
65
        Sorter\NullSorter $nullSorter,
66
        Sorter\NameSorter $nameSorter,
67
        Sorter\StateSorter $stateSorter,
68
        Sorter\PayerNumberSorter $payerSorter,
69
        Sorter\AmountSorter $amountSorter,
70
        Sorter\CreatedSorter $createdSorter,
71
        Sorter\UpdatedSorter $updatedSorter
72
    ) {
73
        parent::__construct(...func_get_args());
74
    }
75
}
76