Beispiel #1
0
 /**
  * @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());
 }
Beispiel #2
0
 /**
  * @param Response $response
  * @return Response
  */
 protected function response(Response $response)
 {
     $response[Arg::BODY] = $this->model($this->layout, $response->body());
     return $response;
 }
Beispiel #3
0
 /**
  * @param Request $request
  * @param Response $response
  * @return Response
  */
 protected function version(Request $request, Response $response)
 {
     !$response->version() && ($response[Arg::VERSION] = $request->version());
     return $response;
 }
Beispiel #4
0
 /**
  * @param Response $response
  * @return Response
  */
 protected function response(Response $response)
 {
     $response->body() instanceof Template && ($response[Arg::BODY] = $this->render($response->body()));
     return $response;
 }