1 | <?php |
||
10 | class ErrorHandler implements ErrorHandling |
||
11 | { |
||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $handlers = []; |
||
16 | |||
17 | /** |
||
18 | * @codeCoverageIgnore |
||
19 | */ |
||
20 | public function __construct() |
||
31 | |||
32 | /** |
||
33 | * @param $exception |
||
34 | * @param Closure $handler |
||
35 | * @return $this |
||
36 | */ |
||
37 | 12 | public function register($exception, Closure $handler) |
|
43 | |||
44 | /** |
||
45 | * @param Exception $exception |
||
46 | * |
||
47 | * @return void |
||
48 | */ |
||
49 | public function handle(Exception $exception) |
||
70 | |||
71 | /** |
||
72 | * @return Closure |
||
73 | */ |
||
74 | protected function setExceptionHandler() |
||
80 | |||
81 | /** |
||
82 | * @return Closure |
||
83 | * @throws ErrorException |
||
84 | */ |
||
85 | protected function setErrorHandler() |
||
86 | { |
||
87 | 12 | return function ($severity, $message, $file, $line) { |
|
88 | 2 | if (error_reporting() && $severity) { |
|
89 | 1 | throw new ErrorException($message, 0, $severity, $file, $line); |
|
90 | } |
||
91 | |||
92 | 1 | return false; |
|
93 | 12 | }; |
|
94 | } |
||
95 | |||
96 | /** |
||
97 | * @return Closure |
||
98 | * @codeCoverageIgnore |
||
99 | */ |
||
100 | protected function handleFatalError() |
||
110 | } |
||
111 |