/**
  *
  */
 public function boot()
 {
     try {
         if ($this->devmode) {
             $this->stopwatch = $this->injector->injectClass("develop.stopwatch");
             $this->stopwatch->start();
         }
         /**
          * @var Application $application
          */
         $this->application = $this->injector->injectClass("framework.application");
         $this->application->init($this->applicationConfig);
     } catch (DeclarationNotFound $e) {
         $this->application = $this->handleError($e);
     } catch (ClassNotFound $e) {
         $this->application = $this->handleError($e);
     } catch (WrongArguments $e) {
         $this->application = $this->handleError($e);
     } catch (\Exception $e) {
         $this->application = $this->handleError($e);
     }
 }
Beispiel #2
0
 /**
  *
  */
 public function shutdown()
 {
     if ($this->devmode) {
         $monitor = new Monitor();
         $this->response->addValue("memory_usage", $monitor->getUsedMemory());
         $this->response->addValue("memory_peak", $monitor->getPeak());
         $this->stopwatch->end();
         $this->response->addValue("time_elapsed", $this->stopwatch->getTimeElapsed());
     }
     if ($this->applicationConfig->get("accept-control-allow-origin") != NULL) {
         $accepts = explode(",", $this->applicationConfig->get("accept-control-allow-origin"));
         foreach ($accepts as $accept) {
             $this->response->setHeader("Access-Control-Allow-Origin: " . $accept, false);
         }
     }
     $this->response->process();
 }