Go to file
R. Eric Wheeler b0002ef7f7 Fix not being able to use a class as the value type, also added CLOSURE constant value type 2021-03-04 10:51:09 -08:00
src/Olivebbs/Map Fix not being able to use a class as the value type, also added CLOSURE constant value type 2021-03-04 10:51:09 -08:00
tests Fix not being able to use a class as the value type, also added CLOSURE constant value type 2021-03-04 10:51:09 -08:00
.gitignore Initial commit 2021-03-03 13:59:55 -08:00
.php_cs.dist Initial commit 2021-03-03 13:59:55 -08:00
LICENSE Initial commit 2021-03-03 13:59:55 -08:00
README.md Initial commit 2021-03-03 13:59:55 -08:00
composer.json Initial commit 2021-03-03 13:59:55 -08:00
composer.lock Fix not being able to use a class as the value type, also added CLOSURE constant value type 2021-03-04 10:51:09 -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;

final class MyStringMap extends GenericMap 
{
    public function __construct(array $values)
    {
        parent::__construct(GenericMap::STRING, GenericMap::STRING);
        $this->map->putAll($values);
    }
}

or

use Olivebbs\Map\GenericMap;

$myIntMap = new GenericMap(GenericMap::INT, GenericMap::INT); 

Then use it.

$myIntMap[0] = 500;
unset($myIntMap[0]) // null