| @@ 10-36 (lines=27) @@ | ||
| 7 | use Imanghafoori\LaravelMicroscope\SpyClasses\SpyDispatcher; |
|
| 8 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
|
| 9 | ||
| 10 | class CheckEvents extends Command |
|
| 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 | ||
| @@ 10-31 (lines=22) @@ | ||
| 7 | use Imanghafoori\LaravelMicroscope\SpyClasses\SpyGate; |
|
| 8 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
|
| 9 | ||
| 10 | class CheckGates extends Command |
|
| 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 | ||