No description
| src/Olivebbs/Map | ||
| tests | ||
| tools | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .php-cs-fixer.php | ||
| composer.json | ||
| composer.lock | ||
| header.txt | ||
| LICENSE | ||
| phpunit.xml | ||
| README.md | ||
| rector.php | ||
olivebbs/map
Very simple typed map class.
Includes IntCharMap and CharMap as examples. It is best to extend Olivebbs\Map\GenericMap for your uses.
Example
use Olivebbs\Map\GenericMap;
use Olivebbs\Map\Enum\ValueType;
use Olivebbs\Map\Enum\KeyType;
final class MyStringMap extends GenericMap
{
public function __construct(array $values)
{
parent::__construct(KeyType::STRING, ValueType::STRING);
$this->map->putAll($values);
}
}
or
use Olivebbs\Map\GenericMap;
use Olivebbs\Map\Enum\ValueType;
use Olivebbs\Map\Enum\KeyType;
$myIntMap = new GenericMap(KeyType::INT, ValueType::INT);
Then use it.
$myIntMap[0] = 500;
unset($myIntMap[0]) // null