@@ -37,56 +37,47 @@ class Arguments implements ArgumentInterface
37
37
private $ whitelist = [];
38
38
39
39
//////////////////////////// SETTERS AND GETTERS \\\\\\\\\\\\\\\\\\\\\\\\\\\
40
- /** @return array */
41
- public function getBlacklist ()
40
+ public function getBlacklist (): array
42
41
{
43
42
return $ this ->blacklist ;
44
43
}
45
44
46
- /** @return array */
47
- public function getDirectories ()
45
+ public function getDirectories (): array
48
46
{
49
47
return $ this ->directories ;
50
48
}
51
49
52
- /** @return int */
53
- public function getErrorCode ()
50
+ public function getErrorCode (): int
54
51
{
55
52
return $ this ->errorCode ;
56
53
}
57
54
58
- /** @return string */
59
- final public function getErrorMessage ()
55
+ final public function getErrorMessage (): string
60
56
{
61
57
return $ this ->errorMessage ;
62
58
}
63
59
64
- /** @return array */
65
- public function getIdentifiers ()
60
+ public function getIdentifiers (): array
66
61
{
67
62
return $ this ->identifiers ;
68
63
}
69
64
70
- /** @return int */
71
- public function getPhpVersion ()
65
+ public function getPhpVersion (): int
72
66
{
73
67
return $ this ->phpVersion ;
74
68
}
75
69
76
- /** @return array */
77
- public function getWhitelist ()
70
+ public function getWhitelist (): array
78
71
{
79
72
return $ this ->whitelist ;
80
73
}
81
74
82
- /** @return bool */
83
- public function isHelp ()
75
+ public function isHelp (): bool
84
76
{
85
77
return $ this ->isHelp ;
86
78
}
87
79
88
- /** @return bool */
89
- public function isVerbose ()
80
+ public function isVerbose (): bool
90
81
{
91
82
return $ this ->isVerbose ;
92
83
}
@@ -102,7 +93,7 @@ final public function parse()
102
93
{
103
94
$ arguments = $ this ->arguments ;
104
95
// @TODO: Use Symfony Finder instead of hard-coded IO lookup
105
- $ finder = $ this ->finder ;
96
+ // $finder = $this->finder;
106
97
107
98
$ this ->isVerbose = array_key_exists ('verbose ' , $ arguments );
108
99
@@ -130,7 +121,7 @@ final public function parse()
130
121
}
131
122
}
132
123
133
- final public function isValid ()
124
+ final public function isValid (): bool
134
125
{
135
126
return $ this ->errorCode === 0 ;
136
127
}
@@ -142,48 +133,43 @@ final public function loadIdentifiers()
142
133
}
143
134
144
135
////////////////////////////// UTILITY METHODS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
145
- /**
146
- * @param string $key
147
- */
148
- private function loadSpecificIdentifiers ($ key )
136
+ private function loadSpecificIdentifiers (string $ key )
149
137
{
150
138
$ arguments = $ this ->arguments ;
151
139
152
- if ($ this ->isValid () === true ) {
153
- if (array_key_exists ($ key , $ arguments )) {
154
- $ identifiers = $ arguments [$ key ];
140
+ if (
141
+ $ this ->isValid () === true
142
+ && array_key_exists ($ key , $ arguments )
143
+ ) {
144
+ $ identifiers = $ arguments [$ key ];
155
145
156
- if (is_scalar ($ identifiers )) {
157
- $ identifiers = [$ identifiers ];
158
- }
146
+ if (is_scalar ($ identifiers )) {
147
+ $ identifiers = [$ identifiers ];
148
+ }
159
149
160
- $ identifierPaths = [];
150
+ $ identifierPaths = [];
161
151
162
- array_walk ($ identifiers , function ($ identifier ) use (&$ identifierPaths ) {
163
- /* @NOTE: Remove any trailing slash */
164
- $ identifier = rtrim ($ identifier , '/ ' );
152
+ array_walk ($ identifiers , function ($ identifier ) use (&$ identifierPaths ) {
153
+ /* @NOTE: Remove any trailing slash */
154
+ $ identifier = rtrim ($ identifier , '/ ' );
165
155
166
- if (is_dir ($ identifier )) {
167
- $ files = glob ($ identifier . '/*.php ' );
156
+ if (is_dir ($ identifier )) {
157
+ $ files = glob ($ identifier . '/*.php ' );
168
158
169
- $ identifierPaths = array_merge ($ identifierPaths , $ files );
170
- } elseif (is_file ($ identifier )) {
171
- $ identifierPaths [] = $ identifier ;
172
- } else {
173
- $ this ->errorMessage = sprintf ('Given identifier "%s" is not a file or directory ' , $ identifier );
174
- $ this ->errorCode = self ::ERROR_SUBJECT_NOT_FILE_OR_FOLDER ;
175
- }
176
- });
159
+ $ identifierPaths = array_merge ($ identifierPaths , $ files );
160
+ } elseif (is_file ($ identifier )) {
161
+ $ identifierPaths [] = $ identifier ;
162
+ } else {
163
+ $ this ->errorMessage = sprintf ('Given identifier "%s" is not a file or directory ' , $ identifier );
164
+ $ this ->errorCode = self ::ERROR_SUBJECT_NOT_FILE_OR_FOLDER ;
165
+ }
166
+ });
177
167
178
- $ identifierPaths = array_filter ($ identifierPaths );
179
- $ this ->identifiers = array_merge ($ this ->identifiers , $ identifierPaths );
180
- }
168
+ $ identifierPaths = array_filter ($ identifierPaths );
169
+ $ this ->identifiers = array_merge ($ this ->identifiers , $ identifierPaths );
181
170
}
182
171
}
183
172
184
- /**
185
- * @param $arguments
186
- */
187
173
private function loadDirectories ($ arguments )
188
174
{
189
175
if ($ this ->isValid () === true && array_key_exists ('subject ' , $ arguments )) {
@@ -194,7 +180,6 @@ private function loadDirectories($arguments)
194
180
$ subjects = [$ subjects ];
195
181
}
196
182
197
- /** @noinspection ForeachSourceInspection */
198
183
foreach ($ subjects as $ subject ) {
199
184
if (is_dir ($ subject )) {
200
185
$ this ->directories [] = $ subject ;
@@ -209,9 +194,6 @@ private function loadDirectories($arguments)
209
194
}
210
195
}
211
196
212
- /**
213
- * @param $arguments
214
- */
215
197
private function loadBlackList ($ arguments )
216
198
{
217
199
if ($ this ->isValid () === true ) {
@@ -228,9 +210,6 @@ private function loadBlackList($arguments)
228
210
}
229
211
}
230
212
231
- /**
232
- * @param $arguments
233
- */
234
213
private function loadPhpVersion ($ arguments )
235
214
{
236
215
$ key = IdentifierOption::PHP_VERSION ;
0 commit comments