private StreamFactoryInterface
$streamFactory;
public function __construct(HttpClientInterface
$client = null, ResponseFactoryInterface
$responseFactory = null, StreamFactoryInterface
$streamFactory = null
) { $this->client =
$client ?? HttpClient::
create();
$streamFactory ??=
$responseFactory instanceof StreamFactoryInterface ?
$responseFactory : null;
if (null ===
$responseFactory || null ===
$streamFactory) { if (class_exists(Psr17Factory::
class)) { $psr17Factory =
new Psr17Factory();
} elseif (class_exists(NyholmPsr17Factory::
class)) { $psr17Factory =
new NyholmPsr17Factory();
} else { throw new \
LogicException('You cannot use the "Symfony\Component\HttpClient\Psr18Client" as no PSR-17 factories have been provided. Try running "composer require php-http/discovery psr/http-factory-implementation:*".'
);
} $responseFactory ??=
$psr17Factory;
$streamFactory ??=
$psr17Factory;
} $this->responseFactory =
$responseFactory;
$this->streamFactory =
$streamFactory;
}