コード例 #1
0
 private function read()
 {
     if (!$this->cacheautoinstaller->isDirty()) {
         $this->autoinstaller = $this->cacheautoinstaller->getData();
     }
     if ($this->cache->isDirty()) {
         $this->monitor->execute();
         $this->checkForGhosts();
         $app = Location::get(Location::APP);
         $this->options['options'] = \Raptor\Yaml\Yaml::parse($app . '/conf/options.yml');
         $this->options['bundles'] = \Raptor\Yaml\Yaml::parse($app . '/conf/bundles.yml');
         /**
          * Add the system routes and the bundles
          * check fot enviroment
          * if(development)
          */
         $this->options['bundles'] = array_merge(\Raptor\Yaml\Yaml::parse(__DIR__ . '/../Component/bundles.yml'), $this->options['bundles']);
         /**
          * Must call this before the Reader
          */
         //           \Raptor\Raptor::getInstance()->getAppAspectKernel()->resetContainer();
         foreach ($this->options['bundles'] as $bundle) {
             $cmp_str = $bundle;
             $cmp = new $cmp_str();
             call_user_func_array(array($cmp, 'init'), array());
             $container = \Raptor\Raptor::getInstance()->getAppAspectKernel()->getContainer();
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
             $refClass = new \ReflectionObject($cmp);
             $container->addResource($trace[1]['file']);
             $container->addResource($refClass->getFileName());
         }
         $this->reader->setBundles($this->options['bundles']);
         $this->reader->load();
         $this->options['routes'] = $this->reader->getDefinitions();
         $this->options['location'] = $this->reader->getLocation();
         $this->options['specifications'] = $this->reader->getSpecifications();
         $this->options['description'] = $this->reader->getDescriptions();
         $this->cache->setData($this->options);
         $this->cache->save();
         /**
          * Save the API to access in the main Raptor class
          */
         $api = new \Raptor\Cache\Cache('api');
         $api->setData($this->reader->getApi());
         $api->save();
         /**
          * Save the Auto Install Cache to know the trace of installed bundled
          */
         $this->cacheautoinstaller->setData($this->autoinstaller);
         $this->cacheautoinstaller->save();
     } else {
         $this->options = $this->cache->getData();
         foreach ($this->options['bundles'] as $bundle) {
             $cmp_str = $bundle;
             $cmp = new $cmp_str();
             call_user_func_array(array($cmp, 'init'), array());
             $container = \Raptor\Raptor::getInstance()->getAppAspectKernel()->getContainer();
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
             $refClass = new \ReflectionObject($cmp);
             $container->addResource($trace[1]['file']);
             $container->addResource($refClass->getFileName());
         }
     }
 }
コード例 #2
0
ファイル: Raptor.php プロジェクト: williamamed/Raptor2
 /**
  * Retorna el Manejador de API de Raptor, esta debe devolver toda la documentacion declarada en Raptor.
  * 
  * @return boolean
  */
 public function getApi()
 {
     $api = new \Raptor\Cache\Cache('api');
     if ($api->isDirty()) {
         return false;
     } else {
         return $api->getData();
     }
 }