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

PreCommitResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 29

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 9.456
c 0
b 0
f 0
ccs 15
cts 15
cp 1
cc 1
nc 1
nop 13
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\Configuration\Contract\Response;
4
5
class PreCommitResponse
6
{
7
    /**
8
     * @var bool
9
     */
10
    private $preCommit;
11
    /**
12
     * @var string
13
     */
14
    private $rightMessage;
15
    /**
16
     * @var string
17
     */
18
    private $errorMessage;
19
    /**
20
     * @var bool
21
     */
22
    private $enableFaces;
23
    /**
24
     * @var bool
25
     */
26
    private $composer;
27
    /**
28
     * @var bool
29
     */
30
    private $jsonLint;
31
    /**
32
     * @var bool
33
     */
34
    private $phpLint;
35
    /**
36
     * @var PhpMdResponse
37
     */
38
    private $phpMd;
39
    /**
40
     * @var PhpCsResponse
41
     */
42
    private $phpCs;
43
    /**
44
     * @var PhpCsFixerResponse
45
     */
46
    private $phpCsFixer;
47
    /**
48
     * @var PhpUnitResponse
49
     */
50
    private $phpUnit;
51
    /**
52
     * @var PhpUnitStrictCoverageResponse
53
     */
54
    private $phpUnitStrictCoverage;
55
    /**
56
     * @var PhpUnitGuardCoverageResponse
57
     */
58
    private $phpUnitGuardCoverage;
59
60
    /**
61
     * PreCommitResponse constructor.
62
     *
63
     * @param bool $preCommit
64
     * @param string $rightMessage
65
     * @param string $errorMessage
66
     * @param bool $enableFaces
67
     * @param bool $composer
68
     * @param bool $jsonLint
69
     * @param bool $phpLint
70
     * @param PhpMdResponse $phpMd
71
     * @param PhpCsResponse $phpCs
72
     * @param PhpCsFixerResponse $phpCsFixer
73
     * @param PhpUnitResponse $phpUnit
74
     * @param PhpUnitStrictCoverageResponse $phpUnitStrictCoverage
75
     * @param PhpUnitGuardCoverageResponse $phpUnitGuardCoverage
76
     */
77 9
    public function __construct(
78
        $preCommit,
79
        $rightMessage,
80
        $errorMessage,
81
        $enableFaces,
82
        $composer,
83
        $jsonLint,
84
        $phpLint,
85
        PhpMdResponse $phpMd,
86
        PhpCsResponse $phpCs,
87
        PhpCsFixerResponse $phpCsFixer,
88
        PhpUnitResponse $phpUnit,
89
        PhpUnitStrictCoverageResponse $phpUnitStrictCoverage,
90
        PhpUnitGuardCoverageResponse $phpUnitGuardCoverage
91
    ) {
92 9
        $this->preCommit = $preCommit;
93 9
        $this->rightMessage = $rightMessage;
94 9
        $this->errorMessage = $errorMessage;
95 9
        $this->enableFaces = $enableFaces;
96 9
        $this->composer = $composer;
97 9
        $this->jsonLint = $jsonLint;
98 9
        $this->phpLint = $phpLint;
99 9
        $this->phpMd = $phpMd;
100 9
        $this->phpCs = $phpCs;
101 9
        $this->phpCsFixer = $phpCsFixer;
102 9
        $this->phpUnit = $phpUnit;
103 9
        $this->phpUnitStrictCoverage = $phpUnitStrictCoverage;
104 9
        $this->phpUnitGuardCoverage = $phpUnitGuardCoverage;
105 9
    }
106
107
    /**
108
     * @return bool
109
     */
110 2
    public function isPreCommit()
111
    {
112 2
        return $this->preCommit;
113
    }
114
115
    /**
116
     * @return string
117
     */
118 2
    public function getRightMessage()
119
    {
120 2
        return $this->rightMessage;
121
    }
122
123
    /**
124
     * @return string
125
     */
126 4
    public function getErrorMessage()
127
    {
128 4
        return $this->errorMessage;
129
    }
130
131
    /**
132
     * @return bool
133
     */
134 3
    public function isEnableFaces()
135
    {
136 3
        return $this->enableFaces;
137
    }
138
139
    /**
140
     * @return bool
141
     */
142 2
    public function isComposer()
143
    {
144 2
        return $this->composer;
145
    }
146
147
    /**
148
     * @return bool
149
     */
150 2
    public function isJsonLint()
151
    {
152 2
        return $this->jsonLint;
153
    }
154
155
    /**
156
     * @return bool
157
     */
158 2
    public function isPhpLint()
159
    {
160 2
        return $this->phpLint;
161
    }
162
163
    /**
164
     * @return PhpMdResponse
165
     */
166 2
    public function getPhpMd()
167
    {
168 2
        return $this->phpMd;
169
    }
170
171
    /**
172
     * @return PhpCsResponse
173
     */
174 2
    public function getPhpCs()
175
    {
176 2
        return $this->phpCs;
177
    }
178
179
    /**
180
     * @return PhpCsFixerResponse
181
     */
182 4
    public function getPhpCsFixer()
183
    {
184 4
        return $this->phpCsFixer;
185
    }
186
187
    /**
188
     * @return PhpUnitResponse
189
     */
190 2
    public function getPhpUnit()
191
    {
192 2
        return $this->phpUnit;
193
    }
194
195
    /**
196
     * @return PhpUnitStrictCoverageResponse
197
     */
198 1
    public function getPhpUnitStrictCoverage()
199
    {
200 1
        return $this->phpUnitStrictCoverage;
201
    }
202
203
    /**
204
     * @return PhpUnitGuardCoverageResponse
205
     */
206 3
    public function getPhpUnitGuardCoverage()
207
    {
208 3
        return $this->phpUnitGuardCoverage;
209
    }
210
}
211