ClassifyStrings::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\LaravelMicroscope\Commands;
4
5
use Illuminate\Console\Command;
6
use Imanghafoori\LaravelMicroscope\Checks\CheckStringy;
7
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
8
use Imanghafoori\LaravelMicroscope\Psr4Classes;
9
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;
10
11
class ClassifyStrings extends Command
12
{
13
    use LogsErrors;
14
15
    public static $checkedCallsNum = 0;
16
17
    protected $signature = 'check:stringy_classes';
18
19
    protected $description = 'Replaces string references with ::class version of them';
20
21
    public function handle(ErrorPrinter $errorPrinter)
22
    {
23
        $this->info('Checking stringy classes...');
24
        app()->singleton('current.command', function () {
25
            return $this;
26
        });
27
        $errorPrinter->printer = $this->output;
28
        Psr4Classes::check([CheckStringy::class]);
29
        $this->getOutput()->writeln(' - Finished looking for stringy classes.');
30
31
        $this->finishCommand($errorPrinter);
32
33
        return $errorPrinter->hasErrors() ? 1 : 0;
34
    }
35
}
36