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