CheckGates::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 13
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\LaravelMicroscope\Commands;
4
5
use Illuminate\Console\Command;
6
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
7
use Imanghafoori\LaravelMicroscope\SpyClasses\SpyGate;
8
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;
9
10 View Code Duplication
class CheckGates 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...
11
{
12
    use LogsErrors;
13
14
    protected $signature = 'check:gates';
15
16
    protected $description = 'Checks the validity of gate definitions';
17
18
    public function handle(ErrorPrinter $errorPrinter)
19
    {
20
        event('microscope.start.command');
21
        $this->info('Checking gates...');
22
23
        $errorPrinter->printer = $this->output;
24
25
        $this->finishCommand($errorPrinter);
26
        $this->getOutput()->writeln(' - '.SpyGate::$definedGatesNum.' gate definitions were checked.');
27
        event('microscope.finished.checks', [$this]);
28
29
        return $errorPrinter->pended ? 1 : 0;
30
    }
31
}
32