Code Duplication    Length = 13-13 lines in 7 locations

src/ClashOfClansApi.php 7 locations

@@ 112-124 (lines=13) @@
109
         * @param  SearchFilter  $filter
110
         * @return array         of SeasonPlayer objects
111
         */
112
        public function getLeagueSeason(int $leagueId, SeasonPeriod $seasonId, SearchFilter $filter = null)
113
        {
114
            $url = '/leagues/' . $leagueId . '/seasons/' . $seasonId . $this->filterAppendToUrl($filter);
115
116
            $response = $this->webClient->sendRequest($url);
117
            
118
            for ($index = 0; $index < count($response->items); $index++)
119
                $response->items[$index] = new SeasonPlayer($response->items[$index]);
120
121
            $response->paging = new Paging($response->paging);
122
123
            return $response;
124
        }
125
126
        /**
127
         * List all available locations
@@ 168-180 (lines=13) @@
165
         * @param  SearchFilter  $filter
166
         * @return array         of LocationClan objects
167
         */
168
        public function getLocationClanRankings(int $locationId, SearchFilter $filter = null)
169
        {
170
            $url = '/locations/' . $locationId . '/rankings/clans' . $this->filterAppendToUrl($filter);
171
172
            $response = $this->webClient->sendRequest($url);
173
            
174
            for ($index = 0; $index < count($response->items); $index++)
175
                $response->items[$index] = new LocationClan($response->items[$index]);
176
177
            $response->paging = new Paging($response->paging);
178
179
            return $response;
180
        }
181
182
        /**
183
         * Get player rankings for a specific location
@@ 189-201 (lines=13) @@
186
         * @param  SearchFilter  $filter
187
         * @return array         of LocationPlayer objects
188
         */
189
        public function getLocationPlayerRankings(int $locationId, SearchFilter $filter = null)
190
        {
191
            $url = '/locations/' . $locationId . '/rankings/players' . $this->filterAppendToUrl($filter);
192
193
            $response = $this->webClient->sendRequest($url);
194
            
195
            for ($index = 0; $index < count($response->items); $index++)
196
                $response->items[$index] = new LocationPlayer($response->items[$index]);
197
198
            $response->paging = new Paging($response->paging);
199
200
            return $response;
201
        }
202
203
        /**
204
         * Get clan versus rankings for a specific location
@@ 210-222 (lines=13) @@
207
         * @param  SearchFilter  $filter
208
         * @return array         of LocationVersusClan objects
209
         */
210
        public function getLocationClanVersusRankings(int $locationId, SearchFilter $filter = null)
211
        {
212
            $url = '/locations/' . $locationId . '/rankings/clans-versus' . $this->filterAppendToUrl($filter);
213
214
            $response = $this->webClient->sendRequest($url);
215
            
216
            for ($index = 0; $index < count($response->items); $index++)
217
                $response->items[$index] = new LocationVersusClan($response->items[$index]);
218
219
            $response->paging = new Paging($response->paging);
220
221
            return $response;
222
        }
223
224
        /**
225
         * Get player rankings for a specific location
@@ 231-243 (lines=13) @@
228
         * @param  SearchFilter  $filter
229
         * @return array         of LocationVersusPlayer objects
230
         */
231
        public function getLocationPlayerVersusRankings(int $locationId, SearchFilter $filter = null)
232
        {
233
            $url = '/locations/' . $locationId . '/rankings/players-versus' . $this->filterAppendToUrl($filter);
234
235
            $response = $this->webClient->sendRequest($url);
236
            
237
            for ($index = 0; $index < count($response->items); $index++)
238
                $response->items[$index] = new LocationVersusPlayer($response->items[$index]);
239
240
            $response->paging = new Paging($response->paging);
241
242
            return $response;
243
        }
244
245
        /**
246
         * Search all clans by name and/or filtering the results using various criteria
@@ 287-299 (lines=13) @@
284
         * @param  SearchFilter  $filter
285
         * @return array         of DetailedClanPlayer objects
286
         */
287
        public function getClanMembers(string $clanTag, SearchFilter $filter = null)
288
        {
289
            $url = '/clans/' . $clanTag . '/members' . $this->filterAppendToUrl($filter);
290
            
291
            $response = $this->webClient->sendRequest($url);
292
293
            for ($index = 0; $index < count($response->items); $index++)
294
                $response->items[$index] = new DetailedClanPlayer($response->items[$index]);
295
296
            $response->paging = new Paging($response->paging);
297
298
            return $response;
299
        }
300
301
        /**
302
         * Get information about a single clan by clan tag
@@ 308-320 (lines=13) @@
305
         * @param  SearchFilter  $filter
306
         * @return array         of DetailedClanPlayer objects
307
         */
308
        public function getClanWarlog(string $clanTag, SearchFilter $filter = null)
309
        {
310
            $url = '/clans/' . $clanTag . '/warlog' . $this->filterAppendToUrl($filter);
311
            
312
            $response = $this->webClient->sendRequest($url);
313
314
            for ($index = 0; $index < count($response->items); $index++)
315
                $response->items[$index] = new Warlog($response->items[$index]);
316
317
            $response->paging = new Paging($response->paging);
318
319
            return $response;
320
        }
321
322
        /**
323
         * Get information about a single clan by clan tag