A type-sensitive, taversable queue (FIFO).
+
+
+
+
+
+ __construct()
+
+
+
+
+
+ Create a type-sensitive, traversable queue of items.
+
+
+ public
+ __construct([array<string|int, string> $allowedTypes = [] ]) : void
+
+
+
+
+ Parameters
+
+ -
+ $allowedTypes
+ : array<string|int, string>
+ = []
+ -
+
Allowed data types of items (optional)
+If empty, all types are allowed.
+Possible values are:
+
+- "array"
+- "bool"
+- "callable"
+- "countable"
+- "float" or "double"
+- "int" or "integer" or "long"
+- "iterable"
+- "null"
+- "numeric"
+- "object" or FQCN
+- "resource"
+- "scalar"
+- "string"
+
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if any value of $allowedTypes
is not a string
+
+
+
+
+
+
+
+
+
+ __get()
+
+
+
+
+
+ Read data from an inaccessible property.
+
+
+ public
+ __get(string $property) : mixed
+
+
+
+
+ Parameters
+
+ -
+ $property
+ : string
+
+ -
+
The class property to get
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if the property or getter method do not exist
+
+
+
+
+
+
+ Return values
+ mixed
+ —
+ The class property's current value
+
+
+
+
+
+
+
+ __isset()
+
+
+
+
+
+ Check if an inaccessible property is set and not empty.
+
+
+ public
+ __isset(string $property) : bool
+
+
+
+
+ Parameters
+
+ -
+ $property
+ : string
+
+ -
+
The class property to check
+
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+ Whether the class property is set and not empty
+
+
+
+
+
+
+
+ add()
+
+
+
+
+
+ Add/insert a new item at the specified offset.
+
+
+ public
+ add(int $offset, AllowedType $value) : void
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int
+
+ -
+
The offset where the new item is to be inserted
+
+
+
+ -
+ $value
+ : AllowedType
+
+ -
+
The new item for the offset
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if $value
is not of allowed type
+
+
+
+ -
+ throws
+
+ -
+ OutOfRangeException
+
+
when $offset
is out of bounds
+
+
+
+
+
+
+
+
+
+ append()
+
+
+
+
+
+ Append items at the end of the list.
+
+
+ public
+ append(AllowedType ...$values) : void
+
+
+
+ Parameters
+
+ -
+ $values
+ : AllowedType
+
+ -
+
One or more items to append
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if any $values
is not of allowed type
+
+
+
+
+
+
+
+
+
+ bottom()
+
+
+
+
+
+ Peek at the item at the beginning of the list.
+
+
+ public
+ bottom() : AllowedType
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ RuntimeException
+
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+ The first item of the list
+
+
+
+
+
+
+
+ clear()
+
+
+
+
+
+ Clear the list of any items.
+
+
+ public
+ clear() : void
+
+
+
+
+
+
+
+
+
+
+ count()
+
+
+
+
+
+ Get the number of items on the list.
+
+
+ public
+ count() : int
+
+
+
+
+
+
+
+ Return values
+ int
+ —
+ The number of items on the list
+
+
+
+
+
+
+
+ current()
+
+
+
+
+
+ Get the current list item.
+
+
+ public
+ current() : AllowedType
+
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+
+
+
+
+
+
+
+ dequeue()
+
+
+
+
+
+ Dequeue an item from the queue.
+
+
+ public
+ dequeue() : AllowedType
+
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+
+
+
+
+
+
+
+ enqueue()
+
+
+
+
+
+ Add an item to the queue.
+
+
+ public
+ enqueue(AllowedType $value) : void
+
+
+
+ Parameters
+
+ -
+ $value
+ : AllowedType
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if $value
is not of allowed type
+
+
+
+
+
+
+
+
+
+ get()
+
+
+
+
+
+ Get the item at the specified index.
+
+
+ public
+ get(int $offset) : AllowedType
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ OutOfRangeException
+
+
when $offset
is out of bounds
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+
+
+
+
+
+
+
+ getAllowedTypes()
+
+
+
+
+
+ Get allowed data types for list items.
+
+
+ public
+ getAllowedTypes() : array<string|int, string>
+
+
+
+
+
+
+
+ Return values
+ array<string|int, string>
+ —
+ The list of allowed data types
+
+
+
+
+
+
+
+ getIteratorMode()
+
+
+
+
+
+ Get the mode of iteration.
+
+
+ public
+ getIteratorMode() : int
+
+
+
+
+
+
+
+ Return values
+ int
+ —
+ The set of flags and modes of iteration
+
+
+
+
+
+
+
+ isAllowedType()
+
+
+
+
+
+ Check if the item's data type is allowed on the list.
+
+
+ public
+ isAllowedType(AllowedType $value) : bool
+
+
+
+ Parameters
+
+ -
+ $value
+ : AllowedType
+
+ -
+
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+ Whether the item's data type is allowed
+
+
+
+
+
+
+
+ isEmpty()
+
+
+
+
+
+ Check if list is empty.
+
+
+ public
+ isEmpty() : bool
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+ Whether the list contains no items
+
+
+
+
+
+
+
+ isList()
+
+
+
+
+
+ Check if this can be considered a list.
+
+
+ public
+ isList() : true
+
+
+
+
+
+
+
+ Return values
+ true
+ —
+ Always TRUE (this exists only for compatibility reasons)
+
+
+
+
+
+
+
+ key()
+
+
+
+
+
+ Get the current list index.
+
+
+ public
+ key() : int
+
+
+
+
+
+
+
+ Return values
+ int
+ —
+
+
+
+
+
+
+
+ next()
+
+
+
+
+
+ Move the cursor to the next list index.
+
+
+ public
+ next() : void
+
+
+
+
+
+
+
+
+
+
+ offsetExists()
+
+
+
+
+
+ Check if the specified index exists and is not empty.
+
+
+ public
+ offsetExists(int $offset) : bool
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int
+
+ -
+
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+ Whether the index exists and is not empty
+
+
+
+
+
+
+
+ offsetGet()
+
+
+
+
+
+ Get the item from the specified index.
+
+
+ public
+ offsetGet(int $offset) : AllowedType
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ OutOfRangeException
+
+
when $offset
is out of bounds
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+
+
+
+
+
+
+
+ offsetSet()
+
+
+
+
+
+ Set the item at the specified offset.
+
+
+ public
+ offsetSet(int|null $offset, AllowedType $value) : void
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int|null
+
+ -
+
The offset being set or NULL to append
+
+
+
+ -
+ $value
+ : AllowedType
+
+ -
+
The new item for the offset
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if $value
is not of allowed type
+
+
+
+ -
+ throws
+
+ -
+ OutOfRangeException
+
+
when $offset
is out of bounds
+
+
+
+
+
+
+
+
+
+ offsetUnset()
+
+
+
+
+
+ Unset the item at the specified index.
+
+
+ public
+ offsetUnset(int $offset) : void
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ OutOfRangeException
+
+
when $offset
is out of bounds
+
+
+
+
+
+
+
+
+
+ pop()
+
+
+
+
+
+ Pops an item from the end of the list.
+
+
+ public
+ pop() : AllowedType
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ RuntimeException
+
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+ The item from the end of the list
+
+
+
+
+
+
+
+ prepend()
+
+
+
+
+
+ Prepend items at the start of the list.
+
+
+ public
+ prepend(AllowedType ...$values) : void
+
+
+
+ Parameters
+
+ -
+ $values
+ : AllowedType
+
+ -
+
One or more items to prepend
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if $value
is not of allowed type
+
+
+
+
+
+
+
+
+
+ prev()
+
+
+
+
+
+ Move the cursor to the previous list index.
+
+
+ public
+ prev() : void
+
+
+
+
+
+
+
+
+
+
+ push()
+
+
+
+
+
+ Push an item at the end of the list.
+
+
+ public
+ push(AllowedType $value) : void
+
+
+
+ Parameters
+
+ -
+ $value
+ : AllowedType
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if $value
is not of allowed type
+
+
+
+
+
+
+
+
+
+ remove()
+
+
+
+
+
+ Remove an item from the list.
+
+
+ public
+ remove(int $offset) : void
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ OutOfRangeException
+
+
when $offset
is out of bounds
+
+
+
+
+
+
+
+
+
+ rewind()
+
+
+
+
+
+ Rewind the iterator's cursor.
+
+
+ public
+ rewind() : void
+
+
+
+
+
+
+
+
+
+
+ set()
+
+
+
+
+
+ Set an item at the specified index.
+
+
+ public
+ set(int $offset, AllowedType $value) : void
+
+
+
+ Parameters
+
+ -
+ $offset
+ : int
+
+ -
+
+
+
+ -
+ $value
+ : AllowedType
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if $value
is not of allowed type
+
+
+
+
+
+
+
+
+
+ setIteratorMode()
+
+
+
+
+
+ Set the mode of iteration.
+
+
+ public
+ final setIteratorMode(int $mode) : int
+
+
+
+ Parameters
+
+ -
+ $mode
+ : int
+
+ -
+
The new iterator mode (0 or 1)
+There are two orthogonal sets of modes that can be set.
+The direction of iteration (fixed for StrictQueue):
+
+- StrictQueue::IT_MODE_FIFO (queue style)
+
+The behavior of the iterator (either one or the other):
+
+- StrictQueue::IT_MODE_DELETE (delete items)
+- StrictQueue::IT_MODE_KEEP (keep items)
+
+The default mode is: IT_MODE_FIFO | IT_MODE_KEEP
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ RangeException
+
+
if an invalid $mode
is given
+
+
+
+ -
+ throws
+
+ -
+ RuntimeException
+
+
if trying to change iterator direction
+
+
+
+
+
+
+ Return values
+ int
+ —
+ The set of flags and modes of iteration
+
+
+
+
+
+
+
+ shift()
+
+
+
+
+
+ Shift an item from the beginning of the list.
+
+
+ public
+ shift() : AllowedType
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ RuntimeException
+
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+ The first item of the list
+
+
+
+
+
+
+
+ toArray()
+
+
+
+
+
+ Return array representation of list.
+
+
+ public
+ toArray() : array<string|int, AllowedType>
+
+
+
+
+
+
+
+ Return values
+ array<string|int, AllowedType>
+ —
+
+
+
+
+
+
+
+ top()
+
+
+
+
+
+ Peek at the item at the end of the list.
+
+
+ public
+ top() : AllowedType
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ RuntimeException
+
+
+
+
+
+
+
+ Return values
+ AllowedType
+ —
+ The last item of the list
+
+
+
+
+
+
+
+ toStrictCollection()
+
+
+
+
+
+ Turn list into a type-sensitive collection.
+
+
+ public
+ toStrictCollection() : StrictCollection<string|int, AllowedType>
+
+
+
+
+
+
+
+ Return values
+ StrictCollection<string|int, AllowedType>
+ —
+ A type-sensitive collection of the list's items
+
+
+
+
+
+
+
+ unshift()
+
+
+
+
+
+ Prepend the list with an item.
+
+
+ public
+ unshift(AllowedType $value) : void
+
+
+
+ Parameters
+
+ -
+ $value
+ : AllowedType
+
+ -
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if $value
is not of allowed type
+
+
+
+
+
+
+
+
+
+ valid()
+
+
+
+
+
+ Check if current cursor position is valid.
+
+
+ public
+ valid() : bool
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+ Whether the current cursor position is valid
+
+
+
+
+
+
+
+ setAllowedTypes()
+
+
+
+
+
+ Set allowed data types of list items.
+
+
+ protected
+ setAllowedTypes([array<string|int, string> $allowedTypes = [] ]) : void
+
+
+
+
+ Parameters
+
+ -
+ $allowedTypes
+ : array<string|int, string>
+ = []
+ -
+
Allowed data types of items
+
+
+
+
+
+
+
+
+ -
+ throws
+
+ -
+ InvalidArgumentException
+
+
if any value of $allowedTypes
is not a string
+
+
+
+
+
+
+
+
+
+