@@ -110,32 +110,32 @@ discard block |
||
| 110 | 110 | "maps" => [] |
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | - for($page = 0; $page <= floor(($limit - 1) / self::MAPS_NUMBERS_PER_PAGE); $page++) { |
|
| 113 | + for ($page = 0; $page <= floor(($limit - 1) / self::MAPS_NUMBERS_PER_PAGE); $page++) { |
|
| 114 | 114 | $apiResult = $this->callAPI(str_ireplace("page", $page, $endpoint)); |
| 115 | 115 | |
| 116 | - if($apiResult === false || $apiResult == "Not Found") { |
|
| 116 | + if ($apiResult === false || $apiResult == "Not Found") { |
|
| 117 | 117 | $response["error"] = true; |
| 118 | 118 | |
| 119 | - if($apiResult == "Not Found") |
|
| 119 | + if ($apiResult == "Not Found") |
|
| 120 | 120 | break; |
| 121 | 121 | } else { |
| 122 | 122 | $apiResult = json_decode($apiResult, true); |
| 123 | 123 | |
| 124 | - if(count($apiResult["docs"]) === 0) |
|
| 124 | + if (count($apiResult["docs"]) === 0) |
|
| 125 | 125 | break; |
| 126 | 126 | |
| 127 | - if(($page + 1) * self::MAPS_NUMBERS_PER_PAGE <= $limit) { |
|
| 127 | + if (($page + 1) * self::MAPS_NUMBERS_PER_PAGE <= $limit) { |
|
| 128 | 128 | $response["maps"] = array_merge($response["maps"], $apiResult["docs"]); |
| 129 | 129 | } else { |
| 130 | 130 | $max = $limit <= self::MAPS_NUMBERS_PER_PAGE ? $limit : $limit - ($page * self::MAPS_NUMBERS_PER_PAGE); |
| 131 | 131 | |
| 132 | - for($i = 0; $i < $max; $i++) { |
|
| 132 | + for ($i = 0; $i < $max; $i++) { |
|
| 133 | 133 | array_push($response["maps"], $apiResult["docs"][$i]); |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - if(count($apiResult["docs"]) < ($page + 1) * self::MAPS_NUMBERS_PER_PAGE) |
|
| 138 | + if (count($apiResult["docs"]) < ($page + 1) * self::MAPS_NUMBERS_PER_PAGE) |
|
| 139 | 139 | break; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -206,23 +206,23 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | $endpoint = "/search/text/page?sortOrder=" . $sort[$sortOrder]; |
| 208 | 208 | |
| 209 | - if($mapName) $endpoint .= "&q=" . urlencode($mapName); |
|
| 210 | - if($startDate) $endpoint .= "&from=" . $startDate->format("Y-m-d"); |
|
| 211 | - if($endDate) $endpoint .= "&to=" . $endDate->format("Y-m-d"); |
|
| 212 | - if($ranked) $endpoint .= "&ranked=" . $ranked; |
|
| 213 | - if($automapper) $endpoint .= "&automapper=" . $automapper; |
|
| 214 | - if($chroma) $endpoint .= "&chroma=" . $chroma; |
|
| 215 | - if($noodle) $endpoint .= "&noodle=" . $noodle; |
|
| 216 | - if($cinema) $endpoint .= "&cinema=" . $cinema; |
|
| 217 | - if($fullSpread) $endpoint .= "&fullSpread=" . $fullSpread; |
|
| 218 | - if($minBpm) $endpoint .= "&minBpm=" . $minBpm; |
|
| 219 | - if($maxBpm) $endpoint .= "&maxBpm=" . $maxBpm; |
|
| 220 | - if($minNps) $endpoint .= "&minNps=" . $minNps; |
|
| 221 | - if($maxNps) $endpoint .= "&maxNps=" . $maxNps; |
|
| 222 | - if($minRating) $endpoint .= "&minRating=" . $minRating; |
|
| 223 | - if($maxRating) $endpoint .= "&maxRating=" . $maxRating; |
|
| 224 | - if($minDuration) $endpoint .= "&minDuration=" . $minDuration; |
|
| 225 | - if($maxDuration) $endpoint .= "&maxDuration=" . $maxDuration; |
|
| 209 | + if ($mapName) $endpoint .= "&q=" . urlencode($mapName); |
|
| 210 | + if ($startDate) $endpoint .= "&from=" . $startDate->format("Y-m-d"); |
|
| 211 | + if ($endDate) $endpoint .= "&to=" . $endDate->format("Y-m-d"); |
|
| 212 | + if ($ranked) $endpoint .= "&ranked=" . $ranked; |
|
| 213 | + if ($automapper) $endpoint .= "&automapper=" . $automapper; |
|
| 214 | + if ($chroma) $endpoint .= "&chroma=" . $chroma; |
|
| 215 | + if ($noodle) $endpoint .= "&noodle=" . $noodle; |
|
| 216 | + if ($cinema) $endpoint .= "&cinema=" . $cinema; |
|
| 217 | + if ($fullSpread) $endpoint .= "&fullSpread=" . $fullSpread; |
|
| 218 | + if ($minBpm) $endpoint .= "&minBpm=" . $minBpm; |
|
| 219 | + if ($maxBpm) $endpoint .= "&maxBpm=" . $maxBpm; |
|
| 220 | + if ($minNps) $endpoint .= "&minNps=" . $minNps; |
|
| 221 | + if ($maxNps) $endpoint .= "&maxNps=" . $maxNps; |
|
| 222 | + if ($minRating) $endpoint .= "&minRating=" . $minRating; |
|
| 223 | + if ($maxRating) $endpoint .= "&maxRating=" . $maxRating; |
|
| 224 | + if ($minDuration) $endpoint .= "&minDuration=" . $minDuration; |
|
| 225 | + if ($maxDuration) $endpoint .= "&maxDuration=" . $maxDuration; |
|
| 226 | 226 | |
| 227 | 227 | return $this->getMaps($endpoint, $limit); |
| 228 | 228 | } |