Passed
Push — master ( 91fe13...12bba4 )
by Shahrad
10:04
created
src/lib/Util/Utils.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,11 +69,15 @@
 block discarded – undo
69 69
     {
70 70
         if ($binaryPrefix) {
71 71
             $unit = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB');
72
-            if ($bytes == 0) return '0 ' . $unit[0];
72
+            if ($bytes == 0) {
73
+                return '0 ' . $unit[0];
74
+            }
73 75
             return @round($bytes / pow(1024, ($i = floor(log($bytes, 1024)))), 2) . ' ' . ($unit[$i] ?? 'B');
74 76
         } else {
75 77
             $unit = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
76
-            if ($bytes == 0) return '0 ' . $unit[0];
78
+            if ($bytes == 0) {
79
+                return '0 ' . $unit[0];
80
+            }
77 81
             return @round($bytes / pow(1000, ($i = floor(log($bytes, 1000)))), 2) . ' ' . ($unit[$i] ?? 'B');
78 82
         }
79 83
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
      */
88 88
     public static function insensitiveString(string $string, string $value): bool
89 89
     {
90
-        return (bool)preg_match_all('/' . $value . '/i', $string);
90
+        return (bool) preg_match_all('/' . $value . '/i', $string);
91 91
     }
92 92
 
93 93
 }
94 94
\ No newline at end of file
Please login to merge, or discard this patch.
src/lib/Model/DownloadResult.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,9 @@
 block discarded – undo
132 132
     public function save(string $filePath): bool
133 133
     {
134 134
         $pathInfo = pathinfo($filePath, PATHINFO_DIRNAME);
135
-        if (gettype($pathInfo) != "string") $pathInfo = $pathInfo['dirname'];
135
+        if (gettype($pathInfo) != "string") {
136
+            $pathInfo = $pathInfo['dirname'];
137
+        }
136 138
         if (!file_exists($pathInfo)) {
137 139
             throw new \InvalidArgumentException('The directory does not exist');
138 140
         }
Please login to merge, or discard this patch.
src/lib/Client.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,9 +99,11 @@  discard block
 block discarded – undo
99 99
     public function request(string $method, string $uri, array|HttpOptions $options = []): HttpResponse
100 100
     {
101 101
         $CurlHandle = $this->create_curl_handler($method, $uri, $options);
102
-        if (!$CurlHandle) throw new RuntimeException(
102
+        if (!$CurlHandle) {
103
+            throw new RuntimeException(
103 104
             'An error occurred while creating the curl handler'
104 105
         );
106
+        }
105 107
 
106 108
         $result = new HttpResponse();
107 109
         $result->setCurlHandle($CurlHandle);
@@ -145,9 +147,11 @@  discard block
 block discarded – undo
145 147
                 $request['uri'],
146 148
                 $request['options'] ?? []
147 149
             );
148
-            if (!$CurlHandle) throw new RuntimeException(
150
+            if (!$CurlHandle) {
151
+                throw new RuntimeException(
149 152
                 'An error occurred while creating the curl handler'
150 153
             );
154
+            }
151 155
             $handlers[] = $CurlHandle;
152 156
             curl_multi_add_handle($multi_handler, $CurlHandle);
153 157
 
@@ -207,14 +211,18 @@  discard block
 block discarded – undo
207 211
     private function create_curl_handler(?string $method, string $uri, array|HttpOptions $options = []): false|CurlHandle
208 212
     {
209 213
         $handler = curl_init();
210
-        if (is_resource($handler) || !$handler) return false;
214
+        if (is_resource($handler) || !$handler) {
215
+            return false;
216
+        }
211 217
 
212 218
         if (gettype($options) === 'array') {
213 219
             $options = new HttpOptions($options);
214 220
         }
215 221
 
216 222
         if (count($options->getQuery()) > 0) {
217
-            if (!str_contains($uri, '?')) $uri .= '?';
223
+            if (!str_contains($uri, '?')) {
224
+                $uri .= '?';
225
+            }
218 226
             $uri .= $options->getQueryString();
219 227
         }
220 228
 
@@ -413,7 +421,9 @@  discard block
 block discarded – undo
413 421
 
414 422
             $headers = [];
415 423
             foreach ($options->getHeader() as $header => $value) {
416
-                if (Utils::insensitiveString($header, 'content-type')) continue;
424
+                if (Utils::insensitiveString($header, 'content-type')) {
425
+                    continue;
426
+                }
417 427
                 $headers[] = $header . ': ' . $value;
418 428
             }
419 429
             $headers[] = 'Content-Type: multipart/form-data';
Please login to merge, or discard this patch.
src/lib/Model/HttpResponse.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@
 block discarded – undo
54 54
      */
55 55
     public function getInfoFromCurl(): CurlInfo|false
56 56
     {
57
-        if (empty($this->getCurlHandle())) return false;
57
+        if (empty($this->getCurlHandle())) {
58
+            return false;
59
+        }
58 60
         return new CurlInfo(curl_getinfo($this->curlHandle));
59 61
     }
60 62
 
Please login to merge, or discard this patch.