We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f56531b commit be6f9f5Copy full SHA for be6f9f5
ClientFactory/CurlFactory.php
@@ -40,6 +40,19 @@ public function createClient(array $config = [])
40
throw new \LogicException('To use the Curl client you need to install the "php-http/curl-client" package.');
41
}
42
43
+ // Try to resolve curl constant names
44
+ foreach ($config as $key => $value) {
45
+ // If the $key is a string we assume it is a constant
46
+ if (is_string($key)) {
47
+ if (null === ($constantValue = constant($key))) {
48
+ throw new \LogicException(sprintf('Key %s is not an int nor a CURL constant', $key));
49
+ }
50
+
51
+ unset($config[$key]);
52
+ $config[$constantValue] = $value;
53
54
55
56
return new Client($this->messageFactory, $this->streamFactory, $config);
57
58
0 commit comments