Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | class ExceptionHandler extends Handler |
||
15 | { |
||
16 | /** |
||
17 | * @param mixed $message |
||
18 | * @param array $context |
||
19 | * @return string |
||
20 | */ |
||
21 | public function handler(mixed $message, array $context = []): string |
||
22 | { |
||
23 | if ($message instanceof Exception) { |
||
24 | $msg = $this->encode($this->clearEof($message->getMessage())); |
||
25 | $exception = $this->encode($this->format($message)); |
||
26 | |||
27 | return sprintf('%s %s', $msg, $exception); |
||
28 | } |
||
29 | |||
30 | return parent::handler($message, $context); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param Throwable $exception |
||
35 | * @return array |
||
36 | */ |
||
37 | private function format(Throwable $exception): array |
||
58 | } |
||
59 | } |
||
60 |