/**
  * {@inheritdoc}
  */
 public function addBindingType(BindingType $type)
 {
     if (isset($this->types[$type->getName()])) {
         throw DuplicateTypeException::forTypeName($type->getName());
     }
     $this->types[$type->getName()] = $type;
 }
Beispiel #2
0
 /**
  * {@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();
 }
 /**
  * {@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);
 }