Passed
Push — master ( 2d8094...0b9cbc )
by Kylian
01:28
created
lib/functions/MultiQuery.php 1 patch
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@  discard block
 block discarded – undo
38 38
             $l_Handles[] = $l_CURL;
39 39
         }
40 40
 
41
-        foreach ($l_Handles as $l_Current)
42
-            curl_multi_add_handle($l_Multi, $l_Current);
41
+        foreach ($l_Handles as $l_Current) {
42
+                    curl_multi_add_handle($l_Multi, $l_Current);
43
+        }
43 44
 
44 45
         $l_RunningHandles = null;
45 46
 
@@ -54,10 +55,11 @@  discard block
 block discarded – undo
54 55
         {
55 56
             $l_Error = curl_error($l_Current);
56 57
 
57
-            if (!empty($l_Error) || curl_getinfo($l_Current, CURLINFO_HTTP_CODE) !== 200)
58
-                $l_Result[] = false;
59
-            else
60
-                $l_Result[] = new BeatMap(json_decode(curl_multi_getcontent($l_Current)));
58
+            if (!empty($l_Error) || curl_getinfo($l_Current, CURLINFO_HTTP_CODE) !== 200) {
59
+                            $l_Result[] = false;
60
+            } else {
61
+                            $l_Result[] = new BeatMap(json_decode(curl_multi_getcontent($l_Current)));
62
+            }
61 63
 
62 64
             curl_multi_remove_handle($l_Multi, $l_Current);
63 65
         }
@@ -87,8 +89,9 @@  discard block
 block discarded – undo
87 89
                     mkdir($targetDir, 0777, true);
88 90
                 }
89 91
 
90
-                if(substr($targetDir, -1) !== "/")
91
-                    $targetDir .= "/";
92
+                if(substr($targetDir, -1) !== "/") {
93
+                                    $targetDir .= "/";
94
+                }
92 95
 
93 96
                 //The path & filename to save to.
94 97
                 $saveTo = $targetDir . $hash . $extension;
@@ -107,7 +110,9 @@  discard block
 block discarded – undo
107 110
                 } else {
108 111
                     $anyError[] = $hash;
109 112
                     $error = true;
110
-                    if(is_null($allFailed)) $allFailed = true;
113
+                    if(is_null($allFailed)) {
114
+                        $allFailed = true;
115
+                    }
111 116
                     echo "Error ";
112 117
                 }
113 118
 
Please login to merge, or discard this patch.
lib/BeatSaverAPI.php 1 patch
Braces   +54 added lines, -19 removed lines patch added patch discarded remove patch
@@ -161,8 +161,9 @@  discard block
 block discarded – undo
161 161
                 if($apiResult === false || $apiResult == "Not Found") {
162 162
                     $response->setErrorStatus(true)->setErrorMessage("[getMaps] Something went wrong with the API call while calling page number " . $i . ".");
163 163
 
164
-                    if($apiResult == "Not Found")
165
-                        return $response;
164
+                    if($apiResult == "Not Found") {
165
+                                            return $response;
166
+                    }
166 167
                 }
167 168
 
168 169
                 foreach ($apiResult->docs as $beatmap) {
@@ -243,23 +244,57 @@  discard block
 block discarded – undo
243 244
 
244 245
         $endpoint = "/search/text/page?sortOrder=" . $sort[$sortOrder];
245 246
 
246
-        if($mapName)                $endpoint .= "&q=" . urlencode($mapName);
247
-        if($startDate)              $endpoint .= "&from=" . $startDate->format("Y-m-d");
248
-        if($endDate)                $endpoint .= "&to=" . $endDate->format("Y-m-d");
249
-        if($ranked)                 $endpoint .= "&ranked=" . /** @scrutinizer ignore-type */ var_export($ranked, true);
250
-        if($automapper)             $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ var_export($automapper, true);
251
-        if($chroma)                 $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ var_export($chroma, true);
252
-        if($noodle)                 $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ var_export($noodle, true);
253
-        if($cinema)                 $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ var_export($cinema, true);
254
-        if($fullSpread)             $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ var_export($fullSpread, true);
255
-        if($minBpm)                 $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm;
256
-        if($maxBpm)                 $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm;
257
-        if($minNps)                 $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps;
258
-        if($maxNps)                 $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps;
259
-        if($minRating)              $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating;
260
-        if($maxRating)              $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating;
261
-        if($minDuration !== null)   $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration;
262
-        if($maxDuration !== null)   $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $maxDuration;
247
+        if($mapName) {
248
+            $endpoint .= "&q=" . urlencode($mapName);
249
+        }
250
+        if($startDate) {
251
+            $endpoint .= "&from=" . $startDate->format("Y-m-d");
252
+        }
253
+        if($endDate) {
254
+            $endpoint .= "&to=" . $endDate->format("Y-m-d");
255
+        }
256
+        if($ranked) {
257
+            $endpoint .= "&ranked=" . /** @scrutinizer ignore-type */ var_export($ranked, true);
258
+        }
259
+        if($automapper) {
260
+            $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ var_export($automapper, true);
261
+        }
262
+        if($chroma) {
263
+            $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ var_export($chroma, true);
264
+        }
265
+        if($noodle) {
266
+            $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ var_export($noodle, true);
267
+        }
268
+        if($cinema) {
269
+            $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ var_export($cinema, true);
270
+        }
271
+        if($fullSpread) {
272
+            $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ var_export($fullSpread, true);
273
+        }
274
+        if($minBpm) {
275
+            $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm;
276
+        }
277
+        if($maxBpm) {
278
+            $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm;
279
+        }
280
+        if($minNps) {
281
+            $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps;
282
+        }
283
+        if($maxNps) {
284
+            $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps;
285
+        }
286
+        if($minRating) {
287
+            $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating;
288
+        }
289
+        if($maxRating) {
290
+            $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating;
291
+        }
292
+        if($minDuration !== null) {
293
+            $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration;
294
+        }
295
+        if($maxDuration !== null) {
296
+            $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $maxDuration;
297
+        }
263 298
 
264 299
         return $this->getMaps($endpoint, $numberOfPage, $startPage);
265 300
     }
Please login to merge, or discard this patch.