Code Duplication    Length = 11-13 lines in 4 locations

src/ClashOfClansApi.php 4 locations

@@ 60-70 (lines=11) @@
57
         * @param  SearchFilter  $filter
58
         * @return array         of League objects
59
         */
60
        public function getLeagues(SearchFilter $filter = null)
61
        {
62
            $response = $this->webClient->sendRequest('/leagues' . $this->filterAppendToUrl($filter));
63
64
            for ($index = 0; $index < count($response->items); $index++)
65
                $response->items[$index] = new League($response->items[$index]);
66
67
            $response->paging = new Paging($response->paging);
68
69
            return $response;
70
        }
71
72
        /**
73
         * Get every information about the given league
@@ 92-102 (lines=11) @@
89
         * @param  SearchFilter  $filter
90
         * @return array         of Season objects
91
         */
92
        public function getLeagueSeasons(int $leagueId, SearchFilter $filter = null)
93
        {
94
            $response = $this->webClient->sendRequest('/leagues/' . $leagueId . '/seasons' . $this->filterAppendToUrl($filter));
95
96
            for ($index = 0; $index < count($response->items); $index++)
97
                $response->items[$index] = new Season($response->items[$index]);
98
99
            $response->paging = new Paging($response->paging);
100
101
            return $response;
102
        }
103
104
        /**
105
         * Get a league season rankings. Note that league season information is available only for Legend League (ID: 29000022)
@@ 132-144 (lines=13) @@
129
         * @param  SearchFilter  $filter
130
         * @return array         of Location objects
131
         */
132
        public function getLocations(SearchFilter $filter = null)
133
        {
134
            $url = '/locations' . $this->filterAppendToUrl($filter);
135
136
            $response = $this->webClient->sendRequest($url);
137
            
138
            for ($index = 0; $index < count($response->items); $index++)
139
                $response->items[$index] = new Location($response->items[$index]);
140
141
            $response->paging = new Paging($response->paging);
142
143
            return $response;
144
        }
145
146
        /**
147
         * Get information about specific location
@@ 251-263 (lines=13) @@
248
         * @param  ClanSearchFilter  $filter
249
         * @return array             of SearchClan objects
250
         */
251
        public function getClans(ClanSearchFilter $filter = null)
252
        {
253
            $url = '/clans' . $this->filterAppendToUrl($filter);
254
            
255
            $response = $this->webClient->sendRequest($url);
256
            
257
            for ($index = 0; $index < count($response->items); $index++)
258
                $response->items[$index] = new SearchClan($response->items[$index]);
259
260
            $response->paging = new Paging($response->paging);
261
262
            return $response;
263
        }
264
265
        /**
266
         * Get information about a single clan by clan tag