/** * @param array $data * @return MapInterface */ public function deserialize(array $data) { $data = new Dictionary($data); $collection = new Dictionary(); $serializer = new ToggleSerializer(new OperatorConditionSerializer(new OperatorSerializer())); foreach ($data as $name => $serializedToggle) { $toggle = $serializer->deserialize($serializedToggle); $collection->set($serializedToggle->get('name'), $toggle); } return $collection; }
/** * {@inheritDoc} * @return $this */ public function indexBy($callback) { $callback = $this->propertyExtractor($callback); $group = new Dictionary(); foreach ($this as $value) { $key = $callback($value); $group->set($key, $value); } return $group; }
/** * @expectedException \OutOfBoundsException */ public function testGetInvalidItem() { $this->coll->set('keyOne', 'testing'); $this->coll->get('keyTwo'); }