示例#1
0
 public function __construct($file, $configFile = null)
 {
     OvoSystemRequired::check();
     if (!file_exists($file)) {
         throw new OvoContainerException('File ' . $file . ' not found');
     }
     PropertiesLoader::getInstance(ConfigurationLoader::getOvoConfigurationPath());
     if (isset($configFile)) {
         self::setIniFile($configFile);
     }
     $this->loadApplication($file);
 }
 public function __construct($path, $configFile = null)
 {
     OvoSystemRequired::check();
     if (is_null($path) or !is_dir($path)) {
         throw new OvoContainerException('Source dir ' . $path . ' not found');
     }
     AnnotationContainer::addNamespaceToClassLoader(null, $path);
     PropertiesLoader::getInstance(ConfigurationLoader::getOvoConfigurationPath());
     if (isset($configFile)) {
         self::setIniFile($configFile);
     }
     $this->loadApplication($path);
 }
示例#3
0
 /**
  * Unset all session and singleton beans created
  *
  * @param Repository $sessionRepository
  * @param Repository $singletonRepository
  * @param BeanEnvelopeRepository $beanEnvelopeRepository
  * @param string $contextReferenceId
  *
  * @return void
  */
 public static function now(Repository $sessionRepository, Repository $singletonRepository, BeanEnvelopeRepository $beanEnvelopeRepository, $contextReferenceId)
 {
     if ($beanEnvelopeRepository != null) {
         foreach ($beanEnvelopeRepository as $beanEnvelope) {
             /** @var $beanEnvelope BeanEnvelope * */
             switch ($beanEnvelope->getScope()) {
                 case ScopeValue::SESSION:
                     $sessionRepository->removeBean($beanEnvelope->getName());
                     break;
                 case ScopeValue::SINGLETON:
                     $singletonRepository->removeBean($beanEnvelope->getName());
                     break;
             }
         }
     }
     ConfigurationLoader::shutdown($contextReferenceId);
 }