예제 #1
0
 /**
  * @param  mixed                      $key
  * @param  mixed                      $value
  * @throws Exception\RuntimeException
  */
 public function offsetSet($key, $value)
 {
     if ($this->isImmutable()) {
         throw new Exception\RuntimeException(sprintf('Cannot set key "%s" as storage is marked isImmutable', $key));
     }
     if ($this->isLocked($key)) {
         throw new Exception\RuntimeException(sprintf('Cannot set key "%s" due to locking', $key));
     }
     parent::offsetSet($key, $value);
 }
 /**
  * @param ArrayObject $config
  *
  * @throws \Phpro\AnnotatedForms\Exception\RuntimeException
  */
 protected function injectListeners(ArrayObject $config)
 {
     if (!$config->offsetExists('listeners') || !$config->offsetGet('listeners')) {
         return;
     }
     $listeners = $config->offsetGet('listeners');
     foreach ($listeners as $index => $serviceKey) {
         $listener = $this->getServiceLocator()->get($serviceKey);
         if (!$listener instanceof ListenerAggregateInterface) {
             throw new RuntimeException(sprintf('Expected ListenerAggregateInterface for key "%s"', $serviceKey));
         }
         $listeners[$index] = $listener;
     }
     $config->offsetSet('listeners', $listeners);
 }
예제 #3
0
 /**
  * Sets the value of a single property.
  *
  * @param string $name
  * @param mixed $value
  */
 protected function setProperty($name, $value)
 {
     $this->properties->offsetSet($name, $value);
 }
예제 #4
0
 /**
  * {@inheritdoc}
  * @throws Exception\InvalidArgumentException
  */
 public function offsetSet($key, $value)
 {
     $this->validateValue($value);
     return parent::offsetSet($key, $value);
 }