Code Duplication    Length = 19-19 lines in 4 locations

src/WorldOfWarcraft/CharacterProfileApi/CharacterProfileApi.php 4 locations

@@ 270-288 (lines=19) @@
267
     *
268
     * @return MountsValueObject
269
     */
270
    public function getMounts()
271
    {
272
        $requestModel = $this->prepareRequestModel('mounts');
273
        $response = $this->requestService->doRequest($requestModel);
274
        $responseObject = json_decode($response);
275
276
        $collectedMounts = [];
277
        foreach ($responseObject->mounts->collected as $mount) {
278
            $collectedMounts[] = $this->prepareMountValueObject($mount);
279
        }
280
281
        $mounts = new MountsValueObject(
282
            $responseObject->mounts->numCollected,
283
            $responseObject->mounts->numNotCollected,
284
            $collectedMounts
285
        );
286
287
        return $mounts;
288
    }
289
290
    /**
291
     * A list of the battle pets obtained by the character
@@ 295-313 (lines=19) @@
292
     *
293
     * @return PetsValueObject
294
     */
295
    public function getPets()
296
    {
297
        $requestModel = $this->prepareRequestModel('pets');
298
        $response = $this->requestService->doRequest($requestModel);
299
        $responseObject = json_decode($response);
300
301
        $collectedPets = [];
302
        foreach ($responseObject->pets->collected as $pet) {
303
            $collectedPets[] = $this->preparePetValueObject($pet);
304
        }
305
306
        $pets = new PetsValueObject(
307
            $responseObject->pets->numCollected,
308
            $responseObject->pets->numNotCollected,
309
            $collectedPets
310
        );
311
312
        return $pets;
313
    }
314
315
    /**
316
     * Data about the current battle pet slots on this characters account
@@ 320-338 (lines=19) @@
317
     *
318
     * @return PetSlotsValueObject[]
319
     */
320
    public function getPetSlots()
321
    {
322
        $requestModel = $this->prepareRequestModel('petSlots');
323
        $response = $this->requestService->doRequest($requestModel);
324
        $responseObject = json_decode($response);
325
        $petSlots = [];
326
327
        foreach ($responseObject->petSlots as $petSlot) {
328
            $petSlots[] = new PetSlotsValueObject(
329
                $petSlot->slot,
330
                $petSlot->battlePetGuid,
331
                $petSlot->isEmpty,
332
                $petSlot->isLocked,
333
                $petSlot->abilities
334
            );
335
        }
336
337
        return $petSlots;
338
    }
339
340
    /**
341
     * A list of the character's professions. Does not include class professions
@@ 425-443 (lines=19) @@
422
     *
423
     * @return ReputationValueObject[]
424
     */
425
    public function getReputation()
426
    {
427
        $requestModel = $this->prepareRequestModel('reputation');
428
        $response = $this->requestService->doRequest($requestModel);
429
        $responseObject = json_decode($response);
430
        $reputations = [];
431
432
        foreach ($responseObject->reputation as $reputation) {
433
            $reputations[] = new ReputationValueObject(
434
                $reputation->id,
435
                $reputation->name,
436
                $reputation->standing,
437
                $reputation->value,
438
                $reputation->max
439
            );
440
        }
441
442
        return $reputations;
443
    }
444
445
    /**
446
     * A map of character statistics