response=new Response; } /** * Runs the appropriate action. * It will execute the before() method before the action * and after() method after the action finishes. * * @param string $action Name of the action to execute. * @return void * @access public * @throws Exception If the specified action doesn't exist */ public function run($action) { $action = 'action_'.$action; if (!method_exists($this, $action)) throw new Exception("Method {$action} doesn't exist in ".get_class($this),404); $this->execute=true; $this->before(); if($this->execute) $this->$action(); if($this->execute) $this->after(); } }