Total Complexity | 4 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | final class Handlers |
||
13 | { |
||
14 | /** @var array<class-string, callable> */ |
||
|
|||
15 | private array $handlers = []; |
||
16 | |||
17 | 81 | public function __construct() |
|
20 | } |
||
21 | /** |
||
22 | * @param class-string<Exception> $exception |
||
23 | */ |
||
24 | 81 | public function handle(string $exception, callable $handler): self |
|
25 | { |
||
26 | 81 | $this->handlers[$exception] = $handler; |
|
27 | 81 | return $this; |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * @return array<class-string, callable> |
||
32 | */ |
||
33 | 10 | public function getAllHandlers(): array |
|
36 | } |
||
37 | |||
38 | 81 | private function addBuiltInHandlers(): void |
|
50 |