PHP Interface Zumba\Swivel\MapInterface

Inheritance: extends Psr\Log\LoggerAwareInterface
Show file Open project: zumba/swivel Interface Usage Examples

Public Methods

Method Description
add ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface Merge this map with another map and return a new MapInterface.
diff ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface Compare $map to this instance and return a new MapInterface.
enabled ( string $slug, binary $index ) : boolean Check if a feature slug is enabled for a particular bucket index.
getMapData ( ) : array Get the internal map array used by this map object.
intersect ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface Compare $map to this instance and return a new MapInterface.
merge ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface Merge this map with another map and return a new MapInterface.
parse ( array $map ) : array Parse a human readable map into a map of bitmasks.

Method Details

add() public method

Values in $map will be added to values in this instance. Any number of additional maps may be passed to this method, i.e. $map->merge($map2, $map3, $map4, ...);
public add ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface
$map Zumba\Swivel\MapInterface
return Zumba\Swivel\MapInterface

diff() public method

Returned object will contain only the elements that differ between the two maps. If a feature with the same key has different buckets, the buckets from the passed-in $map will be in the new object. If this map has a logger, it will be passed to the new map.
public diff ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface
$map Zumba\Swivel\MapInterface
return Zumba\Swivel\MapInterface

enabled() public method

Check if a feature slug is enabled for a particular bucket index.
public enabled ( string $slug, binary $index ) : boolean
$slug string
$index binary
return boolean

getMapData() public method

Get the internal map array used by this map object.
public getMapData ( ) : array
return array

intersect() public method

Returned object will contain only the elements that match between the two maps. If this map has a logger, it will be passed to the new map.
public intersect ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface
$map Zumba\Swivel\MapInterface
return Zumba\Swivel\MapInterface

merge() public method

Values in $map will overwrite values in this instance. Any number of additional maps may be passed to this method, i.e. $map->merge($map2, $map3, $map4, ...);
public merge ( Zumba\Swivel\MapInterface $map ) : Zumba\Swivel\MapInterface
$map Zumba\Swivel\MapInterface
return Zumba\Swivel\MapInterface

parse() public method

Parse a human readable map into a map of bitmasks.
public parse ( array $map ) : array
$map array
return array