Conditions | 3 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4.125 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 51 | public function boot(ErrorHandlerContract $errorHandler): void |
|
24 | { |
||
25 | 51 | if ($this->app->environment() === 'production') { |
|
26 | $this->app->make(ApplicationContract::class)->setCatchExceptions(true); |
||
27 | } else { |
||
28 | 51 | $errorHandler->register(); |
|
29 | 51 | set_exception_handler( |
|
30 | 51 | function (Throwable $e) use ($errorHandler) { |
|
31 | $handler = $this->app->make(ErrorHandlerContract::class)->getProvider()->getHandler(); |
||
32 | if ($e instanceof ExceptionInterface) { |
||
33 | $this->app->make(ApplicationContract::class)->renderException( |
||
34 | $e, $handler->getWriter()->getOutput() |
||
35 | ); |
||
36 | } else { |
||
37 | $handler->setInspector(new Inspector($e)); |
||
38 | $handler->handle(); |
||
39 | } |
||
40 | 51 | } |
|
41 | ); |
||
42 | } |
||
43 | 51 | } |
|
44 | |||
57 |