| Total Complexity | 16 |
| Total Lines | 82 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | trait DoesProcessException |
||
| 11 | { |
||
| 12 | /** @var bool */ |
||
| 13 | protected $throwOnError = true; |
||
| 14 | |||
| 15 | /** @return self */ |
||
| 16 | 1 | public function doNotThrowOnError(): self |
|
| 20 | } |
||
| 21 | |||
| 22 | /** @return self */ |
||
| 23 | 1 | public function throwOnError(): self |
|
| 27 | } |
||
| 28 | |||
| 29 | /** @return bool */ |
||
| 30 | 2 | public function doesThrowsOnError(): bool |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param \Throwable $e |
||
| 37 | * @throws \Throwable |
||
| 38 | */ |
||
| 39 | 2 | protected function processException(\Throwable $e): void |
|
| 44 | } |
||
| 45 | 1 | } |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @param \Throwable $e |
||
| 49 | */ |
||
| 50 | 2 | protected function debugException(\Throwable $e): void |
|
| 51 | { |
||
| 52 | 2 | if (\defined('APP_DEBUG') && APP_DEBUG) { |
|
| 53 | 2 | $this->dumpExceptionMessage($e); |
|
| 54 | 2 | $this->dumpExceptionObject($e); |
|
| 55 | } |
||
| 56 | 2 | } |
|
| 57 | |||
| 58 | /** |
||
| 59 | * @param mixed ...$that |
||
| 60 | */ |
||
| 61 | 2 | protected function dump(...$that): void |
|
| 62 | { |
||
| 63 | 2 | if (\function_exists('dump')) { |
|
| 64 | 2 | dump(...$that); |
|
| 65 | } else { |
||
| 66 | // @codeCoverageIgnoreStart |
||
| 67 | var_dump(...$that); |
||
| 68 | // @codeCoverageIgnoreEnd |
||
| 69 | } |
||
| 70 | 2 | } |
|
| 71 | |||
| 72 | /** |
||
| 73 | * @param \Throwable $e |
||
| 74 | */ |
||
| 75 | 2 | protected function dumpExceptionMessage(\Throwable $e): void |
|
| 81 | ); |
||
| 82 | } |
||
| 83 | 2 | } |
|
| 84 | |||
| 85 | /** |
||
| 86 | * @param \Throwable $e |
||
| 87 | */ |
||
| 88 | 2 | protected function dumpExceptionObject(\Throwable $e): void |
|
| 95 |