Passed
Push — master ( d16243...311ea7 )
by Shahrad
01:34
created
src/lib/Client.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,7 +94,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,14 +196,18 @@  discard block
 block discarded – undo
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($options);
199 205
         }
200 206
 
201 207
         if (count($options->queries) > 0) {
202
-            if (!str_contains($uri, '?')) $uri .= '?';
208
+            if (!str_contains($uri, '?')) {
209
+                $uri .= '?';
210
+            }
203 211
             $uri .= $options->getQueryString();
204 212
         }
205 213
 
Please login to merge, or discard this patch.