in src/ClientBuilder.php [486:508]
protected function setOptions(ClientInterface $client, array $config, array $clientOptions = []): ClientInterface
{
if (empty($config) && empty($clientOptions)) {
return $client;
}
$class = get_class($client);
if (!isset(AdapterOptions::HTTP_ADAPTERS[$class])) {
throw new HttpClientException(sprintf(
"The HTTP client %s is not supported for custom options",
$class
));
}
$adapterClass = AdapterOptions::HTTP_ADAPTERS[$class];
if (!class_exists($adapterClass) || !in_array(AdapterInterface::class, class_implements($adapterClass))) {
throw new HttpClientException(sprintf(
"The class %s does not exists or does not implement %s",
$adapterClass,
AdapterInterface::class
));
}
$adapter = new $adapterClass;
return $adapter->setConfig($client, $config, $clientOptions);
}