Code Duplication    Length = 4-8 lines in 5 locations

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

@@ 66-70 (lines=5) @@
63
        $translationsKey = empty($translations) ? self::ALL_TRANSLATIONS_KEY : implode('|', $translations);
64
        $cache = $this->cache->getItem('content', $contentId, $version, $translationsKey);
65
        $content = $cache->get();
66
        if ($cache->isMiss()) {
67
            $this->logger->logCall(__METHOD__, array('content' => $contentId, 'version' => $version, 'translations' => $translations));
68
            $content = $this->persistenceHandler->contentHandler()->load($contentId, $version, $translations);
69
            $cache->set($content)->save();
70
        }
71
72
        return $content;
73
    }

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

@@ 128-131 (lines=4) @@
125
        // Get cache for published content types
126
        $cache = $this->cache->getItem('contentType', $typeId);
127
        $type = $cache->get();
128
        if ($cache->isMiss()) {
129
            $this->logger->logCall(__METHOD__, array('type' => $typeId, 'status' => $status));
130
            $cache->set($type = $this->persistenceHandler->contentTypeHandler()->load($typeId, $status))->save();
131
        }
132
133
        return $type;
134
    }

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

@@ 243-250 (lines=8) @@
240
    {
241
        $cache = $this->cache->getItem('objectstate', 'byContent', $contentId, $stateGroupId);
242
        $stateId = $cache->get();
243
        if ($cache->isMiss()) {
244
            $this->logger->logCall(__METHOD__, array('contentId' => $contentId, 'stateGroupId' => $stateGroupId));
245
246
            $contentState = $this->persistenceHandler->objectStateHandler()->getContentState($contentId, $stateGroupId);
247
            $cache->set($contentState->id)->save();
248
249
            return $contentState;
250
        }
251
252
        return $this->load($stateId);
253
    }

eZ/Publish/Core/Persistence/Cache/UserHandler.php 2 locations

@@ 126-130 (lines=5) @@
123
        if ($status === Role::STATUS_DEFINED) {
124
            $cache = $this->cache->getItem('user', 'role', $roleId);
125
            $role = $cache->get();
126
            if ($cache->isMiss()) {
127
                $this->logger->logCall(__METHOD__, array('role' => $roleId));
128
                $role = $this->persistenceHandler->userHandler()->loadRole($roleId, $status);
129
                $cache->set($role)->save();
130
            }
131
        } else {
132
            $role = $this->persistenceHandler->userHandler()->loadRole($roleId, $status);
133
        }
@@ 199-206 (lines=8) @@
196
            $cache = $this->cache->getItem('user', 'role', 'assignments', 'byGroup', $groupId);
197
        }
198
        $assignments = $cache->get();
199
        if ($cache->isMiss()) {
200
            $this->logger->logCall(__METHOD__, array('group' => $groupId, 'inherit' => $inherit));
201
            $assignments = $this->persistenceHandler->userHandler()->loadRoleAssignmentsByGroupId(
202
                $groupId,
203
                $inherit
204
            );
205
            $cache->set($assignments)->save();
206
        }
207
208
        return $assignments;
209
    }