class SplQueue extends SplDoublyLinkedList (View source)

Constants

IT_MODE_LIFO

IT_MODE_FIFO

IT_MODE_DELETE

IT_MODE_KEEP

Methods

void
add(mixed $index, TValue $value)

Add/insert a new value at the specified index

TValue
pop()

Pops a node from the end of the doubly linked list

TValue
shift()

Shifts a node from the beginning of the doubly linked list

void
push(TValue $value)

Pushes an element at the end of the doubly linked list

void
unshift(TValue $value)

Prepends the doubly linked list with an element

TValue
top()

Peeks at the node from the end of the doubly linked list

TValue
bottom()

Peeks at the node from the beginning of the doubly linked list

int<0, max>
count()

Counts the number of elements in the doubly linked list.

bool
isEmpty()

Checks whether the doubly linked list is empty.

int
setIteratorMode(int $mode)

Sets the mode of iteration

int
getIteratorMode()

Returns the mode of iteration

bool
offsetExists(mixed $index)

Returns whether the requested $index exists

TValue
offsetGet(mixed $index)

Returns the value at the specified $index

void
offsetSet(mixed $index, TValue $value)

Sets the value at the specified $index to $newval

void
offsetUnset(mixed $index)

Unsets the value at the specified $index

void
rewind()

Rewind iterator back to the start

TValue
current()

Return current array entry

TKey|null
key()

Return current node index

void
next()

Move to next entry

void
prev()

Move to previous entry

bool
valid()

Check whether the doubly linked list contains more nodes

void
unserialize(string $data)

Unserializes the storage

string|null
serialize()

Serializes the storage

array
__debugInfo()

No description

array
__serialize()

No description

__unserialize(array $data)

No description

void
enqueue(TValue $value)

Adds an element to the queue.

TValue
dequeue()

Dequeues a node from the queue

Details

void add(mixed $index, TValue $value)

Since: 5.5

Add/insert a new value at the specified index

Parameters

mixed $index

The index where the new value is to be inserted.

TValue $value

The new value for the index.

Return Value

void

TValue pop()

Pops a node from the end of the doubly linked list

Return Value

TValue

The value of the popped node.

TValue shift()

Shifts a node from the beginning of the doubly linked list

Return Value

TValue

The value of the shifted node.

void push(TValue $value)

Pushes an element at the end of the doubly linked list

Parameters

TValue $value

The value to push.

Return Value

void

void unshift(TValue $value)

Prepends the doubly linked list with an element

Parameters

TValue $value

The value to unshift.

Return Value

void

TValue top()

Peeks at the node from the end of the doubly linked list

Return Value

TValue

The value of the last node.

TValue bottom()

Peeks at the node from the beginning of the doubly linked list

Return Value

TValue

The value of the first node.

int<0, max> count()

Counts the number of elements in the doubly linked list.

Return Value

int<0, max>

The custom count as an integer.

The return value is cast to an integer.

bool isEmpty()

Checks whether the doubly linked list is empty.

Return Value

bool

whether the doubly linked list is empty.

int setIteratorMode(int $mode)

Sets the mode of iteration

Parameters

int $mode

There are two orthogonal sets of modes that can be set:

The direction of the iteration (either one or the other): SplDoublyLinkedList::IT_MODE_LIFO (Stack style)

Return Value

int

int getIteratorMode()

Returns the mode of iteration

Return Value

int

the different modes and flags that affect the iteration.

bool offsetExists(mixed $index)

Returns whether the requested $index exists

Parameters

mixed $index

The index being checked.

Return Value

bool

true on success or false on failure.

The return value will be casted to boolean if non-boolean was returned.

TValue offsetGet(mixed $index)

Returns the value at the specified $index

Parameters

mixed $index

The index with the value.

Return Value

TValue

Can return all value types.

void offsetSet(mixed $index, TValue $value)

Sets the value at the specified $index to $newval

Parameters

mixed $index

The index being set.

TValue $value

The value to set.

Return Value

void

void offsetUnset(mixed $index)

Unsets the value at the specified $index

Parameters

mixed $index

The index being unset.

Return Value

void

void rewind()

Rewind iterator back to the start

Return Value

void

Any returned value is ignored.

TValue current()

Return current array entry

Return Value

TValue

Can return any type.

TKey|null key()

Return current node index

Return Value

TKey|null

TKey on success, or null on failure.

void next()

Move to next entry

Return Value

void

Any returned value is ignored.

void prev()

Move to previous entry

Return Value

void

bool valid()

Check whether the doubly linked list contains more nodes

Return Value

bool

The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.

void unserialize(string $data)

Since: 5.4

Unserializes the storage

Parameters

string $data

The string representation of the object.

Return Value

void

string|null serialize()

Since: 5.4

Serializes the storage

Return Value

string|null

The string representation of the object or null

array __debugInfo()

Since: 7.4

No description

Return Value

array

array __serialize()

Since: 7.4

No description

Return Value

array

__unserialize(array $data)

Since: 7.4

No description

Parameters

array $data

void enqueue(TValue $value)

Adds an element to the queue.

Parameters

TValue $value

The value to enqueue.

Return Value

void

TValue dequeue()

Dequeues a node from the queue

Return Value

TValue

The value of the dequeued node.