Passed
Push — master ( b3b45e...532413 )
by Kylian
01:27
created
lib/BeatSaverAPI.php 1 patch
Braces   +57 added lines, -21 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function __construct(string $userAgent, bool $needAutoloader = false)
25 25
     {
26
-        if($needAutoloader)
27
-            $this->autoload("./");
26
+        if($needAutoloader) {
27
+                    $this->autoload("./");
28
+        }
28 29
 
29 30
         $this->userAgent = $userAgent;
30 31
         $this->multiQuery = new MultiQuery(self::BEATSAVER_URL, $userAgent);
@@ -192,8 +193,9 @@  discard block
 block discarded – undo
192 193
                 if($apiResult === false || $apiResult == "Not Found") {
193 194
                     $response->setErrorStatus(true)->setErrorMessage("[getMaps] Something went wrong with the API call while calling page number " . $i . ".");
194 195
 
195
-                    if($apiResult == "Not Found")
196
-                        return $response;
196
+                    if($apiResult == "Not Found") {
197
+                                            return $response;
198
+                    }
197 199
                 }
198 200
 
199 201
                 foreach ($apiResult->docs as $beatmap) {
@@ -274,23 +276,57 @@  discard block
 block discarded – undo
274 276
 
275 277
         $endpoint = "/search/text/page?sortOrder=" . $sort[$sortOrder];
276 278
 
277
-        if($mapName)                $endpoint .= "&q=" . urlencode($mapName);
278
-        if($startDate)              $endpoint .= "&from=" . $startDate->format("Y-m-d");
279
-        if($endDate)                $endpoint .= "&to=" . $endDate->format("Y-m-d");
280
-        if($ranked)                 $endpoint .= "&ranked=" . /** @scrutinizer ignore-type */ var_export($ranked, true);
281
-        if($automapper)             $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ var_export($automapper, true);
282
-        if($chroma)                 $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ var_export($chroma, true);
283
-        if($noodle)                 $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ var_export($noodle, true);
284
-        if($cinema)                 $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ var_export($cinema, true);
285
-        if($fullSpread)             $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ var_export($fullSpread, true);
286
-        if($minBpm)                 $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm;
287
-        if($maxBpm)                 $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm;
288
-        if($minNps)                 $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps;
289
-        if($maxNps)                 $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps;
290
-        if($minRating)              $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating;
291
-        if($maxRating)              $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating;
292
-        if($minDuration !== null)   $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration;
293
-        if($maxDuration !== null)   $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $maxDuration;
279
+        if($mapName) {
280
+            $endpoint .= "&q=" . urlencode($mapName);
281
+        }
282
+        if($startDate) {
283
+            $endpoint .= "&from=" . $startDate->format("Y-m-d");
284
+        }
285
+        if($endDate) {
286
+            $endpoint .= "&to=" . $endDate->format("Y-m-d");
287
+        }
288
+        if($ranked) {
289
+            $endpoint .= "&ranked=" . /** @scrutinizer ignore-type */ var_export($ranked, true);
290
+        }
291
+        if($automapper) {
292
+            $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ var_export($automapper, true);
293
+        }
294
+        if($chroma) {
295
+            $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ var_export($chroma, true);
296
+        }
297
+        if($noodle) {
298
+            $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ var_export($noodle, true);
299
+        }
300
+        if($cinema) {
301
+            $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ var_export($cinema, true);
302
+        }
303
+        if($fullSpread) {
304
+            $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ var_export($fullSpread, true);
305
+        }
306
+        if($minBpm) {
307
+            $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm;
308
+        }
309
+        if($maxBpm) {
310
+            $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm;
311
+        }
312
+        if($minNps) {
313
+            $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps;
314
+        }
315
+        if($maxNps) {
316
+            $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps;
317
+        }
318
+        if($minRating) {
319
+            $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating;
320
+        }
321
+        if($maxRating) {
322
+            $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating;
323
+        }
324
+        if($minDuration !== null) {
325
+            $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration;
326
+        }
327
+        if($maxDuration !== null) {
328
+            $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $maxDuration;
329
+        }
294 330
 
295 331
         return $this->getMapsByEndpoint($endpoint, $numberOfPage, $startPage);
296 332
     }
Please login to merge, or discard this patch.