| Methods |
public
|
__construct(array<TKey, T> $elements = [])
Initializes a new ArrayCollection.
Initializes a new ArrayCollection.
|
#
|
public
|
toArray()
{@inheritDoc}
|
#
|
public
|
first()
{@inheritDoc}
|
#
|
protected
|
createFrom<K is array-key, V>(array<K, V> $elements): static
Creates a new instance from the specified elements.
Creates a new instance from the specified elements.
This method is provided for derived classes to specify how a new
instance should be created when constructor semantics have changed.
|
#
|
public
|
last()
{@inheritDoc}
|
#
|
public
|
key()
{@inheritDoc}
|
#
|
public
|
next()
{@inheritDoc}
|
#
|
public
|
current()
{@inheritDoc}
|
#
|
public
|
remove(string|int $key)
{@inheritDoc}
Returns
The removed element or NULL, if the collection did not contain the element.
Implements
|
#
|
public
|
removeElement(mixed $element)
{@inheritDoc}
Returns
TRUE if this collection contained the specified element, FALSE otherwise.
Implements
|
#
|
public
|
offsetExists(TKey $offset): bool
Required by interface ArrayAccess.
Required by interface ArrayAccess.
Implements
|
#
|
public
|
offsetGet(TKey $offset): T|null
Required by interface ArrayAccess.
Required by interface ArrayAccess.
Implements
|
#
|
public
|
offsetSet(TKey|null $offset, T $value): void
Required by interface ArrayAccess.
Required by interface ArrayAccess.
Implements
|
#
|
public
|
offsetUnset(TKey $offset): void
Required by interface ArrayAccess.
Required by interface ArrayAccess.
Implements
|
#
|
public
|
containsKey(string|int $key)
{@inheritDoc}
Returns
TRUE if the collection contains an element with the specified key/index,
FALSE otherwise.
Implements
|
#
|
public
|
contains(mixed $element)
{@inheritDoc}
Returns
TRUE if the collection contains the element, FALSE otherwise.
Implements
|
#
|
public
|
exists(Closure $p)
{@inheritDoc}
Returns
TRUE if the predicate is TRUE for at least one element, FALSE otherwise.
Implements
|
#
|
public
|
indexOf<TMaybeContained>(TMaybeContained $element): int|string|false
{@inheritDoc}
Returns
The key/index of the element or FALSE if the element was not found.
Implements
|
#
|
public
|
get(string|int $key)
{@inheritDoc}
|
#
|
public
|
getKeys()
{@inheritDoc}
Returns
The keys/indices of the collection, in the order of the corresponding
elements in the collection.
Implements
|
#
|
public
|
getValues()
{@inheritDoc}
Returns
The values of all elements in the collection, in the
order they appear in the collection.
Implements
|
#
|
public
|
count(): int<0, max>
{@inheritDoc}
|
#
|
public
|
set(string|int $key, mixed $value)
{@inheritDoc}
|
#
|
public
|
add(mixed $element)
{@inheritDoc}
Returns
we will require a native return type declaration in 3.0
Implements
|
#
|
public
|
isEmpty()
{@inheritDoc}
Returns
TRUE if the collection is empty, FALSE otherwise.
Implements
|
#
|
public
|
getIterator(): Traversable<int|string, mixed>
{@inheritDoc}
|
#
|
public
|
map<U>(Closure(T): U $func): static
{@inheritDoc}
|
#
|
public
|
reduce(Closure $func, $initial = null)
{@inheritDoc}
|
#
|
public
|
filter(Closure $p): static
{@inheritDoc}
Returns
A collection with the results of the filter operation.
Implements
|
#
|
public
|
findFirst(Closure $p)
{@inheritDoc}
Returns
The first element respecting the predicate,
null if no element respects the predicate.
Implements
|
#
|
public
|
forAll(Closure $p)
{@inheritDoc}
Returns
TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
Implements
|
#
|
public
|
partition(Closure $p)
{@inheritDoc}
Returns
An array with two elements. The first element contains the collection
of elements where the predicate returned TRUE, the second element
contains the collection of elements where the predicate returned FALSE.
Implements
|
#
|
public
|
__toString(): string
Returns a string representation of this object.
{@inheritDoc}
Returns a string representation of this object.
{@inheritDoc}
Implements
|
#
|
public
|
clear()
{@inheritDoc}
|
#
|
public
|
slice(int $offset, int|null $length = null)
{@inheritDoc}
Parameters
| $offset |
The offset to start from.
|
| $length |
The maximum number of elements to return, or null for no limit.
|
Implements
|
#
|
public
|
matching(Criteria $criteria)
Selects all elements from a selectable that match the expression and
returns a new collection containing these elements…
Selects all elements from a selectable that match the expression and
returns a new collection containing these elements and preserved keys.
Implements
|
#
|