Documentation

AbstractLazyCollection
in package
implements Collection

AbstractYes

Lazy collection that is backed by a concrete collection

Tags
psalm-template

TKey of array-key

psalm-template

T

template-implements

Collection<TKey,T>

Table of Contents

Interfaces

Collection
The missing (SPL) Collection/Array/OrderedMap interface.

Properties

$collection  : Collection<string|int, mixed>|null
The backed collection to use
$initialized  : bool

Methods

add()  : true
Adds an element at the end of the collection.
clear()  : void
Clears the collection, removing all elements.
contains()  : mixed
{@inheritDoc}
containsKey()  : mixed
{@inheritDoc}
count()  : int
{@inheritDoc}
current()  : mixed
{@inheritDoc}
exists()  : mixed
{@inheritDoc}
filter()  : Collection<string|int, mixed>
Returns all the elements of this collection that satisfy the predicate p.
first()  : mixed
{@inheritDoc}
forAll()  : mixed
{@inheritDoc}
get()  : mixed
{@inheritDoc}
getIterator()  : Traversable<int|string, mixed>
{@inheritDoc}
getKeys()  : mixed
{@inheritDoc}
getValues()  : mixed
{@inheritDoc}
indexOf()  : mixed
{@inheritDoc}
isEmpty()  : mixed
{@inheritDoc}
isInitialized()  : bool
Is the lazy collection already initialized?
key()  : mixed
{@inheritDoc}
last()  : mixed
{@inheritDoc}
map()  : mixed
{@inheritDoc}
next()  : mixed
{@inheritDoc}
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
partition()  : array<string|int, Collection<string|int, mixed>>
Partitions this collection in two collections according to a predicate.
remove()  : mixed
Removes the element at the specified index from the collection.
removeElement()  : bool
Removes the specified element from the collection, if it is found.
set()  : void
Sets an element in the collection at the specified key/index.
slice()  : mixed
{@inheritDoc}
toArray()  : mixed
{@inheritDoc}
doInitialize()  : void
Do the initialization logic
initialize()  : void
Initialize the collection

Properties

Methods

add()

Adds an element at the end of the collection.

public add(mixed $element) : true
Parameters
$element : mixed

The element to add.

Return values
true

Always TRUE.

contains()

{@inheritDoc}

public contains(mixed $element) : mixed
Parameters
$element : mixed
Tags
template

TMaybeContained

filter()

Returns all the elements of this collection that satisfy the predicate p.

public filter(Closure $p) : Collection<string|int, mixed>
Parameters
$p : Closure

The predicate used for filtering.

Return values
Collection<string|int, mixed>

A collection with the results of the filter operation.

getIterator()

{@inheritDoc}

public getIterator() : Traversable<int|string, mixed>
Tags
psalm-return

Traversable<TKey,T>

Return values
Traversable<int|string, mixed>

indexOf()

{@inheritDoc}

public indexOf(mixed $element) : mixed
Parameters
$element : mixed
Tags
template

TMaybeContained

isInitialized()

Is the lazy collection already initialized?

public isInitialized() : bool
Tags
psalm-assert-if-true

Collection<TKey,T> $this->collection

Return values
bool

offsetExists()

public offsetExists(TKey $offset) : bool
Parameters
$offset : TKey
Return values
bool

offsetSet()

public offsetSet(TKey|null $offset, T $value) : void
Parameters
$offset : TKey|null
$value : T

partition()

Partitions this collection in two collections according to a predicate.

public partition(Closure $p) : array<string|int, Collection<string|int, mixed>>
Parameters
$p : Closure

The predicate on which to partition.

Return values
array<string|int, Collection<string|int, mixed>>

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.

remove()

Removes the element at the specified index from the collection.

public remove(mixed $key) : mixed
Parameters
$key : mixed

The key/index of the element to remove.

Return values
mixed

The removed element or NULL, if the collection did not contain the element.

removeElement()

Removes the specified element from the collection, if it is found.

public removeElement(mixed $element) : bool
Parameters
$element : mixed

The element to remove.

Return values
bool

TRUE if this collection contained the specified element, FALSE otherwise.

set()

Sets an element in the collection at the specified key/index.

public set(mixed $key, mixed $value) : void
Parameters
$key : mixed

The key/index of the element to set.

$value : mixed

The element to set.

slice()

{@inheritDoc}

public slice(mixed $offset[, mixed $length = null ]) : mixed
Parameters
$offset : mixed
$length : mixed = null

initialize()

Initialize the collection

protected initialize() : void
Tags
psalm-assert

Collection<TKey,T> $this->collection


        
On this page

Search results