/** * @param HttpResponse $response * @return void */ protected function headers(HttpResponse $response) { if (headers_sent()) { return; } foreach ($response->headers() as $name => $header) { header($name . ': ' . (is_array($header) ? implode(', ', $header) : $header)); } if ($response instanceof Response) { foreach ($response->cookies() as $cookie) { $this->signal(Arg::SET_COOKIE, array_values($cookie)); } } $statusLine = sprintf('HTTP/%s %s %s', $response->version(), $response->status(), $response->reason()); header($statusLine, true, $response->status()); }
/** * @param Response $response * @return Response */ protected function response(Response $response) { $response[Arg::BODY] = $this->model($this->layout, $response->body()); return $response; }
/** * @param Request $request * @param Response $response * @return Response */ protected function version(Request $request, Response $response) { !$response->version() && ($response[Arg::VERSION] = $request->version()); return $response; }
/** * @param Response $response * @return Response */ protected function response(Response $response) { $response->body() instanceof Template && ($response[Arg::BODY] = $this->render($response->body())); return $response; }