Map.php
\Ulrichsg\Collections\Map
Package: A simple key-value map. Its main advantage over plain arrays is that you never have to call isset() to avoid
warnings. Supports square-bracket syntax and foreach loops.
- Implements
- Children
- \Ulrichsg\Collections\NumberMap
- License
- MIT
- Link
- https://github.com/ulrichsg/php-collections
- Version
-
Methods



__construct(array $data = array()) : voidCreates a new map with the given array as its contents. Omitting the argument creates an empty map.
Parameters| Name | Type | Description |
|---|
| $data | array | |
|---|



get(mixed $key, mixed $default = null) : mixedIf the map contains the given key, returns the associated value. Otherwise, returns the default value.
Parameters| Name | Type | Description |
|---|
| $key | mixed | |
|---|
| $default | mixed | |
|---|
Returns 


getIterator() : \ArrayIteratorReturns an iterator over the map.
Returns| Type | Description |
|---|
| \ArrayIterator | |



hasKey(mixed $key) : boolReturns true if the map contains the given key, false otherwise.
Parameters| Name | Type | Description |
|---|
| $key | mixed | |
|---|
Returns 


remove(mixed $key) : voidRemoves the given key and its associated value from the map. Does nothing if the key is not in the map.
Parameters| Name | Type | Description |
|---|
| $key | mixed | |
|---|



set(mixed $key, mixed $value) : voidPuts the given key-value pair into the map.
Parameters| Name | Type | Description |
|---|
| $key | mixed | |
|---|
| $value | mixed | |
|---|