|
@@ -110,32 +110,32 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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=" . /** @scrutinizer ignore-type */ $ranked; |
|
213
|
|
- if($automapper) $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ $automapper; |
|
214
|
|
- if($chroma) $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ $chroma; |
|
215
|
|
- if($noodle) $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ $noodle; |
|
216
|
|
- if($cinema) $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ $cinema; |
|
217
|
|
- if($fullSpread) $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ $fullSpread; |
|
218
|
|
- if($minBpm) $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm; |
|
219
|
|
- if($maxBpm) $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm; |
|
220
|
|
- if($minNps) $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps; |
|
221
|
|
- if($maxNps) $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps; |
|
222
|
|
- if($minRating) $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating; |
|
223
|
|
- if($maxRating) $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating; |
|
224
|
|
- if($minDuration !== null) $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration; |
|
225
|
|
- if($maxDuration !== null) $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $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=" . /** @scrutinizer ignore-type */ $ranked; |
|
|
213
|
+ if ($automapper) $endpoint .= "&automapper=" . /** @scrutinizer ignore-type */ $automapper; |
|
|
214
|
+ if ($chroma) $endpoint .= "&chroma=" . /** @scrutinizer ignore-type */ $chroma; |
|
|
215
|
+ if ($noodle) $endpoint .= "&noodle=" . /** @scrutinizer ignore-type */ $noodle; |
|
|
216
|
+ if ($cinema) $endpoint .= "&cinema=" . /** @scrutinizer ignore-type */ $cinema; |
|
|
217
|
+ if ($fullSpread) $endpoint .= "&fullSpread=" . /** @scrutinizer ignore-type */ $fullSpread; |
|
|
218
|
+ if ($minBpm) $endpoint .= "&minBpm=" . /** @scrutinizer ignore-type */ $minBpm; |
|
|
219
|
+ if ($maxBpm) $endpoint .= "&maxBpm=" . /** @scrutinizer ignore-type */ $maxBpm; |
|
|
220
|
+ if ($minNps) $endpoint .= "&minNps=" . /** @scrutinizer ignore-type */ $minNps; |
|
|
221
|
+ if ($maxNps) $endpoint .= "&maxNps=" . /** @scrutinizer ignore-type */ $maxNps; |
|
|
222
|
+ if ($minRating) $endpoint .= "&minRating=" . /** @scrutinizer ignore-type */ $minRating; |
|
|
223
|
+ if ($maxRating) $endpoint .= "&maxRating=" . /** @scrutinizer ignore-type */ $maxRating; |
|
|
224
|
+ if ($minDuration !== null) $endpoint .= "&minDuration=" . /** @scrutinizer ignore-type */ $minDuration; |
|
|
225
|
+ if ($maxDuration !== null) $endpoint .= "&maxDuration=" . /** @scrutinizer ignore-type */ $maxDuration; |
|
226
|
226
|
|
|
227
|
227
|
return $this->getMaps($endpoint, $limit); |
|
228
|
228
|
} |