| Total Complexity | 4 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class HoneybadgerCheckinCommand extends Command |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * The name and signature of the console command. |
||
| 13 | * "id" can be the check-in ID or the check-in name. |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $signature = 'honeybadger:checkin {id}'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The console command description. |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $description = 'Send check-in to Honeybadger'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Execute the console command. |
||
| 28 | * |
||
| 29 | * @return mixed |
||
| 30 | */ |
||
| 31 | public function handle(Reporter $honeybadger) |
||
| 32 | { |
||
| 33 | try { |
||
| 34 | $idOrName = $this->checkinIdOrName(); |
||
| 35 | $honeybadger->checkin($idOrName); |
||
| 36 | $this->info(sprintf('Checkin %s was sent to Honeybadger', $idOrName)); |
||
| 37 | } catch (Exception $e) { |
||
| 38 | $this->error($e->getMessage()); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the API key from input. |
||
| 44 | * |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | private function checkinIdOrName(): string |
||
| 52 | } |
||
| 53 | } |
||
| 54 |