NumberMap.php
\Ulrichsg\Collections\NumberMap
Package: A map that contains only numeric values, and supports mathematical operations.
- Parent(s)
- \Ulrichsg\Collections\Map
- License
- MIT
- Link
- https://github.com/ulrichsg/php-collections
- Version
-
Methods



__construct(array $data = array(), mixed $default = 0) : void
Creates a new NumberMap with the given array as its contents. Omitting the argument creates an empty map.
ParametersName | Type | Description |
---|
$data | array | |
---|
$default | mixed | |
---|
ThrowsException | Description |
---|
\InvalidArgumentException | if $default or one of the array values is not numeric |



add(mixed $key, mixed $value) : void
Adds the given value to the one associated to the given key.
If the key is not in the map yet, put it in and assume the map-wide default value.
ParametersName | Type | Description |
---|
$key | mixed | |
---|
$value | mixed | |
---|
ThrowsException | Description |
---|
\InvalidArgumentException | if $value is not numeric |



set(mixed $key, mixed $value) : void
Puts the given key-value pair into the map.
ParametersName | Type | Description |
---|
$key | mixed | |
---|
$value | mixed | |
---|
ThrowsException | Description |
---|
\InvalidArgumentException | if $value is not numeric |