/** * * @return void|boolean */ public function send() { $output = new \PhalconRest\API\Output(); $output->setStatusCode($this->code, $this->response); $output->sendError($this->errorStore); return true; }
/** * set a standard HTTP response * * @return void|boolean */ public function send() { $output = new \PhalconRest\API\Output(); $output->setStatusCode('422', 'Unprocessable Entity'); $output->sendError($this->errorStore); return true; }
$method = $route->getHttpMethods(); $routeDefinitions[$method][] = $route->getPattern(); } return $routeDefinitions; }); /** * After a route is run, usually when its Controller returns a final value, * the application runs the following function which actually sends the response to the client. * * The default behavior is to send the Controller's returned value to the client as JSON. * However, by parsing the request querystring's 'type' paramter, it is easy to install * different response type handlers. */ $app->after(function () use($app) { $method = $app->request->getMethod(); $output = new \PhalconRest\API\Output(); switch ($method) { case 'OPTIONS': $app->response->setStatusCode('200', 'OK'); $app->response->send(); return; break; case 'DELETE': $app->response->setStatusCode('204', 'No Content'); $app->response->send(); return; break; case 'POST': $output->setStatusCode('201', 'Created'); break; }