public function run() { $this->init(); if (empty($this->_actionMethod)) { trigger_error('Action not defined in class ' . get_class($this) . '::run()', E_USER_ERROR); App::response()->sendNotFoundAndExit(); } if (!method_exists($this, $this->_actionMethod)) { trigger_error('Action method "' . $this->_actionMethod . '" not exit in class ' . get_class($this) . '::run()', E_USER_ERROR); App::response()->sendNotFoundAndExit(); } $this->{$this->_actionMethod}(); if ($this->_doRender) { // if action method called render() return $this->view->render(); // return rendered content } else { return $this->view->getData(); // return all variables } }