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

package

Joomla Framework

Methods

__construct

Constructor.

__construct() : mixed
since

1.0

Response

mixed

add

Add a listener with the given priority only if not already present.

add(\Closure|object listener, int priority) : \Joomla\Event\ListenersPriorityQueue
since

1.0

Arguments

listener

\Closure|objectThe listener.

priority

intThe listener priority.

Response

\Joomla\Event\ListenersPriorityQueueThis method is chainable.

count

Count the number of listeners in the queue.

count() : int
since

1.0

Response

intThe number of listeners in the queue.

getAll

Get all listeners contained in this queue, sorted according to their priority.

getAll() : object[]
since

1.0

Response

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) : bool
since

1.0

Arguments

listener

\Closure|objectThe listener.

Response

boolTrue 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)

int