/** * Run * @throws \Flywheel\Exception\Api */ public function run() { $this->beforeRun(); $this->getEventDispatcher()->dispatch('onBeginRequest', new Event($this)); $content = $this->_loadMethod(); $response = Factory::getResponse(); $response->setBody($content); $response->send(); $this->getEventDispatcher()->dispatch('onEndRequest', new Event($this)); $this->afterRun(); }
/** * running application * @return void */ public function run() { $this->beforeRun(); $this->getEventDispatcher()->dispatch('onBeginRequest', new Event($this)); //Session start Session::getInstance()->start(); $buffer = $this->_loadController(); $response = Factory::getResponse(); $response->setBody($buffer); $response->send(); $this->getEventDispatcher()->dispatch('onEndRequest', new Event($this)); $this->afterRun(); }
public static function responseJson() { Factory::getResponse()->setContentType('application/json'); }
/** * @return \Flywheel\Http\WebResponse | \Flywheel\Http\RESTfulResponse */ public function response() { return Factory::getResponse(); }