protonemedia /
laravel-api-health
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace ProtoneMedia\ApiHealth\Console; |
||||
| 4 | |||||
| 5 | use Illuminate\Console\Command; |
||||
| 6 | use ProtoneMedia\ApiHealth\Checkers\Executor; |
||||
| 7 | |||||
| 8 | class Check extends Command |
||||
| 9 | { |
||||
| 10 | /** |
||||
| 11 | * The name and signature of the console command. |
||||
| 12 | * |
||||
| 13 | * @var string |
||||
| 14 | */ |
||||
| 15 | protected $signature = 'api-health:check {checkerClass}'; |
||||
| 16 | |||||
| 17 | /** |
||||
| 18 | * The console command description. |
||||
| 19 | * |
||||
| 20 | * @var string |
||||
| 21 | */ |
||||
| 22 | protected $description = 'Run the given checker'; |
||||
| 23 | |||||
| 24 | /** |
||||
| 25 | * Displays the result of the given checker. |
||||
| 26 | * |
||||
| 27 | * @return null |
||||
| 28 | */ |
||||
| 29 | public function handle() |
||||
| 30 | { |
||||
| 31 | $executor = Executor::make( |
||||
| 32 | $checkerClass = $this->argument('checkerClass') |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 33 | ); |
||||
| 34 | |||||
| 35 | $this->info('Running checker: ' . $checkerClass); |
||||
|
0 ignored issues
–
show
Are you sure
$checkerClass of type array|null|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 36 | |||||
| 37 | if ($executor->passes()) { |
||||
| 38 | $this->info('Passes!'); |
||||
| 39 | } else { |
||||
| 40 | $this->error('Fails! ' . $executor->getException()->getMessage()); |
||||
| 41 | } |
||||
| 42 | } |
||||
| 43 | } |
||||
| 44 |