| Total Complexity | 11 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 7 | class Stacktrace |
||
| 8 | { |
||
| 9 | use PathTrait; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @var Throwable |
||
| 13 | */ |
||
| 14 | protected $exception; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param Throwable |
||
| 18 | */ |
||
| 19 | public function __construct(Throwable $exception) |
||
| 22 | } |
||
| 23 | |||
| 24 | protected function inTrace(array $frames): bool |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return array |
||
| 38 | */ |
||
| 39 | public function getTrace(): array |
||
| 40 | { |
||
| 41 | $frames = $this->exception->getTrace(); |
||
| 42 | |||
| 43 | if (!$this->inTrace($frames)) { |
||
| 44 | array_unshift($frames, [ |
||
| 45 | 'file' => $this->exception->getFile(), |
||
| 46 | 'line' => $this->exception->getLine(), |
||
| 47 | ]); |
||
| 48 | } |
||
| 49 | |||
| 50 | return $frames; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return array |
||
| 55 | */ |
||
| 56 | public function getFrames(): array |
||
| 67 | } |
||
| 68 | } |
||
| 69 |