1 | <?php |
||
12 | final class ErrorHandler implements \Nofw\Error\ErrorHandler |
||
13 | { |
||
14 | private $context = []; |
||
15 | |||
16 | /** |
||
17 | * @var ErrorHandler[] |
||
18 | */ |
||
19 | private $handlers = []; |
||
20 | |||
21 | /** |
||
22 | * @var Processor[] |
||
23 | */ |
||
24 | private $processors = []; |
||
25 | |||
26 | public function __construct(array $context = []) |
||
30 | |||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | public function handle(\Throwable $t, array $context = []): void |
||
48 | |||
49 | /** |
||
50 | * Pushes a handler on to the stack. |
||
51 | * |
||
52 | * @param \Nofw\Error\ErrorHandler $handler |
||
53 | * |
||
54 | * @return ErrorHandler |
||
55 | */ |
||
56 | public function pushHandler(\Nofw\Error\ErrorHandler $handler): self |
||
62 | |||
63 | /** |
||
64 | * Pops a handler from the stack. |
||
65 | * |
||
66 | * @return \Nofw\Error\ErrorHandler |
||
67 | * |
||
68 | * @throws \LogicException If the handler stack is empty |
||
69 | */ |
||
70 | public function popHandler(): \Nofw\Error\ErrorHandler |
||
78 | |||
79 | /** |
||
80 | * @return ErrorHandler[] |
||
81 | */ |
||
82 | public function getHandlers(): array |
||
86 | |||
87 | /** |
||
88 | * @param ErrorHandler[] $handlers |
||
89 | * |
||
90 | * @return ErrorHandler |
||
91 | */ |
||
92 | public function setHandlers(array $handlers): self |
||
102 | |||
103 | /** |
||
104 | * Pushes a processor on to the stack. |
||
105 | * |
||
106 | * @param Processor $processor |
||
107 | * |
||
108 | * @return ErrorHandler |
||
109 | */ |
||
110 | public function pushProcessor(Processor $processor): self |
||
116 | |||
117 | /** |
||
118 | * Pops a processor from the stack. |
||
119 | * |
||
120 | * @return Processor |
||
121 | * |
||
122 | * @throws \LogicException If the processor stack is empty |
||
123 | */ |
||
124 | public function popProcessor(): Processor |
||
132 | |||
133 | /** |
||
134 | * @return Processor[] |
||
135 | */ |
||
136 | public function getProcessors(): array |
||
140 | |||
141 | /** |
||
142 | * @param Processor[] $processors |
||
143 | * |
||
144 | * @return ErrorHandler |
||
145 | */ |
||
146 | public function setProcessors(array $processors): self |
||
156 | } |
||
157 |