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.
Methods
Add support for deep cloning
__clone() : void
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::__clone() |
Does the queue contain the given datum?
contains(mixed $datum) : bool
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::contains() |
Parameters
$datum
mixed
Returns
bool
How many items are in the queue?
count() : int
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::count() |
Returns
int
Retrieve the inner iterator
getIterator() : \Zend\Stdlib\SplPriorityQueue
Inherited
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.
inherited_from |
\Zend\Stdlib\PriorityQueue::getIterator() |
Returns
Does the queue have an item with the given priority?
hasPriority(int $priority) : bool
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::hasPriority() |
Parameters
$priority
int
Returns
bool
Insert an item into the queue
insert(mixed $data, int $priority) : \Zend\Stdlib\PriorityQueue
Inherited
Priority defaults to 1 (low priority) if none provided.
inherited_from |
\Zend\Stdlib\PriorityQueue::insert() |
Parameters
$data
mixed
$priority
int
Returns
Is the queue empty?
isEmpty() : bool
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::isEmpty() |
Returns
bool
Process the whole config structure with each parser in the queue.
process(\Zend\Config\Config $config) : \Zend\Config\Config
Parameters
Exceptions
Returns
Process a single value
processValue(mixed $value) : mixed
Parameters
$value
mixed
Returns
mixed
Remove an item from the queue
remove(mixed $datum) : bool
Inherited
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.
inherited_from |
\Zend\Stdlib\PriorityQueue::remove() |
Parameters
$datum
mixed
Returns
bool
False if the item was not found, true otherwise.
Serialize the data structure
serialize() : string
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::serialize() |
Returns
string
Specify the internal queue class
setInternalQueueClass(string $class) : \Zend\Stdlib\PriorityQueue
Inherited
Please see getIterator() for details on the necessity of an
internal queue class. The class provided should extend SplPriorityQueue.
inherited_from |
\Zend\Stdlib\PriorityQueue::setInternalQueueClass() |
Parameters
$class
string
Returns
Serialize to an array
toArray(int $flag) : array
Inherited
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.
inherited_from |
\Zend\Stdlib\PriorityQueue::toArray() |
Parameters
$flag
int
Returns
array
Peek at the top node in the queue, based on priority.
top() : mixed
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::top() |
Returns
mixed
Unserialize a string into a PriorityQueue object
unserialize(string $data) : void
Inherited
Serialization format is compatible with Zend\Stdlib\SplPriorityQueue
inherited_from |
\Zend\Stdlib\PriorityQueue::unserialize() |
Parameters
$data
string
Get the inner priority queue instance
getQueue() : \Zend\Stdlib\SplPriorityQueue
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::getQueue() |
Exceptions
Returns
Properties
Actual items aggregated in the priority queue.
$items : array
Inherited
Each item is an array
with keys "data" and "priority".
inherited_from |
\Zend\Stdlib\PriorityQueue::$$items |
Inner queue class to use for iteration
$queueClass : string
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::$$queueClass |
Constants
EXTR_BOTH
EXTR_BOTH
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::EXTR_BOTH |
EXTR_DATA
EXTR_DATA
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::EXTR_DATA |
EXTR_PRIORITY
EXTR_PRIORITY
Inherited
inherited_from |
\Zend\Stdlib\PriorityQueue::EXTR_PRIORITY |