Conditions | 3 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public function onError(ConsoleErrorEvent $event): void |
||
23 | { |
||
24 | $exception = $event->getError(); |
||
25 | $command = $event->getCommand(); |
||
26 | |||
27 | if ($command !== null && $command->getName() !== null) { |
||
28 | $commandName = $command->getName(); |
||
29 | } else { |
||
30 | $commandName = 'unknown'; |
||
31 | } |
||
32 | |||
33 | $message = sprintf( |
||
34 | '%s: %s in %s:%s while running console command `%s`', |
||
35 | get_class($exception), |
||
36 | $exception->getMessage(), |
||
37 | $exception->getFile(), |
||
38 | $exception->getLine(), |
||
39 | $commandName |
||
40 | ); |
||
41 | $this->logger->error($message, ['exception' => $exception]); |
||
42 | } |
||
44 |