CheckEvents::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 12
loc 12
rs 9.8666
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\SpyDispatcher;
8
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;
9
10 View Code Duplication
class CheckEvents 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:events';
15
16
    protected $description = 'Checks the validity of event listeners';
17
18
    /**
19
     * Execute the console command.
20
     *
21
     * @param  ErrorPrinter  $errorPrinter
22
     *
23
     * @return mixed
24
     */
25
    public function handle(ErrorPrinter $errorPrinter)
26
    {
27
        event('microscope.start.command');
28
        $this->info('Checking events...');
29
30
        $errorPrinter->printer = $this->output;
31
32
        event('microscope.finished.checks', [$this]);
33
        $this->getOutput()->writeln(' - '.SpyDispatcher::$listeningNum.' listenings were checked.');
34
35
        return $errorPrinter->pended ? 1 : 0;
36
    }
37
}
38