Example #1
0
File: App.php Project: froq/froq
 /**
  * Run.
  * @return void
  */
 public final function run()
 {
     // security & performans checks
     if ($halt = $this->haltCheck()) {
         $this->halt($halt);
     }
     // re-set app as global
     set_global('app', $this);
     $this->request->init(['uriRoot' => $this->root]);
     $this->response->init();
     // set defaults
     $this->setDefaults();
     // start output buffer
     $this->startOutputBuffer();
     $this->service = (new ServiceAdapter($this))->getService();
     // create session if service uses session
     if ($this->service->usesSession()) {
         $this->session = Session::init($this->config['app.session.cookie']);
     }
     $output = $this->service->run();
     // end output buffer
     $this->endOutputBuffer($output);
 }