Example #1
0
 /**
  * Check and remove, from scoped repositories, bean with envelope $beanEnvelope
  *
  * @param BeanEnvelope $beanEnvelope
  *
  * @throws OvoContainerException
  */
 private function removeFromScopedBeanRepository(BeanEnvelope $beanEnvelope)
 {
     $beanName = $beanEnvelope->getName();
     switch ($beanEnvelope->getScope()) {
         case ScopeValue::SESSION:
             $key = array_search($beanName, $this->sessionBeansCreated);
             if (!isset($this->sessionBeansCreated[$key])) {
                 throw new OvoContainerException('Bean ' . $beanName . ' not found inside the session repository');
             }
             unset($this->sessionBeansCreated[$key]);
             $this->sessionRepository->removeBean($beanName);
             break;
         case ScopeValue::SINGLETON:
             $this->singletonRepository->removeBean($beanName);
             break;
     }
 }