Methods |
public
|
__construct($items = [])
|
#
|
public
static
|
empty()
|
#
|
public
|
copy()
|
#
|
public
|
has($key): bool
|
#
|
public
|
get($key)
|
#
|
public
|
forEach<T is TValue|TKey|array{TKey, TValue}>(
callable(T, T|null $next, T|null $prev): mixed $callback,
int $mode = CollectionInterface::CALLBACK_USE_VALUE,
)
|
#
|
public
|
find<T is TValue|TKey|array{TKey, TValue}>(
callable(T, T|null $next, T|null $prev): bool $callback,
int $mode = CollectionInterface::CALLBACK_USE_VALUE | CollectionInterface::FIND_VALUE,
)
|
#
|
public
|
hasValue($value, bool $strict = false): bool
|
#
|
public
|
keyOf($value, bool $strict = false)
|
#
|
public
|
firstOf($value)
|
#
|
public
|
all(): array
|
#
|
public
|
toArray(): array
|
#
|
public
|
jsonSerialize(): array<TKey, mixed>
|
#
|
public
|
toJson(int $flags = 0): string
|
#
|
public
|
first()
|
#
|
public
|
last()
|
#
|
public
|
nth(int $n)
|
#
|
public
|
getIterator(): Traversable<TKey, TValue>
|
#
|
public
|
offsetExists(TKey $offset): bool
|
#
|
public
|
offsetGet(TKey $offset): TValue
|
#
|
public
|
count(): int
|
#
|
protected
|
getItems(Arrayable<TKey, TValue>|iterable<TKey, TValue> $items): array<TKey, TValue>
|
#
|
protected
|
filterItems(array<TKey, TValue> $items): array<TKey, TValue>
Override to normalise items applied to the collection
Override to normalise items applied to the collection
|
#
|
protected
|
compareItems(TValue $a, TValue $b): int
Compare items using Comparable::compare() if implemented
Compare items using Comparable::compare() if implemented
|
#
|
protected
|
getCallbackValue(
int-mask-of<CollectionInterface::*> $mode,
TKey $key,
TValue|null $value,
): TValue|TKey|array{TKey, TValue}
|
#
|
protected
|
getReturnValue(
int-mask-of<CollectionInterface::*> $mode,
TKey $key,
TValue $value,
): ($mode is 8|9|10|11 ? TKey : TValue)
|
#
|