Specialized priority queue implementation for use with an intercepting filter chain.

Allows removal

category Zend
package Zend_EventManager
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Stdlib_SplPriorityQueue

 Methods

Constructor

__construct() : void
Inherited

Creates a new, empty queue

Compare two priorities

compare(mixed $priority1, mixed $priority2) : integer
Inherited

Returns positive integer if $priority1 is greater than $priority2, 0 if equal, negative otherwise.

Unused internally, and only included in order to retain the same interface as PHP's SplPriorityQueue.

Parameters

$priority1

mixed

$priority2

mixed

Returns

integer

Does the queue contain a given value?

contains(mixed $datum) : boolean

Parameters

$datum

mixed

Returns

boolean

Countable: return number of items composed in the queue

count() : integer
Inherited

Returns

integer

Iterator: return current item

current() : mixed
Inherited

Returns

mixed

Extract a node from top of the heap and sift up

extract() : \mixed;
Inherited

Returns either the value, the priority, or both, depending on the extract flag.

Returns

\mixed;

Insert a value into the heap, at the specified priority

insert(mixed $value, mixed $priority) : void
Inherited

Parameters

$value

mixed

$priority

mixed

Is the queue currently empty?

isEmpty() : boolean
Inherited

Returns

boolean

Iterator: return current key

key() : mixed
Inherited

Returns

mixedUsually an int or string

Iterate the next filter in the chain

next(mixed $context = null, array $params = array(), \Zend_EventManager_Filter_FilterIterator $chain = null) : mixed

Iterates and calls the next filter in the chain.

Parameters

$context

mixed

$params

array

$chain

\Zend_EventManager_Filter_FilterIterator

Returns

mixed

Iterator: Move pointer forward

next() : void
Inherited

Recover from corrupted state and allow further actions on the queue

recoverFromCorruption() : void
Inherited

Unimplemented, and only included in order to retain the same interface as PHP's SplPriorityQueue.

Remove a value from the queue

remove(mixed $datum) : boolean

This is an expensive operation. It must first iterate through all values, and then re-populate itself. Use only if absolutely necessary.

Parameters

$datum

mixed

Returns

boolean

Iterator: Move pointer to first item

rewind() : void
Inherited

Serialize

serialize() : string
Inherited

Returns

string

Set the extract flags

setExtractFlags(integer $flags) : void
Inherited

Defines what is extracted by SplPriorityQueue::current(), SplPriorityQueue::top() and SplPriorityQueue::extract().

  • SplPriorityQueue::EXTR_DATA (0x00000001): Extract the data
  • SplPriorityQueue::EXTR_PRIORITY (0x00000002): Extract the priority
  • SplPriorityQueue::EXTR_BOTH (0x00000003): Extract an array containing both

The default mode is SplPriorityQueue::EXTR_DATA.

Parameters

$flags

integer

Serialize to an array

toArray() : array
Inherited

Array will be priority => data pairs

Returns

array

Return the value or priority (or both) of the top node, depending on the extract flag

top() : mixed
Inherited

Returns

mixed

Deserialize

unserialize(string $data) : void
Inherited

Parameters

$data

string

Iterator: is the current position valid for the queue

valid() : boolean
Inherited

Returns

boolean

Prepare the queue for iteration and/or extraction

prepareQueue() : void
Inherited

Sort the queue

sort() : void
Inherited

 Properties

 

Count of items in the queue

$count : integer

Default

0
 

Flag indicating what should be returned when iterating or extracting

$extractFlags : integer

Default

self::EXTR_DATA
 

$isPhp53

$isPhp53 : boolean

Default

 

$preparedQueue

$preparedQueue : boolean | array

Default

false
 

All items in the queue

$queue : array

Default

array()
 

Seed used to ensure queue order for items of the same priority

$serial : integer

Default

PHP_INT_MAX

 Constants

 

Extract an array of ('data' => $value, 'priority' => $priority)

EXTR_BOTH = 3 
 

Extract data only

EXTR_DATA = 1 
 

Extract priority only

EXTR_PRIORITY = 2