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

@@ 123-142 (lines=20) @@
120
    /**
121
     * {@inheritdoc}
122
     */
123
    public function loadParentLocationsForDraftContent($contentId)
124
    {
125
        $cacheItem = $this->cache->getItem("ez-content-locations-${contentId}-parentForDraft");
126
        if ($cacheItem->isHit()) {
127
            return $cacheItem->get();
128
        }
129
130
        $this->logger->logCall(__METHOD__, array('content' => $contentId));
131
        $locations = $this->persistenceHandler->locationHandler()->loadParentLocationsForDraftContent($contentId);
132
133
        $cacheItem->set($locations);
134
        $cacheTags = ['content-' . $contentId];
135
        foreach ($locations as $location) {
136
            $cacheTags = $this->getCacheTags($location, $cacheTags);
137
        }
138
        $cacheItem->tag($cacheTags);
139
        $this->cache->save($cacheItem);
140
141
        return $locations;
142
    }
143
144
    /**
145
     * {@inheritdoc}