use HttpClientTrait;
private ResponseInterface|\Closure|iterable|null
$responseFactory;
private int
$requestsCount = 0;
private array
$defaultOptions =
[];
/**
* @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory
*/
public function __construct(callable|iterable|ResponseInterface
$responseFactory = null, ?string
$baseUri = 'https://example.com'
) { $this->
setResponseFactory($responseFactory);
$this->defaultOptions
['base_uri'
] =
$baseUri;
} /**
* @param callable|callable[]|ResponseInterface|ResponseInterface[]|iterable|null $responseFactory
*/
public function setResponseFactory($responseFactory): void
{ if ($responseFactory instanceof ResponseInterface
) { $responseFactory =
[$responseFactory];
}