ListenersPriorityQueue

Implements \IteratorAggregate, \Countable

A 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|objectThe listener.

$priority

integerThe listener priority.

Response

\Joomla\Event\ListenersPriorityQueueThis method is chainable.

count

Count the number of listeners in the queue.

count() : integer
since

1.0

Response

integerThe 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

\SplPriorityQueueThe inner queue.

getPriority

Get the priority of the given listener.

getPriority(\Closure|object $listener, mixed $default = null) : mixed
since

1.0

Arguments

$listener

\Closure|objectThe listener.

$default

mixedThe default value to return if the listener doesn't exist.

Response

mixedThe 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|objectThe listener.

Response

booleanTrue 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|objectThe listener.

Response

\Joomla\Event\ListenersPriorityQueueThis 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