@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | |
109 | 109 | $result->setStatusCode(curl_getinfo($CurlHandle, CURLINFO_HTTP_CODE)); |
110 | 110 | $result->setHeaderSize(curl_getinfo($CurlHandle, CURLINFO_HEADER_SIZE)); |
111 | - $result->setHeaders(substr((string)$response, 0, $result->getHeaderSize())); |
|
112 | - $result->setBody(substr((string)$response, $result->getHeaderSize())); |
|
111 | + $result->setHeaders(substr((string) $response, 0, $result->getHeaderSize())); |
|
112 | + $result->setBody(substr((string) $response, $result->getHeaderSize())); |
|
113 | 113 | |
114 | 114 | curl_close($CurlHandle); |
115 | 115 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | ] |
430 | 430 | ]); |
431 | 431 | |
432 | - return (int)$response->getHeaderLine('Content-Length') ?? 0; |
|
432 | + return (int) $response->getHeaderLine('Content-Length') ?? 0; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
@@ -94,7 +94,9 @@ discard block |
||
94 | 94 | public function request(string $method, string $uri, array|HttpOptions $options = []): HttpResponse |
95 | 95 | { |
96 | 96 | $CurlHandle = $this->createCurlHandler($method, $uri, $options); |
97 | - if (!$CurlHandle) throw new \RuntimeException('Curl handle has not been created'); |
|
97 | + if (!$CurlHandle) { |
|
98 | + throw new \RuntimeException('Curl handle has not been created'); |
|
99 | + } |
|
98 | 100 | |
99 | 101 | $result = new HttpResponse(); |
100 | 102 | $result->setCurlHandle($CurlHandle); |
@@ -135,7 +137,9 @@ discard block |
||
135 | 137 | $request['uri'], |
136 | 138 | $request['options'] ?? [] |
137 | 139 | ); |
138 | - if (!$CurlHandle) throw new \RuntimeException('Curl handle has not been created'); |
|
140 | + if (!$CurlHandle) { |
|
141 | + throw new \RuntimeException('Curl handle has not been created'); |
|
142 | + } |
|
139 | 143 | $handlers[] = $CurlHandle; |
140 | 144 | curl_multi_add_handle($multi_handler, $CurlHandle); |
141 | 145 | |
@@ -192,7 +196,9 @@ discard block |
||
192 | 196 | private function createCurlHandler(?string $method, string $uri, array|HttpOptions $options = []): false|CurlHandle |
193 | 197 | { |
194 | 198 | $handler = curl_init(); |
195 | - if (is_resource($handler) || !$handler) return false; |
|
199 | + if (is_resource($handler) || !$handler) { |
|
200 | + return false; |
|
201 | + } |
|
196 | 202 | |
197 | 203 | if (gettype($options) === 'array') { |
198 | 204 | $options = new HttpOptions( |
@@ -201,7 +207,9 @@ discard block |
||
201 | 207 | } |
202 | 208 | |
203 | 209 | if (count($options->queries) > 0) { |
204 | - if (!str_contains($uri, '?')) $uri .= '?'; |
|
210 | + if (!str_contains($uri, '?')) { |
|
211 | + $uri .= '?'; |
|
212 | + } |
|
205 | 213 | $uri .= $options->getQueryString(); |
206 | 214 | } |
207 | 215 |