Code Duplication    Length = 19-19 lines in 4 locations

src/WorldOfWarcraft/CharacterProfileApi/CharacterProfileApi.php 4 locations

@@ 202-220 (lines=19) @@
199
     *
200
     * @return MountsValueObject
201
     */
202
    public function getMounts()
203
    {
204
        $requestModel = $this->prepareRequestModel('mounts');
205
        $response = $this->requestService->doRequest($requestModel);
206
        $responseObject = json_decode($response);
207
208
        $collectedMounts = [];
209
        foreach ($responseObject->mounts->collected as $mount) {
210
            $collectedMounts[] = $this->prepareMountValueObject($mount);
211
        }
212
213
        $mounts = new MountsValueObject(
214
            $responseObject->mounts->numCollected,
215
            $responseObject->mounts->numNotCollected,
216
            $collectedMounts
217
        );
218
219
        return $mounts;
220
    }
221
222
    /**
223
     * A list of the battle pets obtained by the character
@@ 227-245 (lines=19) @@
224
     *
225
     * @return PetsValueObject
226
     */
227
    public function getPets()
228
    {
229
        $requestModel = $this->prepareRequestModel('pets');
230
        $response = $this->requestService->doRequest($requestModel);
231
        $responseObject = json_decode($response);
232
233
        $collectedPets = [];
234
        foreach ($responseObject->pets->collected as $pet) {
235
            $collectedPets[] = $this->preparePetValueObject($pet);
236
        }
237
238
        $pets = new PetsValueObject(
239
            $responseObject->pets->numCollected,
240
            $responseObject->pets->numNotCollected,
241
            $collectedPets
242
        );
243
244
        return $pets;
245
    }
246
247
    /**
248
     * Data about the current battle pet slots on this characters account
@@ 252-270 (lines=19) @@
249
     *
250
     * @return PetSlotsValueObject[]
251
     */
252
    public function getPetSlots()
253
    {
254
        $requestModel = $this->prepareRequestModel('petSlots');
255
        $response = $this->requestService->doRequest($requestModel);
256
        $responseObject = json_decode($response);
257
        $petSlots = [];
258
259
        foreach ($responseObject->petSlots as $petSlot) {
260
            $petSlots[] = new PetSlotsValueObject(
261
                $petSlot->slot,
262
                $petSlot->battlePetGuid,
263
                $petSlot->isEmpty,
264
                $petSlot->isLocked,
265
                $petSlot->abilities
266
            );
267
        }
268
269
        return $petSlots;
270
    }
271
272
    /**
273
     * A list of the character's professions. Does not include class professions
@@ 357-375 (lines=19) @@
354
     *
355
     * @return ReputationValueObject[]
356
     */
357
    public function getReputation()
358
    {
359
        $requestModel = $this->prepareRequestModel('reputation');
360
        $response = $this->requestService->doRequest($requestModel);
361
        $responseObject = json_decode($response);
362
        $reputations = [];
363
364
        foreach ($responseObject->reputation as $reputation) {
365
            $reputations[] = new ReputationValueObject(
366
                $reputation->id,
367
                $reputation->name,
368
                $reputation->standing,
369
                $reputation->value,
370
                $reputation->max
371
            );
372
        }
373
374
        return $reputations;
375
    }
376
377
    /**
378
     * A list of talent structures