CheckDeadControllers::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 16
loc 16
rs 9.7333
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\RoutelessActions;
7
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
8
use Imanghafoori\LaravelMicroscope\Psr4Classes;
9
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;
10
11 View Code Duplication
class CheckDeadControllers extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    use LogsErrors;
14
15
    protected $signature = 'check:dead_controllers';
16
17
    protected $description = 'Checks that public controller methods have routes';
18
19
    public function handle(ErrorPrinter $errorPrinter)
20
    {
21
        event('microscope.start.command');
22
        $this->info('Checking for route-less controllers...');
23
24
        $errorPrinter->printer = $this->output;
25
26
        // checks calls like this: route('admin.user')
27
        // in the psr-4 loaded classes.
28
        Psr4Classes::check([RoutelessActions::class]);
29
30
        $this->finishCommand($errorPrinter);
31
        $errorPrinter->printTime();
32
33
        return $errorPrinter->hasErrors() ? 1 : 0;
34
    }
35
}
36