FileAccess Orion

FilterIterator extends FastPriorityQueue
in package

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

Allows removal

Table of Contents

EXTR_BOTH  = \SplPriorityQueue::EXTR_BOTH
EXTR_DATA  = \SplPriorityQueue::EXTR_DATA
EXTR_PRIORITY  = \SplPriorityQueue::EXTR_PRIORITY
$count  : int
Total number of elements in the queue
$extractFlag  : int
$index  : int
Index of the current element in the queue
$maxPriority  : int|null
Max priority
$priorities  : array<string|int, mixed>
Array of priorities
$subIndex  : int
Sub index of the current element in the same priority level
$subPriorities  : array<string|int, mixed>
Array of priorities used for the iteration
$values  : array<string|int, mixed>
Elements of the queue, divided by priorities
contains()  : bool
Does the queue contain a given value?
count()  : int
Get the total number of elements in the queue
current()  : mixed
Get the current element in the queue
extract()  : mixed
Extract an element in the queue according to the priority and the order of insertion
hasPriority()  : bool
Does the queue have an item with the given priority?
insert()  : void
Insert a value into the queue.
isEmpty()  : bool
Check if the queue is empty
key()  : int
Get the index of the current element in the queue
next()  : mixed
Iterate the next filter in the chain
remove()  : bool
Remove a value from the queue
rewind()  : mixed
Rewind the current iterator
serialize()  : string
Serialize
setExtractFlags()  : mixed
Set the extract flag
toArray()  : array<string|int, mixed>
Serialize to an array
unserialize()  : void
Deserialize
valid()  : bool
Check if the current iterator is valid
nextAndRemove()  : mixed
Set the iterator pointer to the next element in the queue removing the previous element

Constants

Properties

$priorities

Array of priorities

protected array<string|int, mixed> $priorities = []

$subIndex

Sub index of the current element in the same priority level

protected int $subIndex = 0

$subPriorities

Array of priorities used for the iteration

protected array<string|int, mixed> $subPriorities = []

$values

Elements of the queue, divided by priorities

protected array<string|int, mixed> $values = []

Methods

contains()

Does the queue contain a given value?

public contains(mixed $datum) : bool
Parameters
$datum : mixed
Return values
bool

count()

Get the total number of elements in the queue

public count() : int
Return values
int

current()

Get the current element in the queue

public current() : mixed
Return values
mixed

extract()

Extract an element in the queue according to the priority and the order of insertion

public extract() : mixed
Return values
mixed

hasPriority()

Does the queue have an item with the given priority?

public hasPriority(int $priority) : bool
Parameters
$priority : int
Return values
bool

insert()

Insert a value into the queue.

public insert(callable $value, mixed $priority) : void

Requires a callable.

Parameters
$value : callable
$priority : mixed
Tags
throws
InvalidArgumentException

for non-callable $value.

Return values
void

isEmpty()

Check if the queue is empty

public isEmpty() : bool
Return values
bool

key()

Get the index of the current element in the queue

public key() : int
Return values
int

next()

Iterate the next filter in the chain

public next([mixed $context = null ][, array<string|int, mixed> $params = [] ][, FilterIterator $chain = null ]) : mixed

Iterates and calls the next filter in the chain.

Parameters
$context : mixed = null
$params : array<string|int, mixed> = []
$chain : FilterIterator = null
Return values
mixed

remove()

Remove a value from the queue

public remove(mixed $datum) : bool

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
Return values
bool

rewind()

Rewind the current iterator

public rewind() : mixed
Return values
mixed

setExtractFlags()

Set the extract flag

public setExtractFlags(int $flag) : mixed
Parameters
$flag : int
Return values
mixed

toArray()

Serialize to an array

public toArray() : array<string|int, mixed>

Array will be priority => data pairs

Return values
array<string|int, mixed>

unserialize()

Deserialize

public unserialize(string $data) : void
Parameters
$data : string
Return values
void

valid()

Check if the current iterator is valid

public valid() : bool
Return values
bool

nextAndRemove()

Set the iterator pointer to the next element in the queue removing the previous element

protected nextAndRemove() : mixed
Return values
mixed

Search results