/** * Check if a behavior is enabled for a particular context/bucket combination. * * @param \Zumba\Swivel\BehaviorInterface $behavior * * @return bool * * @see \Zumba\Swivel\BucketInterface */ public function enabled(BehaviorInterface $behavior) { $slug = $behavior->getSlug(); if (!$this->featureMap->slugExists($slug)) { call_user_func($this->callback, $slug); } return $this->featureMap->enabled($slug, $this->index); }
/** * Merge this map with another map and return a new MapInterface. * * 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, ...); * * @param MapInterface $map * * @return MapInterface */ public function merge(MapInterface $map) { $maps = array_slice(func_get_args(), 1); $data = array_reduce($maps, 'array_merge', array_merge($this->map, $map->getMapData())); return new self($data, $this->logger); }
/** * Check if a behavior is enabled for a particular context/bucket combination * * @param \Zumba\Swivel\BehaviorInterface $behavior * @return boolean * @see \Zumba\Swivel\BucketInterface */ public function enabled(BehaviorInterface $behavior) { return $this->featureMap->enabled($behavior->getSlug(), $this->index); }