Total Complexity | 5 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
8 | abstract class AbstractEventListener implements EventListenerInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var \Closure|null |
||
12 | */ |
||
13 | protected $errorHandler; |
||
14 | |||
15 | /** |
||
16 | * @param \Closure|null $errorHandler |
||
17 | * |
||
18 | * @return \Jellyfish\Event\EventListenerInterface |
||
19 | */ |
||
20 | public function setErrorHandler(?Closure $errorHandler): EventListenerInterface |
||
21 | { |
||
22 | $this->errorHandler = $errorHandler; |
||
23 | |||
24 | return $this; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param \Jellyfish\Event\EventInterface $event |
||
29 | * @return \Jellyfish\Event\EventListenerInterface |
||
30 | */ |
||
31 | public function handle(EventInterface $event): EventListenerInterface |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @param \Jellyfish\Event\EventInterface $event |
||
44 | * |
||
45 | * @return \Jellyfish\Event\EventListenerInterface |
||
46 | */ |
||
47 | abstract protected function doHandle(EventInterface $event): EventListenerInterface; |
||
48 | |||
49 | /** |
||
50 | * @param \Exception $e |
||
51 | * @param \Jellyfish\Event\EventInterface $event |
||
52 | * |
||
53 | * @return \Jellyfish\Event\EventListenerInterface |
||
54 | */ |
||
55 | protected function handleError(Exception $e, EventInterface $event): EventListenerInterface |
||
64 | } |
||
65 | } |
||
66 |