Code Duplication    Length = 20-23 lines in 2 locations

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

@@ 296-318 (lines=23) @@
293
    /**
294
     * {@inheritdoc}
295
     */
296
    public function loadRoleAssignmentsByRoleId($roleId)
297
    {
298
        $cacheItem = $this->cache->getItem("ez-role-assignment-${roleId}-by-role");
299
        if ($cacheItem->isHit()) {
300
            return $cacheItem->get();
301
        }
302
303
        $this->logger->logCall(__METHOD__, array('role' => $roleId));
304
        $roleAssignments = $this->persistenceHandler->userHandler()->loadRoleAssignmentsByRoleId($roleId);
305
306
        $cacheItem->set($roleAssignments);
307
        $cacheTags = [
308
            'role-assignment-role-list-' . $roleId,
309
            'role-' . $roleId, /* Role update (policies) changes role assignment id */
310
        ];
311
        foreach ($roleAssignments as $roleAssignment) {
312
            $cacheTags = $this->getCacheTagsForRoleAssignment($roleAssignment, $cacheTags);
313
        }
314
        $cacheItem->tag($cacheTags);
315
        $this->cache->save($cacheItem);
316
317
        return $roleAssignments;
318
    }
319
320
    /**
321
     * {@inheritdoc}

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

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