1 | <?php |
||
18 | class EventMultiHandler implements EventHandlerInterface |
||
19 | { |
||
20 | /** |
||
21 | * List of handlers |
||
22 | * |
||
23 | * @var EventHandlerInterface[] |
||
24 | */ |
||
25 | private $handlers = []; |
||
26 | |||
27 | /** |
||
28 | * EventMultiHandler constructor. |
||
29 | * |
||
30 | * @param EventHandlerInterface[] $handlers List of handlers |
||
31 | */ |
||
32 | 4 | public function __construct(array $handlers = []) |
|
38 | |||
39 | /** {@inheritdoc} */ |
||
40 | 4 | public function invokeEvent( |
|
50 | |||
51 | /** |
||
52 | * Add handler to list |
||
53 | * |
||
54 | * @param EventHandlerInterface $handler Handler to add |
||
55 | * |
||
56 | * @return void |
||
57 | */ |
||
58 | 4 | public function addHandler(EventHandlerInterface $handler) |
|
63 | |||
64 | /** |
||
65 | * Remove handler from list |
||
66 | * |
||
67 | * @param EventHandlerInterface $handler Handler to remove |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | 1 | public function removeHandler(EventHandlerInterface $handler) |
|
78 | |||
79 | /** |
||
80 | * Return key for given handler |
||
81 | * |
||
82 | * @param EventHandlerInterface $handler Handler to get key for |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | 4 | private function getHandlerKey(EventHandlerInterface $handler) |
|
90 | } |
||
91 |