Re-usable, serializable priority queue implementation
SplPriorityQueue acts as a heap; on iteration, each item is removed from the queue. If you wish to re-use such a queue, you need to clone it first. This makes for some interesting issues if you wish to delete items from the queue, or, as already stated, iterate over it multiple times.
This class aggregates items for the queue itself, but also composes an "inner" iterator in the form of an SplPriorityQueue object for performing the actual iteration.
__clone() : void
contains(mixed $datum) : bool
count() : int
extract() : mixed
getIterator() : \Zend\Stdlib\SplPriorityQueue
SplPriorityQueue acts as a heap, which typically implies that as items are iterated, they are also removed. This does not work for situations where the queue may be iterated multiple times. As such, this class aggregates the values, and also injects an SplPriorityQueue. This method retrieves the inner queue object, and clones it for purposes of iteration.
hasPriority(int $priority) : bool
insert(mixed $data, int $priority) : \Zend\Stdlib\PriorityQueue
Priority defaults to 1 (low priority) if none provided.
isEmpty() : bool
remove(mixed $datum) : bool
This is different than extract(); its purpose is to dequeue an item.
This operation is potentially expensive, as it requires re-initialization and re-population of the inner queue.
Note: this removes the first item matching the provided item found. If the same item has been added multiple times, it will not remove other instances.
boolFalse if the item was not found, true otherwise.
serialize() : string
setInternalQueueClass(string $class) : \Zend\Stdlib\PriorityQueue
toArray(int $flag) : array
By default, returns only the item data, and in the order registered (not sorted). You may provide one of the EXTR_* flags as an argument, allowing the ability to return priorities or both data and priority.
top() : mixed
unserialize(string $data) : void
Serialization format is compatible with Zend\Stdlib\SplPriorityQueue
getQueue() : \Zend\Stdlib\SplPriorityQueue
$items : array
Each item is an array with keys "data" and "priority".
$queue : \Zend\Stdlib\SplPriorityQueue
$queueClass : string