Code Duplication    Length = 16-16 lines in 4 locations

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

@@ 148-163 (lines=16) @@
145
    /**
146
     * {@inheritdoc}
147
     */
148
    public function load($typeId, $status = Type::STATUS_DEFINED)
149
    {
150
        $cacheItem = $this->cache->getItem('ez-content-type-' . $typeId . '-' . $status);
151
        if ($cacheItem->isHit()) {
152
            return $cacheItem->get();
153
        }
154
155
        $this->logger->logCall(__METHOD__, array('type' => $typeId, 'status' => $status));
156
        $type = $this->persistenceHandler->contentTypeHandler()->load($typeId, $status);
157
158
        $cacheItem->set($type);
159
        $cacheItem->tag(['type-' . $type->id]);
160
        $this->cache->save($cacheItem);
161
162
        return $type;
163
    }
164
165
    /**
166
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/ObjectStateHandler.php 3 locations

@@ 162-177 (lines=16) @@
159
    /**
160
     * {@inheritdoc}
161
     */
162
    public function load($stateId)
163
    {
164
        $cacheItem = $this->cache->getItem('ez-state-' . $stateId);
165
        if ($cacheItem->isHit()) {
166
            return $cacheItem->get();
167
        }
168
169
        $this->logger->logCall(__METHOD__, array('stateId' => $stateId));
170
        $objectState = $this->persistenceHandler->objectStateHandler()->load($stateId);
171
172
        $cacheItem->set($objectState);
173
        $cacheItem->tag(['state-' . $objectState->id, 'state-group-' . $objectState->groupId]);
174
        $this->cache->save($cacheItem);
175
176
        return $objectState;
177
    }
178
179
    /**
180
     * {@inheritdoc}
@@ 182-197 (lines=16) @@
179
    /**
180
     * {@inheritdoc}
181
     */
182
    public function loadByIdentifier($identifier, $groupId)
183
    {
184
        $cacheItem = $this->cache->getItem('ez-state-identifier-' . $identifier . '-by-group-' . $groupId);
185
        if ($cacheItem->isHit()) {
186
            return $cacheItem->get();
187
        }
188
189
        $this->logger->logCall(__METHOD__, array('identifier' => $identifier, 'groupId' => $groupId));
190
        $objectState = $this->persistenceHandler->objectStateHandler()->loadByIdentifier($identifier, $groupId);
191
192
        $cacheItem->set($objectState);
193
        $cacheItem->tag(['state-' . $objectState->id, 'state-group-' . $objectState->groupId]);
194
        $this->cache->save($cacheItem);
195
196
        return $objectState;
197
    }
198
199
    /**
200
     * {@inheritdoc}
@@ 254-269 (lines=16) @@
251
    /**
252
     * {@inheritdoc}
253
     */
254
    public function getContentState($contentId, $stateGroupId)
255
    {
256
        $cacheItem = $this->cache->getItem('ez-state-by-group-' . $stateGroupId . '-on-content-' . $contentId);
257
        if ($cacheItem->isHit()) {
258
            return $cacheItem->get();
259
        }
260
261
        $this->logger->logCall(__METHOD__, array('contentId' => $contentId, 'stateGroupId' => $stateGroupId));
262
        $contentState = $this->persistenceHandler->objectStateHandler()->getContentState($contentId, $stateGroupId);
263
264
        $cacheItem->set($contentState);
265
        $cacheItem->tag(['state-' . $contentState->id, 'content-' . $contentId]);
266
        $this->cache->save($cacheItem);
267
268
        return $contentState;
269
    }
270
271
    /**
272
     * {@inheritdoc}