Code Duplication    Length = 19-19 lines in 4 locations

src/WorldOfWarcraft/CharacterProfileApi/CharacterProfileApi.php 4 locations

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