1 | <?php declare (strict_types=1); |
||
16 | final class QueuedEventDispatcher implements EventDispatcher |
||
17 | { |
||
18 | /** |
||
19 | * @var array |
||
20 | */ |
||
21 | private $listeners = []; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | private $sorted = []; |
||
27 | /** @var Queue */ |
||
28 | private $queue; |
||
29 | /** @var Serializer */ |
||
30 | private $serializer; |
||
31 | /** @var Repository */ |
||
32 | private $config; |
||
33 | |||
34 | /** |
||
35 | * QueuedEventDispatcher constructor. |
||
36 | * @param Queue $queue |
||
37 | * @param Serializer $serializer |
||
38 | * @param Repository $config |
||
39 | */ |
||
40 | public function __construct(Queue $queue, Serializer $serializer, Repository $config) |
||
46 | |||
47 | /** |
||
48 | * @param string $eventName |
||
49 | * @param array $arguments |
||
50 | * @param bool $runProjectionsOnly |
||
51 | */ |
||
52 | public function dispatch($eventName, array $arguments, $runProjectionsOnly = false) |
||
77 | |||
78 | /** |
||
79 | * @param string $eventName |
||
80 | * @param callable $callable |
||
81 | * @param int $priority |
||
82 | */ |
||
83 | public function addListener($eventName, callable $callable, $priority = 0) |
||
90 | |||
91 | |||
92 | /** |
||
93 | * @param Subscriber $subscriber |
||
94 | * @return void |
||
95 | */ |
||
96 | public function addSubscriber(Subscriber $subscriber) |
||
110 | |||
111 | /** |
||
112 | * @param $eventName |
||
113 | * @return array |
||
114 | */ |
||
115 | protected function getListenersInOrder($eventName) |
||
126 | |||
127 | /** |
||
128 | * Sorts the internal list of listeners for the given event by priority. |
||
129 | * |
||
130 | * @param string $eventName The name of the event. |
||
131 | */ |
||
132 | private function sortListeners($eventName) |
||
139 | } |
||
140 |