Code Duplication    Length = 19-19 lines in 4 locations

src/WorldOfWarcraft/CharacterProfileApi/CharacterProfileApi.php 4 locations

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