| Total Complexity | 4 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 90.91% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | abstract class ThrowableRenderer implements ThrowableRendererInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var ServerRequestInterface |
||
| 11 | */ |
||
| 12 | protected $request; |
||
| 13 | |||
| 14 | 3 | protected function getThrowableName(\Throwable $t): string |
|
| 15 | { |
||
| 16 | 3 | $name = get_class($t); |
|
| 17 | |||
| 18 | 3 | if ($t instanceof FriendlyExceptionInterface) { |
|
| 19 | $name = $t->getName() . ' (' . $name . ')'; |
||
| 20 | } |
||
| 21 | |||
| 22 | 3 | return $name; |
|
| 23 | } |
||
| 24 | |||
| 25 | 3 | protected function convertThrowableToVerboseString(\Throwable $t): string |
|
| 26 | { |
||
| 27 | 3 | return $this->getThrowableName($t) . " with message '{$t->getMessage()}' \n\nin " |
|
| 28 | 3 | . $t->getFile() . ':' . $t->getLine() . "\n\n" |
|
| 29 | 3 | . "Stack trace:\n" . $t->getTraceAsString(); |
|
| 30 | } |
||
| 31 | |||
| 32 | 1 | public function setRequest(ServerRequestInterface $request): void |
|
| 35 | } |
||
| 36 | } |
||
| 37 |