Example #1
0
 public function bootstrap($restart = false)
 {
     if ($this->getConfig()->getEnvVariables()) {
         $this->addEnvVariables();
     }
     $bootstrap = $this->getConfig()->getBootstrap();
     if (is_file($bootstrap)) {
         require_once $bootstrap;
         if ($restart && null !== self::$instance && spl_object_hash($this) !== spl_object_hash(self::$instance)) {
             self::$instance->unserialize($this->serialize());
             self::$instance->run(false, true);
             $this->kill = true;
         }
     }
     $class = $this->getConfig()->getClass();
     if (!empty($class)) {
         $bootstrap = new $class();
         if (!$bootstrap instanceof BootstrapInterface) {
             throw new InvalidBootstrapClassException();
         }
         $bootstrap->run($this);
     }
     $this->isBootstraped = true;
 }