Code Duplication    Length = 20-20 lines in 2 locations

eZ/Publish/Core/Persistence/Cache/LocationHandler.php 1 location

@@ 99-118 (lines=20) @@
96
    /**
97
     * {@inheritdoc}
98
     */
99
    public function loadParentLocationsForDraftContent($contentId)
100
    {
101
        $cacheItem = $this->cache->getItem("ez-content-locations-${contentId}-parentForDraft");
102
        if ($cacheItem->isHit()) {
103
            return $cacheItem->get();
104
        }
105
106
        $this->logger->logCall(__METHOD__, array('content' => $contentId));
107
        $locations = $this->persistenceHandler->locationHandler()->loadParentLocationsForDraftContent($contentId);
108
109
        $cacheItem->set($locations);
110
        $cacheTags = ['content-' . $contentId];
111
        foreach ($locations as $location) {
112
            $cacheTags = $this->getCacheTags($location, $cacheTags);
113
        }
114
        $cacheItem->tag($cacheTags);
115
        $this->cache->save($cacheItem);
116
117
        return $locations;
118
    }
119
120
    /**
121
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/UserHandler.php 1 location

@@ 246-265 (lines=20) @@
243
    /**
244
     * {@inheritdoc}
245
     */
246
    public function loadRoleAssignmentsByRoleId($roleId)
247
    {
248
        $cacheItem = $this->cache->getItem("ez-role-assignment-${roleId}-by-role");
249
        if ($cacheItem->isHit()) {
250
            return $cacheItem->get();
251
        }
252
253
        $this->logger->logCall(__METHOD__, array('role' => $roleId));
254
        $roleAssignments = $this->persistenceHandler->userHandler()->loadRoleAssignmentsByRoleId($roleId);
255
256
        $cacheItem->set($roleAssignments);
257
        $cacheTags = ['role-assignment-role-list-' . $roleId];
258
        foreach ($roleAssignments as $roleAssignment) {
259
            $cacheTags = $this->getCacheTagsForRoleAssignment($roleAssignment, $cacheTags);
260
        }
261
        $cacheItem->tag($cacheTags);
262
        $this->cache->save($cacheItem);
263
264
        return $roleAssignments;
265
    }
266
267
    /**
268
     * {@inheritdoc}