You are here

public function HttpFoundationFactory::createRequest 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::createRequest()

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

Parameters

ServerRequestInterface $psrRequest:

Return value

Request

Overrides HttpFoundationFactoryInterface::createRequest

File

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

Class

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

Namespace

Symfony\Bridge\PsrHttpMessage\Factory

Code

public function createRequest(ServerRequestInterface $psrRequest) {
  $parsedBody = $psrRequest
    ->getParsedBody();
  $parsedBody = is_array($parsedBody) ? $parsedBody : array();
  $request = new Request($psrRequest
    ->getQueryParams(), $parsedBody, $psrRequest
    ->getAttributes(), $psrRequest
    ->getCookieParams(), $this
    ->getFiles($psrRequest
    ->getUploadedFiles()), $psrRequest
    ->getServerParams(), $psrRequest
    ->getBody()
    ->__toString());
  $request->headers
    ->replace($psrRequest
    ->getHeaders());
  return $request;
}