Collection implements Arrayable, Iterator, Countable
FinalYes
Table of Contents
Interfaces
- Arrayable
- Iterator
- Countable
Methods
- __clone() : mixed
- add() : $this
- Add a new value to the collection.
- count() : int
- current() : Value|false
- filterByType() : self
- Returns **new** collection with values that belong to type with the provided $typeId.
- getAll() : array<string|int, Value>
- Get a flat array with all values contained in this collection
- getById() : Value|null
- has() : bool
- isEmpty() : bool
- isEqualTo() : bool
- key() : int|null
- next() : void
- remove() : self
- removeById() : self
- rewind() : void
- toArray() : array<string|int, mixed>
- valid() : bool
Methods
__clone()
public
__clone() : mixed
add()
Add a new value to the collection.
public
add(Value $value) : $this
If an equal value is already in this collection, duplicating value won't be added.
Parameters
- $value : Value
Return values
$thiscount()
public
count() : int
Return values
intcurrent()
public
current() : Value|false
Return values
Value|falsefilterByType()
Returns **new** collection with values that belong to type with the provided $typeId.
public
filterByType(string $typeId) : self
This collection is not mutated. References to values are not shared.
Parameters
- $typeId : string
Return values
selfgetAll()
Get a flat array with all values contained in this collection
public
getAll() : array<string|int, Value>
Return values
array<string|int, Value>getById()
public
getById(int $id) : Value|null
Parameters
- $id : int
Return values
Value|nullhas()
public
has(Value $value) : bool
Parameters
- $value : Value
Return values
boolisEmpty()
public
isEmpty() : bool
Return values
boolisEqualTo()
public
isEqualTo(self $anotherCollection) : bool
Parameters
- $anotherCollection : self
Return values
boolkey()
public
key() : int|null
Return values
int|nullnext()
public
next() : void
remove()
public
remove(Value $value) : self
Parameters
- $value : Value
Return values
selfremoveById()
public
removeById(int $id) : self
Parameters
- $id : int
Return values
selfrewind()
public
rewind() : void
toArray()
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>valid()
public
valid() : bool