1 | <?php |
||
37 | class ListenerCollection { |
||
38 | |||
39 | /** @var array */ |
||
40 | private $listenerQueues; |
||
41 | |||
42 | /** @var array */ |
||
43 | private $listeners; |
||
44 | |||
45 | 1 | public function __construct() { |
|
49 | |||
50 | /** |
||
51 | * Add a listener to the memory. |
||
52 | * @param \Brickoo\Component\Messaging\Listener $listener |
||
53 | * @return string the listener queue unique identifier |
||
54 | */ |
||
55 | 1 | public function add(Listener $listener) { |
|
66 | |||
67 | /** |
||
68 | * Return the listener matching the unique identifier. |
||
69 | * @param string $listenerUID the listener unique identifier |
||
70 | * @throws \InvalidArgumentException |
||
71 | * @throws \Brickoo\Component\Messaging\Exception\ListenerNotAvailableException |
||
72 | * @return \Brickoo\Component\Messaging\MessageListener |
||
73 | */ |
||
74 | 2 | public function get($listenerUID) { |
|
83 | |||
84 | /** |
||
85 | * Check if the listener with the unique identifier is available. |
||
86 | * @param string $listenerUID the listener unique identifier to check |
||
87 | * @throws \InvalidArgumentException |
||
88 | * @return boolean check result |
||
89 | */ |
||
90 | 1 | public function has($listenerUID) { |
|
94 | |||
95 | /** |
||
96 | * Remove the listener by its unique identifier. |
||
97 | * @param string $listenerUID the listener unique identifier |
||
98 | * @throws \InvalidArgumentException |
||
99 | * @throws \Brickoo\Component\Messaging\Exception\ListenerNotAvailableException |
||
100 | * @return \Brickoo\Component\Messaging\ListenerCollection |
||
101 | */ |
||
102 | 2 | public function remove($listenerUID) { |
|
115 | |||
116 | /** |
||
117 | * Return the message responsible listeners. |
||
118 | * @param string $messageName the message name to retrieve the queue from |
||
119 | * @throws \InvalidArgumentException |
||
120 | * @throws \Brickoo\Component\Messaging\Exception\ListenersNotAvailableException |
||
121 | * @return array the collected message listeners ordered by priority. |
||
122 | */ |
||
123 | 2 | public function getListeners($messageName) { |
|
132 | |||
133 | /** |
||
134 | * Check if the message has listeners listening. |
||
135 | * @param string $messageName the message name to check |
||
136 | * @throws \InvalidArgumentException if an argument is not valid |
||
137 | * @return boolean check result |
||
138 | */ |
||
139 | 1 | public function hasListeners($messageName) { |
|
143 | |||
144 | /** |
||
145 | * Collect the message corresponding listeners ordered by priority. |
||
146 | * @param string $messageName the message to collect the listeners for |
||
147 | * @return array the collected message listeners ordered by priority. |
||
148 | */ |
||
149 | 1 | private function collectMessageListeners($messageName) { |
|
158 | |||
159 | /** |
||
160 | * Return the message corresponding listener queue. |
||
161 | * @param string $messageName |
||
162 | * @return \Brickoo\Component\Messaging\ListenerPriorityQueue |
||
163 | */ |
||
164 | 1 | private function getListenerPriorityQueue($messageName) { |
|
167 | |||
168 | } |
||
169 |