Example #1
0
 /**
  * Calls the action specified in the request object and returns a response
  * 
  * @return Response
  */
 public function run()
 {
     $this->initialize();
     $action = $this->getActionName();
     if (!$this->actionExists($action)) {
         throw new ActionNotFound($action);
     }
     $this->session->start();
     $this->flash = isset($this->session['__FLASH__']) ? $this->session['__FLASH__'] : new Flash();
     $beforeResult = $this->beforeFilters->process($this, $action, 'before');
     $this->aroundFilters->process($this, $action, 'before');
     if ($beforeResult !== false && !$this->performedRespond) {
         $content = $this->{$action}();
         if (!$this->performedRespond) {
             $this->respond($content);
         }
     }
     $this->aroundFilters->process($this, $action, 'after');
     $this->afterFilters->process($this, $action, 'after');
     $this->flash->discard();
     $this->session['__FLASH__'] = $this->flash;
     $this->session->store();
     return $this->response;
 }