1 | <?php |
||
13 | class ErrorHandler |
||
14 | { |
||
15 | const KEY = 'EXCEPTION'; |
||
16 | |||
17 | use Utils\HandlerTrait; |
||
18 | |||
19 | /** |
||
20 | * @var bool Whether or not catch exceptions |
||
21 | */ |
||
22 | private $catchExceptions = false; |
||
23 | |||
24 | /** |
||
25 | * Returns the exception throwed. |
||
26 | * |
||
27 | * @param ServerRequestInterface $request |
||
28 | * |
||
29 | * @return \Exception|null |
||
30 | */ |
||
31 | public static function getException(ServerRequestInterface $request) |
||
35 | |||
36 | /** |
||
37 | * Configure the catchExceptions. |
||
38 | * |
||
39 | * @param bool $catch |
||
40 | * |
||
41 | * @return self |
||
42 | */ |
||
43 | public function catchExceptions($catch = true) |
||
49 | |||
50 | /** |
||
51 | * Execute the middleware. |
||
52 | * |
||
53 | * @param ServerRequestInterface $request |
||
54 | * @param ResponseInterface $response |
||
55 | * @param callable $next |
||
56 | * |
||
57 | * @return ResponseInterface |
||
58 | */ |
||
59 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
82 | } |
||
83 |