1 | <?php |
||
8 | final class EventHandlerCollection |
||
9 | { |
||
10 | /** @var \Illuminate\Support\Collection */ |
||
11 | private $eventHandlers; |
||
12 | |||
13 | public function __construct($eventHandlers = []) |
||
14 | { |
||
15 | $this->eventHandlers = collect(); |
||
16 | |||
17 | foreach ($eventHandlers as $eventHandler) { |
||
18 | $this->add($eventHandler); |
||
19 | } |
||
20 | } |
||
21 | |||
22 | public function add(EventHandler $eventHandler): void |
||
23 | { |
||
24 | $this->eventHandlers[get_class($eventHandler)] = $eventHandler; |
||
25 | } |
||
26 | |||
27 | public function all(): Collection |
||
31 | |||
32 | public function forEvent(StoredEvent $storedEvent): Collection |
||
38 | |||
39 | public function call(string $method) |
||
49 | |||
50 | public function remove(array $eventHandlerClassNames): void |
||
51 | { |
||
57 | } |
||
58 |