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 bool |
13
|
|
|
*/ |
14
|
|
|
private $rightMessage; |
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
private $errorMessage; |
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
private $composer; |
23
|
|
|
/** |
24
|
|
|
* @var bool |
25
|
|
|
*/ |
26
|
|
|
private $jsonLint; |
27
|
|
|
/** |
28
|
|
|
* @var bool |
29
|
|
|
*/ |
30
|
|
|
private $phpLint; |
31
|
|
|
/** |
32
|
|
|
* @var PhpMdResponse |
33
|
|
|
*/ |
34
|
|
|
private $phpMd; |
35
|
|
|
/** |
36
|
|
|
* @var PhpCsResponse |
37
|
|
|
*/ |
38
|
|
|
private $phpCs; |
39
|
|
|
/** |
40
|
|
|
* @var PhpCsFixerResponse |
41
|
|
|
*/ |
42
|
|
|
private $phpCsFixer; |
43
|
|
|
/** |
44
|
|
|
* @var PhpUnitResponse |
45
|
|
|
*/ |
46
|
|
|
private $phpUnit; |
47
|
|
|
/** |
48
|
|
|
* @var PhpUnitStrictCoverageResponse |
49
|
|
|
*/ |
50
|
|
|
private $phpUnitStrictCoverage; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* PreCommitResponse constructor. |
54
|
|
|
* |
55
|
|
|
* @param bool $preCommit |
56
|
|
|
* @param string $rightMessage |
57
|
|
|
* @param string $errorMessage |
58
|
|
|
* @param bool $composer |
59
|
|
|
* @param bool $jsonLint |
60
|
|
|
* @param bool $phpLint |
61
|
|
|
* @param PhpMdResponse $phpMd |
62
|
|
|
* @param PhpCsResponse $phpCs |
63
|
|
|
* @param PhpCsFixerResponse $phpCsFixer |
64
|
|
|
* @param PhpUnitResponse $phpUnit |
65
|
|
|
* @param PhpUnitStrictCoverageResponse $phpUnitStrictCoverage |
66
|
|
|
*/ |
67
|
10 |
|
public function __construct( |
68
|
|
|
$preCommit, |
69
|
|
|
$rightMessage, |
70
|
|
|
$errorMessage, |
71
|
|
|
$composer, |
72
|
|
|
$jsonLint, |
73
|
|
|
$phpLint, |
74
|
|
|
PhpMdResponse $phpMd, |
75
|
|
|
PhpCsResponse $phpCs, |
76
|
|
|
PhpCsFixerResponse $phpCsFixer, |
77
|
|
|
PhpUnitResponse $phpUnit, |
78
|
|
|
PhpUnitStrictCoverageResponse $phpUnitStrictCoverage |
79
|
|
|
) { |
80
|
10 |
|
$this->preCommit = $preCommit; |
81
|
10 |
|
$this->rightMessage = $rightMessage; |
|
|
|
|
82
|
10 |
|
$this->errorMessage = $errorMessage; |
83
|
10 |
|
$this->composer = $composer; |
|
|
|
|
84
|
10 |
|
$this->jsonLint = $jsonLint; |
85
|
10 |
|
$this->phpLint = $phpLint; |
86
|
10 |
|
$this->phpMd = $phpMd; |
87
|
10 |
|
$this->phpCs = $phpCs; |
88
|
10 |
|
$this->phpCsFixer = $phpCsFixer; |
89
|
10 |
|
$this->phpUnit = $phpUnit; |
90
|
10 |
|
$this->phpUnitStrictCoverage = $phpUnitStrictCoverage; |
91
|
10 |
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return bool |
95
|
|
|
*/ |
96
|
2 |
|
public function isPreCommit() |
97
|
|
|
{ |
98
|
2 |
|
return $this->preCommit; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return string |
103
|
|
|
*/ |
104
|
2 |
|
public function getRightMessage() |
105
|
|
|
{ |
106
|
2 |
|
return $this->rightMessage; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @return string |
111
|
|
|
*/ |
112
|
5 |
|
public function getErrorMessage() |
113
|
|
|
{ |
114
|
5 |
|
return $this->errorMessage; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return bool |
119
|
|
|
*/ |
120
|
2 |
|
public function isComposer() |
121
|
|
|
{ |
122
|
2 |
|
return $this->composer; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @return bool |
127
|
|
|
*/ |
128
|
2 |
|
public function isJsonLint() |
129
|
|
|
{ |
130
|
2 |
|
return $this->jsonLint; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return bool |
135
|
|
|
*/ |
136
|
2 |
|
public function isPhpLint() |
137
|
|
|
{ |
138
|
2 |
|
return $this->phpLint; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @return PhpMdResponse |
143
|
|
|
*/ |
144
|
2 |
|
public function getPhpMd() |
145
|
|
|
{ |
146
|
2 |
|
return $this->phpMd; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return PhpCsResponse |
151
|
|
|
*/ |
152
|
2 |
|
public function getPhpCs() |
153
|
|
|
{ |
154
|
2 |
|
return $this->phpCs; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @return PhpCsFixerResponse |
159
|
|
|
*/ |
160
|
5 |
|
public function getPhpCsFixer() |
161
|
|
|
{ |
162
|
5 |
|
return $this->phpCsFixer; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @return PhpUnitResponse |
167
|
|
|
*/ |
168
|
2 |
|
public function getPhpUnit() |
169
|
|
|
{ |
170
|
2 |
|
return $this->phpUnit; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return PhpUnitStrictCoverageResponse |
175
|
|
|
*/ |
176
|
1 |
|
public function getPhpUnitStrictCoverage() |
177
|
|
|
{ |
178
|
1 |
|
return $this->phpUnitStrictCoverage; |
179
|
|
|
} |
180
|
|
|
} |
181
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.