Code Duplication    Length = 19-19 lines in 4 locations

src/WorldOfWarcraft/CharacterProfileApi/CharacterProfileApi.php 4 locations

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