Code Duplication    Length = 7-8 lines in 4 locations

src/Connection/Client.php 4 locations

@@ 321-327 (lines=7) @@
318
     * @param User|string $user A User model or userId
319
     * @return Collection|Notification[]
320
     */
321
    public function getUserNotifications($user)
322
    {
323
        $userId = $user instanceof User ? $user->getUserId() : $user;
324
        return $this->getResourceCollection(new Route(self::USER_NOTIFICATIONS_ROUTE, [
325
            'userId' => $userId
326
        ]), 'notifications', 'Wonnova\SDK\Model\Notification');
327
    }
328
329
    /**
330
     * Returns the list of badges that certain user has won
@@ 335-341 (lines=7) @@
332
     * @param User|string $user A User model or userId
333
     * @return Collection|Badge[]
334
     */
335
    public function getUserBadges($user)
336
    {
337
        $userId = $user instanceof User ? $user->getUserId() : $user;
338
        return $this->getResourceCollection(new Route(self::USER_BADGES_ROUTE, [
339
            'userId' => $userId
340
        ]), 'badges', 'Wonnova\SDK\Model\Badge');
341
    }
342
343
    /**
344
     * Returns the number of achievements of each type for certain user
@@ 371-378 (lines=8) @@
368
     * @param string $questCode
369
     * @return Collection|QuestStep[]
370
     */
371
    public function getUserProgressInQuest($user, $questCode)
372
    {
373
        $userId = $user instanceof User ? $user->getUserId() : $user;
374
        return $this->getResourceCollection(new Route(self::USER_QUEST_PROGRESS_ROUTE, [
375
            'userId' => $userId,
376
            'questCode' => $questCode
377
        ]), 'questSteps', 'Wonnova\SDK\Model\QuestStep');
378
    }
379
380
    /**
381
     * Returns the list of created quests
@@ 396-402 (lines=7) @@
393
     * @param User|string $user A User model or userId
394
     * @return Collection|Quest[]
395
     */
396
    public function getUserStatusInQuests($user)
397
    {
398
        $userId = $user instanceof User ? $user->getUserId() : $user;
399
        return $this->getResourceCollection(new Route(self::USER_QUESTS_STATUS_ROUTE, [
400
            'userId' => $userId
401
        ]), 'quests', 'Wonnova\SDK\Model\Quest');
402
    }
403
404
    /**
405
     * @return Collection|Level[]