1 | <?php |
||
17 | class Decorator implements ExceptionHandler |
||
18 | { |
||
19 | /** |
||
20 | * @var ExceptionHandler $handler Laravel default exception handler. |
||
21 | */ |
||
22 | protected $handler; |
||
23 | |||
24 | /** |
||
25 | * @var ExceptionHandlerRepository $handlers Custom exception handlers repository. |
||
26 | */ |
||
27 | protected $handlers; |
||
28 | |||
29 | /** |
||
30 | * @var Repository |
||
31 | */ |
||
32 | protected $config; |
||
33 | |||
34 | /** |
||
35 | * Set the dependencies. |
||
36 | * |
||
37 | * @param ExceptionHandler $handler |
||
38 | * @param ExceptionHandlerRepository $handlers |
||
39 | */ |
||
40 | public function __construct(ExceptionHandler $handler, ExceptionHandlerRepository $handlers, Repository $config) |
||
46 | |||
47 | /** |
||
48 | * Report or log an exception. |
||
49 | * |
||
50 | * @param \Exception $e |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | public function report(Exception $e) |
||
78 | |||
79 | /** |
||
80 | * Register a custom handler to report exceptions |
||
81 | * |
||
82 | * @param Closure $reporter |
||
83 | * |
||
84 | * @return int |
||
85 | */ |
||
86 | public function reporter(Closure $reporter): int |
||
90 | |||
91 | /** |
||
92 | * Render an exception into an HTTP response |
||
93 | * |
||
94 | * @param \Illuminate\Http\Request $request |
||
95 | * @param Exception $e |
||
96 | * |
||
97 | * @return Response |
||
98 | */ |
||
99 | public function render($request, Exception $e): Response |
||
109 | |||
110 | /** |
||
111 | * Register a custom handler to render exceptions |
||
112 | * |
||
113 | * @param Closure $renderer |
||
114 | * |
||
115 | * @return int |
||
116 | */ |
||
117 | public function renderer(Closure $renderer): int |
||
121 | |||
122 | /** |
||
123 | * Render an exception to the console |
||
124 | * |
||
125 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
126 | * @param Exception $e |
||
127 | * |
||
128 | * @return mixed |
||
129 | */ |
||
130 | public function renderForConsole($output, Exception $e) |
||
140 | |||
141 | /** |
||
142 | * Register a custom handler to render exceptions to the console |
||
143 | * |
||
144 | * @param Closure $renderer |
||
145 | * |
||
146 | * @return int |
||
147 | */ |
||
148 | public function consoleRenderer(Closure $renderer): int |
||
152 | } |
||
153 |