Code Duplication    Length = 14-15 lines in 2 locations

eZ/Publish/Core/Repository/NotificationService.php 1 location

@@ 46-59 (lines=14) @@
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function loadNotifications(int $offset = 0, int $limit = 25): NotificationList
47
    {
48
        $currentUserId = $this->getCurrentUserId();
49
50
        $list = new NotificationList();
51
        $list->totalCount = $this->persistenceHandler->countNotifications($currentUserId);
52
        if ($list->totalCount > 0) {
53
            $list->items = array_map(function (Notification $spiNotification) {
54
                return $this->buildDomainObject($spiNotification);
55
            }, $this->persistenceHandler->loadUserNotifications($currentUserId, $offset, $limit));
56
        }
57
58
        return $list;
59
    }
60
61
    /**
62
     * {@inheritdoc}

eZ/Publish/Core/Repository/UserPreferenceService.php 1 location

@@ 46-60 (lines=15) @@
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function loadUserPreferences(int $offset = 0, int $limit = 25): UserPreferenceList
47
    {
48
        $currentUserId = $this->getCurrentUserId();
49
50
        $list = new UserPreferenceList();
51
52
        $list->totalCount = $this->userPreferenceHandler->countUserPreferences($currentUserId);
53
        if ($list->totalCount > 0) {
54
            $list->items = array_map(function (UserPreference $spiUserPreference) {
55
                return $this->buildDomainObject($spiUserPreference);
56
            }, $this->userPreferenceHandler->loadUserPreferences($currentUserId, $offset, $limit));
57
        }
58
59
        return $list;
60
    }
61
62
    /**
63
     * {@inheritdoc}