1 | <?php |
||
14 | class Repository |
||
15 | { |
||
16 | /** |
||
17 | * @author Andrea Marco Sartori |
||
18 | * @var array $reporters List of handlers reporting exceptions. |
||
19 | */ |
||
20 | protected $reporters = []; |
||
21 | |||
22 | /** |
||
23 | * @author Andrea Marco Sartori |
||
24 | * @var array $renderers List of handlers rendering exceptions. |
||
25 | */ |
||
26 | protected $renderers = []; |
||
27 | |||
28 | /** |
||
29 | * @author Andrea Marco Sartori |
||
30 | * @var array $consoleRenderers List of handlers rendering exceptions to the console. |
||
31 | */ |
||
32 | protected $consoleRenderers = []; |
||
33 | |||
34 | /** |
||
35 | * Register a custom handler to report exceptions. |
||
36 | * |
||
37 | * @author Andrea Marco Sartori |
||
38 | * @param \Closure $reporter |
||
39 | * @return integer |
||
40 | */ |
||
41 | 6 | public function addReporter(Closure $reporter) |
|
45 | |||
46 | /** |
||
47 | * Register a custom handler to render exceptions. |
||
48 | * |
||
49 | * @author Andrea Marco Sartori |
||
50 | * @param \Closure $renderer |
||
51 | * @return integer |
||
52 | */ |
||
53 | 6 | public function addRenderer(Closure $renderer) |
|
57 | |||
58 | /** |
||
59 | * Register a custom handler to render exceptions to the console. |
||
60 | * |
||
61 | * @author Andrea Marco Sartori |
||
62 | * @param \Closure $renderer |
||
63 | * @return integer |
||
64 | */ |
||
65 | 6 | public function addConsoleRenderer(Closure $renderer) |
|
69 | |||
70 | /** |
||
71 | * Retrieve all the reporters that handle the given exception. |
||
72 | * |
||
73 | * @param \Exception $e |
||
74 | * @return array |
||
75 | */ |
||
76 | 3 | public function getReportersFor(Exception $e) |
|
80 | |||
81 | /** |
||
82 | * Retrieve the filter to get only handlers that handle the given exception. |
||
83 | * |
||
84 | * @param \Exception $e |
||
85 | * @return \Closure |
||
86 | */ |
||
87 | protected function handlesException(Exception $e) |
||
99 | |||
100 | /** |
||
101 | * Retrieve all the renderers that handle the given exception. |
||
102 | * |
||
103 | * @param \Exception $e |
||
104 | * @return array |
||
105 | */ |
||
106 | 3 | public function getRenderersFor(Exception $e) |
|
110 | |||
111 | /** |
||
112 | * Retrieve all the renderers for console that handle the given exception. |
||
113 | * |
||
114 | * @param \Exception $e |
||
115 | * @return array |
||
116 | */ |
||
117 | 3 | public function getConsoleRenderersFor(Exception $e) |
|
121 | } |
||
122 |