streamFactory = $streamFactory; $this->uriFactory = $uriFactory; } /** * {@inheritdoc} */ public function createRequest(string $method, $uri): RequestInterface { if (is_string($uri)) { $uri = $this->uriFactory->createUri($uri); } if (!$uri instanceof UriInterface) { throw new InvalidArgumentException( 'Parameter 2 of RequestFactory::createRequest() must be a string or a compatible UriInterface.' ); } $body = $this->streamFactory->createStream(); return new Request($method, $uri, new Headers(), [], [], $body); } }