Completed
Pull Request — master (#129)
by
unknown
08:06
created

PhpCsFixerTool::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
ccs 10
cts 10
cp 1
cc 1
nc 1
nop 8
crap 1

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
namespace PhpGitHooks\Module\PhpCsFixer\Contract\Command;
4
5
use Bruli\EventBusBundle\CommandBus\CommandInterface;
6
7
class PhpCsFixerTool implements CommandInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    private $files;
13
    /**
14
     * @var bool
15
     */
16
    private $psr0;
17
    /**
18
     * @var bool
19
     */
20
    private $psr1;
21
    /**
22
     * @var bool
23
     */
24
    private $psr2;
25
    /**
26
     * @var bool
27
     */
28
    private $symfony;
29
    /**
30
     * @var string
31
     */
32
    private $options;
33
    /**
34
     * @var string
35
     */
36
    private $errorMessage;
37
    /**
38
     * @var bool
39
     */
40
    private $enableFaces;
41
42
    /**
43
     * PhpCsFixerToolCommand constructor.
44
     *
45
     * @param array $files
46
     * @param bool $psr0
47
     * @param bool $psr1
48
     * @param bool $psr2
49
     * @param bool $symfony
50
     * @param string $options
51
     * @param string $errorMessage
52
     * @param bool $enableFaces
53
     */
54 3
    public function __construct(array $files, $psr0, $psr1, $psr2, $symfony, $options, $errorMessage, $enableFaces)
55
    {
56 3
        $this->files = $files;
57 3
        $this->psr0 = $psr0;
58 3
        $this->psr1 = $psr1;
59 3
        $this->psr2 = $psr2;
60 3
        $this->symfony = $symfony;
61 3
        $this->options = $options;
62 3
        $this->errorMessage = $errorMessage;
63 3
        $this->enableFaces = $enableFaces;
64 3
    }
65
66
    /**
67
     * @return array
68
     */
69 2
    public function getFiles()
70
    {
71 2
        return $this->files;
72
    }
73
74
    /**
75
     * @return bool
76
     */
77 2
    public function isPsr0()
78
    {
79 2
        return $this->psr0;
80
    }
81
82
    /**
83
     * @return bool
84
     */
85 2
    public function isPsr1()
86
    {
87 2
        return $this->psr1;
88
    }
89
90
    /**
91
     * @return bool
92
     */
93 2
    public function isPsr2()
94
    {
95 2
        return $this->psr2;
96
    }
97
98
    /**
99
     * @return bool
100
     */
101 2
    public function isSymfony()
102
    {
103 2
        return $this->symfony;
104
    }
105
106
    /**
107
     * @return string
108
     */
109 2
    public function getOptions()
110
    {
111 2
        return $this->options;
112
    }
113
114
    /**
115
     * @return string
116
     */
117 2
    public function getErrorMessage()
118
    {
119 2
        return $this->errorMessage;
120
    }
121
122
    /**
123
     * @return bool
124
     */
125 2
    public function isEnableFaces()
126
    {
127 2
        return $this->enableFaces;
128
    }
129
}
130