1 | <?php |
||
14 | class ErrorHandler |
||
15 | { |
||
16 | const KEY = 'EXCEPTION'; |
||
17 | |||
18 | use Utils\HandlerTrait; |
||
19 | |||
20 | /** |
||
21 | * @var Run|null To handle errors using whoops |
||
22 | */ |
||
23 | protected $whoops; |
||
24 | |||
25 | /** |
||
26 | * @var bool Whether or not catch exceptions |
||
27 | */ |
||
28 | protected $catchExceptions = false; |
||
29 | |||
30 | /** |
||
31 | * Returns the exception throwed. |
||
32 | * |
||
33 | * @param ServerRequestInterface $request |
||
34 | * |
||
35 | * @return \Exception|null |
||
36 | */ |
||
37 | public static function getException(ServerRequestInterface $request) |
||
41 | |||
42 | /** |
||
43 | * Set an instance of Whoops. |
||
44 | * |
||
45 | * @param Run $whoops |
||
46 | * |
||
47 | * @return self |
||
48 | */ |
||
49 | public function whoops(Run $whoops) |
||
55 | |||
56 | /** |
||
57 | * Configure the catchExceptions. |
||
58 | * |
||
59 | * @param bool $catch |
||
60 | * |
||
61 | * @return self |
||
62 | */ |
||
63 | public function catchExceptions($catch = true) |
||
69 | |||
70 | /** |
||
71 | * Execute the middleware. |
||
72 | * |
||
73 | * @param ServerRequestInterface $request |
||
74 | * @param ResponseInterface $response |
||
75 | * @param callable $next |
||
76 | * |
||
77 | * @return ResponseInterface |
||
78 | */ |
||
79 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
120 | } |
||
121 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.