Go to file
R. Eric Wheeler 3ffe6ee387 Merge remote-tracking branch 'refs/remotes/origin/1.x' into 1.x 2022-11-30 13:34:57 -08:00
src/Olivebbs/Map Resolve "Change const types to enum" 2022-05-11 23:28:23 +00:00
tests Resolve "Change const types to enum" 2022-05-11 23:28:23 +00:00
.gitignore Resolve "Change const types to enum" 2022-05-11 23:28:23 +00:00
.gitlab-ci.yml Resolve "Create 1.x branch with support for enumerations available in php >= 8.1" 2022-05-11 20:17:06 +00:00
.php-cs-fixer.php Resolve "Create 1.x branch with support for enumerations available in php >= 8.1" 2022-05-11 20:17:06 +00:00
LICENSE Initial commit 2021-03-03 13:59:55 -08:00
README.md Resolve "Change const types to enum" 2022-05-11 23:28:23 +00:00
composer.json Update dependencies 2022-11-30 13:32:00 -08:00
composer.lock Update dependencies 2022-11-30 13:32:00 -08:00
header.txt Initial commit 2021-03-03 13:59:55 -08:00
phpunit.xml Initial commit 2021-03-03 13:59:55 -08:00

README.md

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