HashMap
class HashMap extends BaseMap
An associative array allowing the use of chained
This class can be used as a service container, an application context, to store configuration.
Traits
Constants
| CB_ZERO_ARG |
|
Methods
No description
Gets a copy of the internal map.
Determines if at least an element of the collection satisfies a condition.
Determines if all elements of the collection satisfies a condition.
Converts deeply an element to a map.
Determine if a collection is empty.
Get the value at the specified key.
Get the value at the specified key.
This method returns the instance itself, so you can use it in fluent pattern.
Determine if the specified key exists.
Determine if the specified value exists.
No description
No description
No description
No description
No description
Details
at line 118
int
count()
No description
at line 170
array
toArray()
Gets a copy of the internal map.
Scalar values (int, strings) are cloned. Objects are references to a specific objet, not a clone.
in
WithCollection at line 15
mixed
first()
No description
in
WithCollection at line 23
mixed
firstOr(mixed $default)
No description
in
WithCollection at line 45
bool
any(callable $callable)
Determines if at least an element of the collection satisfies a condition.
The execution of callbacks stop after a callable returned true.
in
WithCollection at line 78
bool
all(callable $callable)
Determines if all elements of the collection satisfies a condition.
The execution of callbacks stop after a callable returned false.
at line 65
static BaseCollection
from(iterable|object|null $from)
Converts deeply an element to a map.
If $from is an object or iterable, each element will be:
- converted to an array (deep array) if iterable or object
- kept as is if it's a scalar
at line 122
bool
isEmpty()
Determine if a collection is empty.
at line 78
mixed
get(mixed $key)
Get the value at the specified key.
at line 86
mixed
getOr(mixed $key, mixed $defaultValue)
Get the value at the specified key.
at line 90
BaseMap
set(mixed $key, mixed $value)
Set the specified value at the specified key.
This method returns the instance itself, so you can use it in fluent pattern.
at line 100
BaseMap
unset(mixed $key)
This method returns the instance itself, so you can use it in fluent pattern.
at line 106
bool
has(mixed $key)
Determine if the specified key exists.
at line 110
bool
contains(mixed $value)
Determine if the specified value exists.
in
BaseMap at line 90
bool
offsetExists(mixed $offset)
No description
in
BaseMap at line 100
mixed
offsetGet(mixed $offset)
No description
in
BaseMap at line 112
void
offsetSet(mixed $offset, mixed $value)
Assign a value to the specified offset
in
BaseMap at line 121
void
offsetUnset(mixed $offset)
No description
at line 31
__construct(iterable $iterable = [])
No description
at line 126
HashMap
clear()
No description
at line 139
HashMap
merge(iterable $iterable)
Merge the specified map with the current map.
If a key already exists, the value already set is kept.
at line 154
HashMap
update(iterable $iterable)
Merge the specified map with the current bag.
If a key already exists, the value is updated with the new one.
at line 178
HashMap
map(callable $callable)
No description
at line 182
HashMap
filter(callable $callable)
No description
at line 194
HashMap
mapKeys(callable $callable)
No description
at line 203
HashMap
mapValuesAndKeys(callable $callable)
No description
at line 219
HashMap
flatMap(callable $callable)
No description
at line 235
Vector
mapToVector(callable $callable)
No description
at line 250
HashMap
filterKeys(callable $callable)
No description
at line 260
Traversable
getIterator()
No description