Queue
class Queue implements Collection, ArrayAccess (View source)
A Queue is a “first in, first out” or “FIFO” collection that only allows access to the value at the front of the queue and iterates in that order, destructively.
Uses a Ds\Vector internally.
Methods
Creates a new instance, using either a traversable object or an array for the initial values.
Ensures that enough memory is allocated for a required capacity. This removes the need to reallocate the internal as values are added.
Returns the current capacity.
Removes all values from the queue.
Count elements of an object
Returns a shallow copy of the collection.
No description
Returns whether the collection is empty.
Converts the collection to an array.
Specify data which should be serialized to JSON
Returns the value at the top of the queue, but does not remove it.
Removes and returns the value at the top of the queue.
Pushes values onto the queue.
No description
No description
No description
No description
Details
__construct(TValue> $values = [])
Creates a new instance, using either a traversable object or an array for the initial values.
allocate(int $capacity)
Ensures that enough memory is allocated for a required capacity. This removes the need to reallocate the internal as values are added.
int
capacity()
Returns the current capacity.
void
clear()
Removes all values from the queue.
int
count()
Count elements of an object
TValue>
copy()
Returns a shallow copy of the collection.
Traversable
getIterator()
No description
bool
isEmpty()
Returns whether the collection is empty.
array
toArray()
Converts the collection to an array.
Note: Casting to an array is not supported yet.
mixed
jsonSerialize()
Specify data which should be serialized to JSON
TValue
peek()
Returns the value at the top of the queue, but does not remove it.
TValue
pop()
Removes and returns the value at the top of the queue.
push(TValue ...$values)
Pushes values onto the queue.
bool
offsetExists(TKey $offset)
No description
mixed
offsetGet(TKey $offset)
No description
void
offsetSet(TKey $offset, TValue $value)
No description
void
offsetUnset(TKey $offset)
No description