Copied!

ArrayMap

ArrayMap.php : 20
Implements MapInterface

Properties

protected $items

AbstractInMemoryCollection.php : 24
protected array<string|int, mixed> $items

Methods

public__construct()

AbstractInMemoryCollection.php : 29
public __construct([array<string|int, mixed> $items = [] ])

Parameters

Name Type Default value Description
$items array<string|int, mixed> [] -

publiccount()

AbstractInMemoryCollection.php : 49
public count() : int

Return values

int

publicexists()

AbstractInMemoryCollection.php : 81

Tests the existence of an element that satisfies the given predicate.

public exists(Closure $predicate) : bool

Parameters

Name Type Default value Description
$predicate Closure - -

Return values

bool

publicfilter()

AbstractInMemoryCollection.php : 57

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

public filter(Closure $predicate) : self

Parameters

Name Type Default value Description
$predicate Closure - -

Return values

self

publicforAll()

AbstractInMemoryCollection.php : 70

Tests whether the given predicate holds for all elements of this collection.

public forAll(Closure $predicate) : bool

Parameters

Name Type Default value Description
$predicate Closure - -

Return values

bool

publicget()

ArrayMap.php : 22

Returns value associated with given key.

public get(mixed $key) : TValue

Parameters

Name Type Default value Description
$key mixed - -

Return values

TValue

publicgetIterator()

AbstractInMemoryCollection.php : 44
public getIterator() : Iterator

Return values

Iterator

publichas()

ArrayMap.php : 31

Returns true if the given key is defined within the map.

public has(mixed $key) : bool

Parameters

Name Type Default value Description
$key mixed - -

Return values

bool

publicisEmpty()

AbstractInMemoryCollection.php : 34
public isEmpty() : bool

Return values

bool

publicmap()

AbstractInMemoryCollection.php : 65

Applies the given function to each element in the collection and returns a new collection with the elements returned by the function.

public map(Closure $function) : self

Parameters

Name Type Default value Description
$function Closure - -

Return values

self

publictoArray()

AbstractInMemoryCollection.php : 39
public toArray() : array<string|int, TValue>

Return values

array<string|int, TValue>

protectedcreateFrom()

ArrayMap.php : 41
protected createFrom(array<string|int, mixed> $items) : self

Parameters

Name Type Default value Description
$items array<string|int, mixed> - -

Return values

self