/** * {@inheritdoc} */ public function addBindingType(BindingType $type) { if (isset($this->types[$type->getName()])) { throw DuplicateTypeException::forTypeName($type->getName()); } $this->types[$type->getName()] = $type; }
/** * {@inheritdoc} */ public function addBindingType(BindingType $type) { if (null === $this->json) { $this->load(); } if (isset($this->json['keysByTypeName'][$type->getName()])) { throw DuplicateTypeException::forTypeName($type->getName()); } $key = $this->json['nextKey']++; $this->json['keysByTypeName'][$type->getName()] = $key; $this->typesByKey[$key] = $type; // Use integer keys to reduce storage space // (compared to fully-qualified class names) $this->json['typesByKey'][$key] = serialize($type); $this->flush(); }
/** * Returns the name of the described type. * * @return string The type name. */ public function getTypeName() { return $this->type->getName(); }
/** * {@inheritdoc} */ public function addBindingType(BindingType $type) { if (isset($this->keysByTypeName[$type->getName()])) { throw DuplicateTypeException::forTypeName($type->getName()); } $key = $this->nextKey++; $this->keysByTypeName[$type->getName()] = $key; // Use integer keys to reduce storage space // (compared to fully-qualified class names) $this->typesByKey[$key] = $type; $this->store->set('::keysByTypeName', $this->keysByTypeName); $this->store->set('::nextKey', $this->nextKey); $this->store->set('t:' . $key, $type); }
private function assertParameterValuesValid(array $parameterValues, BindingType $type) { foreach ($parameterValues as $name => $value) { if (!$type->hasParameter($name)) { throw NoSuchParameterException::forParameterName($name, $type->getName()); } } foreach ($type->getParameters() as $parameter) { if (!isset($parameterValues[$parameter->getName()])) { if ($parameter->isRequired()) { throw MissingParameterException::forParameterName($parameter->getName(), $type->getName()); } } } }