Conditions | 4 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | private function format(Throwable $exception): array |
||
38 | { |
||
39 | $data = [ |
||
40 | 'class' => get_class($exception), |
||
41 | 'message' => $this->clearEof($exception->getMessage()), |
||
42 | 'code' => $exception->getCode(), |
||
43 | 'file' => sprintf("%s:%s", $exception->getFile(), $exception->getLine()) |
||
44 | ]; |
||
45 | |||
46 | $trace = $exception->getTrace(); |
||
47 | foreach ($trace as $frame) { |
||
48 | if (isset($frame['file'])) { |
||
49 | $data['trace'][] = sprintf("%s:%s", $frame['file'], $frame['line']); |
||
50 | } |
||
51 | } |
||
52 | |||
53 | if ($previous = $exception->getPrevious()) { |
||
54 | $data['previous'] = $this->format($previous); |
||
55 | } |
||
56 | |||
57 | return $data; |
||
58 | } |
||
60 |