You are here

public function HttpFoundationFactory::createResponse in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php \Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory::createResponse()

Creates a Symfony Response instance from a PSR-7 one.

Parameters

ResponseInterface $psrResponse:

Return value

Response

Overrides HttpFoundationFactoryInterface::createResponse

File

vendor/symfony/psr-http-message-bridge/Factory/HttpFoundationFactory.php, line 111

Class

HttpFoundationFactory
@author Kévin Dunglas <dunglas@gmail.com>

Namespace

Symfony\Bridge\PsrHttpMessage\Factory

Code

public function createResponse(ResponseInterface $psrResponse) {
  $response = new Response($psrResponse
    ->getBody()
    ->__toString(), $psrResponse
    ->getStatusCode(), $psrResponse
    ->getHeaders());
  $response
    ->setProtocolVersion($psrResponse
    ->getProtocolVersion());
  foreach ($psrResponse
    ->getHeader('Set-Cookie') as $cookie) {
    $response->headers
      ->setCookie($this
      ->createCookie($cookie));
  }
  return $response;
}