@@ -40,11 +40,7 @@ public function handle(ErrorPrinter $errorPrinter)
40
40
$ this ->fixReferences ($ autoload , $ olds , $ news );
41
41
}
42
42
if (Str::startsWith (request ()->server ('argv ' )[1 ] ?? '' , 'check:psr4 ' )) {
43
- $ this ->getOutput ()->writeln ('' );
44
- $ this ->getOutput ()->writeln ('<fg=green>Finished!</fg=green> ' );
45
- $ this ->getOutput ()->writeln ('============================== ' );
46
- $ this ->getOutput ()->writeln ('<options=bold;fg=yellow> ' .CheckNamespaces::$ checkedNamespaces .' classes were checked under:</> ' );
47
- $ this ->getOutput ()->writeln (' - ' .implode ("\n - " , array_keys ($ autoload )).'' );
43
+ $ this ->reportResult ($ autoload );
48
44
$ this ->printErrorsCount ($ errorPrinter , $ time );
49
45
} else {
50
46
$ this ->getOutput ()->writeln (' - ' .CheckNamespaces::$ checkedNamespaces .' namespaces were checked. ' );
@@ -175,20 +171,34 @@ private function checkNamespaces(array $autoload)
175
171
}
176
172
}
177
173
178
- private function report (string $ _path , $ line )
174
+ private function report ($ _path , $ line )
179
175
{
180
176
app (ErrorPrinter::class)->simplePendError ($ _path , $ line , '' , 'ns_replacement ' , 'Namespace replacement: ' );
181
177
}
182
178
183
179
private function printErrorsCount ($ errorPrinter , $ time )
184
180
{
185
181
if ($ errorCount = $ errorPrinter ->errorsList ['total ' ]) {
186
- $ errorCount && $ this ->warn (PHP_EOL .$ errorCount .' error(s) found in namespaces ' );
182
+ $ this ->warn (PHP_EOL .$ errorCount .' error(s) found in namespaces ' );
187
183
} else {
188
- $ time = microtime (true ) - $ time ;
189
- $ this ->line (PHP_EOL .'<fg=green>All namespaces are correct!</><fg=blue> You rock \(^_^)/ </> ' );
190
- $ this ->line ('<fg=red;options=bold> ' .round ($ time , 5 ).'(s)</> ' );
191
- $ this ->line ('' );
184
+ $ this ->noErrorFound ($ time );
192
185
}
193
186
}
187
+
188
+ private function reportResult ($ autoload )
189
+ {
190
+ $ this ->getOutput ()->writeln ('' );
191
+ $ this ->getOutput ()->writeln ('<fg=green>Finished!</fg=green> ' );
192
+ $ this ->getOutput ()->writeln ('============================== ' );
193
+ $ this ->getOutput ()->writeln ('<options=bold;fg=yellow> ' .CheckNamespaces::$ checkedNamespaces .' classes were checked under:</> ' );
194
+ $ this ->getOutput ()->writeln (' - ' .implode ("\n - " , array_keys ($ autoload )).'' );
195
+ }
196
+
197
+ private function noErrorFound ($ time )
198
+ {
199
+ $ time = microtime (true ) - $ time ;
200
+ $ this ->line (PHP_EOL .'<fg=green>All namespaces are correct!</><fg=blue> You rock \(^_^)/ </> ' );
201
+ $ this ->line ('<fg=red;options=bold> ' .round ($ time , 5 ).'(s)</> ' );
202
+ $ this ->line ('' );
203
+ }
194
204
}
0 commit comments