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