@@ -37,56 +37,47 @@ class Arguments implements ArgumentInterface
3737 private $ whitelist = [];
3838
3939 //////////////////////////// SETTERS AND GETTERS \\\\\\\\\\\\\\\\\\\\\\\\\\\
40- /** @return array */
41- public function getBlacklist ()
40+ public function getBlacklist (): array
4241 {
4342 return $ this ->blacklist ;
4443 }
4544
46- /** @return array */
47- public function getDirectories ()
45+ public function getDirectories (): array
4846 {
4947 return $ this ->directories ;
5048 }
5149
52- /** @return int */
53- public function getErrorCode ()
50+ public function getErrorCode (): int
5451 {
5552 return $ this ->errorCode ;
5653 }
5754
58- /** @return string */
59- final public function getErrorMessage ()
55+ final public function getErrorMessage (): string
6056 {
6157 return $ this ->errorMessage ;
6258 }
6359
64- /** @return array */
65- public function getIdentifiers ()
60+ public function getIdentifiers (): array
6661 {
6762 return $ this ->identifiers ;
6863 }
6964
70- /** @return int */
71- public function getPhpVersion ()
65+ public function getPhpVersion (): int
7266 {
7367 return $ this ->phpVersion ;
7468 }
7569
76- /** @return array */
77- public function getWhitelist ()
70+ public function getWhitelist (): array
7871 {
7972 return $ this ->whitelist ;
8073 }
8174
82- /** @return bool */
83- public function isHelp ()
75+ public function isHelp (): bool
8476 {
8577 return $ this ->isHelp ;
8678 }
8779
88- /** @return bool */
89- public function isVerbose ()
80+ public function isVerbose (): bool
9081 {
9182 return $ this ->isVerbose ;
9283 }
@@ -102,7 +93,7 @@ final public function parse()
10293 {
10394 $ arguments = $ this ->arguments ;
10495 // @TODO: Use Symfony Finder instead of hard-coded IO lookup
105- $ finder = $ this ->finder ;
96+ // $finder = $this->finder;
10697
10798 $ this ->isVerbose = array_key_exists ('verbose ' , $ arguments );
10899
@@ -130,7 +121,7 @@ final public function parse()
130121 }
131122 }
132123
133- final public function isValid ()
124+ final public function isValid (): bool
134125 {
135126 return $ this ->errorCode === 0 ;
136127 }
@@ -142,48 +133,43 @@ final public function loadIdentifiers()
142133 }
143134
144135 ////////////////////////////// UTILITY METHODS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
145- /**
146- * @param string $key
147- */
148- private function loadSpecificIdentifiers ($ key )
136+ private function loadSpecificIdentifiers (string $ key )
149137 {
150138 $ arguments = $ this ->arguments ;
151139
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 ];
155145
156- if (is_scalar ($ identifiers )) {
157- $ identifiers = [$ identifiers ];
158- }
146+ if (is_scalar ($ identifiers )) {
147+ $ identifiers = [$ identifiers ];
148+ }
159149
160- $ identifierPaths = [];
150+ $ identifierPaths = [];
161151
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 , '/ ' );
165155
166- if (is_dir ($ identifier )) {
167- $ files = glob ($ identifier . '/*.php ' );
156+ if (is_dir ($ identifier )) {
157+ $ files = glob ($ identifier . '/*.php ' );
168158
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+ });
177167
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 );
181170 }
182171 }
183172
184- /**
185- * @param $arguments
186- */
187173 private function loadDirectories ($ arguments )
188174 {
189175 if ($ this ->isValid () === true && array_key_exists ('subject ' , $ arguments )) {
@@ -194,7 +180,6 @@ private function loadDirectories($arguments)
194180 $ subjects = [$ subjects ];
195181 }
196182
197- /** @noinspection ForeachSourceInspection */
198183 foreach ($ subjects as $ subject ) {
199184 if (is_dir ($ subject )) {
200185 $ this ->directories [] = $ subject ;
@@ -209,9 +194,6 @@ private function loadDirectories($arguments)
209194 }
210195 }
211196
212- /**
213- * @param $arguments
214- */
215197 private function loadBlackList ($ arguments )
216198 {
217199 if ($ this ->isValid () === true ) {
@@ -228,9 +210,6 @@ private function loadBlackList($arguments)
228210 }
229211 }
230212
231- /**
232- * @param $arguments
233- */
234213 private function loadPhpVersion ($ arguments )
235214 {
236215 $ key = IdentifierOption::PHP_VERSION ;
0 commit comments