ListenersPriorityQueue
Implements \IteratorAggregate, \CountableA class containing an inner listeners priority queue that can be iterated multiple times.
One instance of ListenersPriorityQueue is used per Event in the Dispatcher.
since |
1.0 |
---|
Methods
__construct
Constructor.
__construct()
since |
1.0 |
---|
add
Add a listener with the given priority only if not already present.
add(\Closure|object $listener, integer $priority) : \Joomla\Event\ListenersPriorityQueue
since |
1.0 |
---|
Arguments
- $listener
\Closure|object
The listener.- $priority
integer
The listener priority.
Response
\Joomla\Event\ListenersPriorityQueue
This method is chainable.
count
Count the number of listeners in the queue.
count() : integer
since |
1.0 |
---|
Response
integer
The number of listeners in the queue.
getAll
Get all listeners contained in this queue, sorted according to their priority.
getAll() : array<mixed,object>
since |
1.0 |
---|
Response
array<mixed,object>
An array of listeners.
getIterator
Get the inner queue with its cursor on top of the heap.
getIterator() : \SplPriorityQueue
since |
1.0 |
---|
Response
\SplPriorityQueue
The inner queue.
getPriority
Get the priority of the given listener.
getPriority(\Closure|object $listener, mixed $default = null) : mixed
since |
1.0 |
---|
Arguments
- $listener
\Closure|object
The listener.- $default
mixed
The default value to return if the listener doesn't exist.
Response
mixed
The listener priority if it exists, null otherwise.
has
Tell if the listener exists in the queue.
has(\Closure|object $listener) : boolean
since |
1.0 |
---|
Arguments
- $listener
\Closure|object
The listener.
Response
boolean
True if it exists, false otherwise.
remove
Remove a listener from the queue.
remove(\Closure|object $listener) : \Joomla\Event\ListenersPriorityQueue
since |
1.0 |
---|
Arguments
- $listener
\Closure|object
The listener.
Response
\Joomla\Event\ListenersPriorityQueue
This method is chainable.
Properties
queue
The inner priority queue.
since |
1.0 |
---|
Type(s)
\SplPriorityQueue
storage
A copy of the listeners contained in the queue that is used when detaching them to recreate the queue or to see if the queue contains a given listener.
since |
1.0 |
---|
Type(s)
\SplObjectStorage
counter
A decreasing counter used to compute the internal priority as an array because SplPriorityQueue dequeues elements with the same priority.
since |
1.0 |
---|
Type(s)
integer