1 | <?php |
||
14 | class ListenerPriorityQueue implements \IteratorAggregate |
||
15 | { |
||
16 | /** |
||
17 | * @var \SplObjectStorage |
||
18 | */ |
||
19 | protected $storage; |
||
20 | |||
21 | /** |
||
22 | * @var \SplPriorityQueue |
||
23 | */ |
||
24 | protected $queue; |
||
25 | |||
26 | public function __construct() |
||
31 | |||
32 | /** |
||
33 | * Insert an listener to the queue. |
||
34 | * |
||
35 | * @param ListenerInterface $listener |
||
36 | * @param int $priority |
||
37 | */ |
||
38 | public function insert(ListenerInterface $listener, $priority) |
||
43 | |||
44 | /** |
||
45 | * Removes an listener from the queue. |
||
46 | * |
||
47 | * @param ListenerInterface $listener |
||
48 | */ |
||
49 | public function detach(ListenerInterface $listener) |
||
56 | |||
57 | /** |
||
58 | * Clears the queue. |
||
59 | */ |
||
60 | public function clear() |
||
65 | |||
66 | /** |
||
67 | * Clears the queue. |
||
68 | * |
||
69 | * @deprecated use clear instead |
||
70 | */ |
||
71 | public function flush() |
||
75 | |||
76 | /** |
||
77 | * Checks whether the queue contains the listener. |
||
78 | * |
||
79 | * @param ListenerInterface $listener |
||
80 | * |
||
81 | * @return boolean |
||
82 | */ |
||
83 | public function contains(ListenerInterface $listener) |
||
87 | |||
88 | /** |
||
89 | * Gets all listeners. |
||
90 | * |
||
91 | * @return ListenerInterface[] |
||
92 | */ |
||
93 | public function all() |
||
102 | |||
103 | /** |
||
104 | * Gets all listeners. |
||
105 | * |
||
106 | * @deprecated use all instead |
||
107 | */ |
||
108 | public function getAll() |
||
112 | |||
113 | /** |
||
114 | * Clones and returns a iterator. |
||
115 | * |
||
116 | * @return \SplPriorityQueue |
||
117 | */ |
||
118 | public function getIterator() |
||
127 | |||
128 | /** |
||
129 | * Refreshes the status of the queue. |
||
130 | */ |
||
131 | protected function refreshQueue() |
||
140 | } |
||
141 |