if ($this->responseFactory instanceof RequestFactoryInterface
) { $request =
$this->responseFactory->
createRequest($method,
$uri);
} elseif (class_exists(Psr17FactoryDiscovery::
class)) { $request = Psr17FactoryDiscovery::
findRequestFactory()->
createRequest($method,
$uri);
} elseif (class_exists(Request::
class)) { $request =
new Request($method,
$uri);
} else { throw new \
LogicException(sprintf('You cannot use "%s()" as no PSR-17 factories have been found. Try running "composer require php-http/discovery psr/http-factory-implementation:*".', __METHOD__
));
} $request =
$request ->
withProtocolVersion($protocolVersion) ->
withBody($this->
createStream($body ?? ''
)) ;
foreach ($headers as $name =>
$value) { $request =
$request->
withAddedHeader($name,
$value);
} return $request;
} /**
* @param string $content
*/