Collection implements Item, ItemCollection, IteratorAggregate, Countable
AbstractYes
Tags
Table of Contents
Interfaces
- Item
- ItemCollection
- IteratorAggregate
- Countable
Methods
- __construct() : mixed
- add() : static
- count() : int
- emptyList() : static
- filter() : static
- findByRule() : T|null
- fromArray() : static
- getFirst() : T
- getIterator() : ArrayIterator
- isEmpty() : bool
- sortByRule() : static
- toArray() : array<string|int, T>
Methods
__construct()
public
final __construct(T ...$items) : mixed
Parameters
- $items : T
add()
public
final add(T $item) : static
Parameters
- $item : T
Return values
staticcount()
public
final count() : int
Return values
intemptyList()
public
static emptyList() : static
Return values
staticfilter()
public
filter(callable $condition) : static
Parameters
- $condition : callable
Return values
staticfindByRule()
public
final findByRule(callable(T): bool $rule) : T|null
Parameters
- $rule : callable(T): bool
Return values
T|nullfromArray()
public
final static fromArray(array<string|int, T> $items) : static
Parameters
- $items : array<string|int, T>
Return values
staticgetFirst()
public
final getFirst() : T
Return values
T —$item
getIterator()
public
final getIterator() : ArrayIterator
Return values
ArrayIteratorisEmpty()
public
final isEmpty() : bool
Return values
boolsortByRule()
public
sortByRule(callable(T, T): bool $rule) : static
Parameters
- $rule : callable(T, T): bool
Return values
statictoArray()
public
final toArray() : array<string|int, T>