@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct(string $userAgent, bool $needAutoloader = false) |
| 28 | 28 | { |
| 29 | - if($needAutoloader) |
|
| 30 | - $this->autoload("./"); |
|
| 29 | + if($needAutoloader) { |
|
| 30 | + $this->autoload("./"); |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | $this->userAgent = $userAgent; |
| 33 | 34 | $this->multiQuery = new MultiQuery(self::BEATSAVER_URL, $userAgent); |
@@ -233,8 +234,9 @@ discard block |
||
| 233 | 234 | } |
| 234 | 235 | } |
| 235 | 236 | |
| 236 | - if(isset($mapsArray["errorStatus"]) && $mapsArray["errorStatus"]) |
|
| 237 | - $result->setErrorStatus( $mapsArray["errorStatus"])->setErrorMessage( $mapsArray["errorMessage"]); |
|
| 237 | + if(isset($mapsArray["errorStatus"]) && $mapsArray["errorStatus"]) { |
|
| 238 | + $result->setErrorStatus( $mapsArray["errorStatus"])->setErrorMessage( $mapsArray["errorMessage"]); |
|
| 239 | + } |
|
| 238 | 240 | |
| 239 | 241 | unset($mapsArray["errorStatus"]); |
| 240 | 242 | unset($mapsArray["errorMessage"]); |
@@ -280,8 +282,9 @@ discard block |
||
| 280 | 282 | if($apiResult === false || $apiResult == "Not Found") { |
| 281 | 283 | $response->setErrorStatus(true)->setErrorMessage("[getMaps] Something went wrong with the API call while calling page number " . $i . "."); |
| 282 | 284 | |
| 283 | - if($apiResult == "Not Found") |
|
| 284 | - return $response; |
|
| 285 | + if($apiResult == "Not Found") { |
|
| 286 | + return $response; |
|
| 287 | + } |
|
| 285 | 288 | } |
| 286 | 289 | |
| 287 | 290 | foreach ($apiResult->docs as $beatmap) { |
@@ -362,23 +365,57 @@ discard block |
||
| 362 | 365 | |
| 363 | 366 | $endpoint = "/search/text/page?sortOrder=" . $sort[$sortOrder]; |
| 364 | 367 | |
| 365 | - if($mapName) $endpoint .= "&q=" . urlencode($mapName); |
|
| 366 | - if($startDate) $endpoint .= "&from=" . $startDate->format("Y-m-d"); |
|
| 367 | - if($endDate) $endpoint .= "&to=" . $endDate->format("Y-m-d"); |
|
| 368 | - if($ranked) $endpoint .= "&ranked=" . /** @scrutinizer ignore-type */ var_export($ranked, true); |
|
| 369 | - if($automapper) $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ var_export($automapper, true); |
|
| 370 | - if($chroma) $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ var_export($chroma, true); |
|
| 371 | - if($noodle) $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ var_export($noodle, true); |
|
| 372 | - if($cinema) $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ var_export($cinema, true); |
|
| 373 | - if($fullSpread) $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ var_export($fullSpread, true); |
|
| 374 | - if($minBpm) $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm; |
|
| 375 | - if($maxBpm) $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm; |
|
| 376 | - if($minNps) $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps; |
|
| 377 | - if($maxNps) $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps; |
|
| 378 | - if($minRating) $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating; |
|
| 379 | - if($maxRating) $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating; |
|
| 380 | - if($minDuration !== null) $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration; |
|
| 381 | - if($maxDuration !== null) $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $maxDuration; |
|
| 368 | + if($mapName) { |
|
| 369 | + $endpoint .= "&q=" . urlencode($mapName); |
|
| 370 | + } |
|
| 371 | + if($startDate) { |
|
| 372 | + $endpoint .= "&from=" . $startDate->format("Y-m-d"); |
|
| 373 | + } |
|
| 374 | + if($endDate) { |
|
| 375 | + $endpoint .= "&to=" . $endDate->format("Y-m-d"); |
|
| 376 | + } |
|
| 377 | + if($ranked) { |
|
| 378 | + $endpoint .= "&ranked=" . /** @scrutinizer ignore-type */ var_export($ranked, true); |
|
| 379 | + } |
|
| 380 | + if($automapper) { |
|
| 381 | + $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ var_export($automapper, true); |
|
| 382 | + } |
|
| 383 | + if($chroma) { |
|
| 384 | + $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ var_export($chroma, true); |
|
| 385 | + } |
|
| 386 | + if($noodle) { |
|
| 387 | + $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ var_export($noodle, true); |
|
| 388 | + } |
|
| 389 | + if($cinema) { |
|
| 390 | + $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ var_export($cinema, true); |
|
| 391 | + } |
|
| 392 | + if($fullSpread) { |
|
| 393 | + $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ var_export($fullSpread, true); |
|
| 394 | + } |
|
| 395 | + if($minBpm) { |
|
| 396 | + $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm; |
|
| 397 | + } |
|
| 398 | + if($maxBpm) { |
|
| 399 | + $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm; |
|
| 400 | + } |
|
| 401 | + if($minNps) { |
|
| 402 | + $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps; |
|
| 403 | + } |
|
| 404 | + if($maxNps) { |
|
| 405 | + $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps; |
|
| 406 | + } |
|
| 407 | + if($minRating) { |
|
| 408 | + $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating; |
|
| 409 | + } |
|
| 410 | + if($maxRating) { |
|
| 411 | + $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating; |
|
| 412 | + } |
|
| 413 | + if($minDuration !== null) { |
|
| 414 | + $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration; |
|
| 415 | + } |
|
| 416 | + if($maxDuration !== null) { |
|
| 417 | + $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $maxDuration; |
|
| 418 | + } |
|
| 382 | 419 | |
| 383 | 420 | return $this->getMapsByEndpoint($endpoint, $numberOfPage, $startPage); |
| 384 | 421 | } |