Code Duplication    Length = 16-22 lines in 3 locations

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

@@ 187-203 (lines=17) @@
184
    /**
185
     * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::loadByIdentifier
186
     */
187
    public function loadByIdentifier($identifier, $groupId)
188
    {
189
190
        $cacheItem = $this->cache->getItem('ez-state-identifier-'.$identifier.'-by-group-'.$groupId);
191
        if ($cacheItem->isHit()) {
192
            return $cacheItem->get();
193
        }
194
195
        $this->logger->logCall(__METHOD__, array('identifier' => $identifier, 'groupId' => $groupId));
196
        $objectState = $this->persistenceHandler->objectStateHandler()->loadByIdentifier($identifier, $groupId);
197
198
        $cacheItem->set($objectState);
199
        $cacheItem->tag(['state-'.$objectState->id,'state-group-'.$objectState->groupId]);
200
        $this->cache->save($cacheItem);
201
202
        return $objectState;
203
    }
204
205
    /**
206
     * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::update
@@ 260-275 (lines=16) @@
257
    /**
258
     * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::getContentState
259
     */
260
    public function getContentState($contentId, $stateGroupId)
261
    {
262
        $cacheItem = $this->cache->getItem('ez-state-by-group-'.$stateGroupId.'-on-content-'.$contentId);
263
        if ($cacheItem->isHit()) {
264
            return $cacheItem->get();
265
        }
266
267
        $this->logger->logCall(__METHOD__, array('contentId' => $contentId, 'stateGroupId' => $stateGroupId));
268
        $contentState = $this->persistenceHandler->objectStateHandler()->getContentState($contentId, $stateGroupId);
269
270
        $cacheItem->set($contentState);
271
        $cacheItem->tag(['state-'.$contentState->id, 'content-'.$contentId]);
272
        $this->cache->save($cacheItem);
273
274
        return $contentState;
275
    }
276
277
    /**
278
     * @see \eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::getContentCount

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

@@ 226-247 (lines=22) @@
223
    /**
224
     * @see eZ\Publish\SPI\Persistence\User\Handler::loadRoleAssignment
225
     */
226
    public function loadRoleAssignment($roleAssignmentId)
227
    {
228
        $cacheItem = $this->cache->getItem("ez-role-assignment-${roleAssignmentId}");
229
        if ($cacheItem->isHit()) {
230
            return $cacheItem->get();
231
        }
232
233
        $this->logger->logCall(__METHOD__, array('assignment' => $roleAssignmentId));
234
        $roleAssignment = $this->persistenceHandler->userHandler()->loadRoleAssignment($roleAssignmentId);
235
236
        $cacheItem->set($roleAssignment);
237
        $cacheItem->tag(
238
            [
239
                'role-assignment-group-list-'.$roleAssignment->contentId,
240
                'role-assignment-role-list-'.$roleAssignment->roleId,
241
                'role-assignment-'.$roleAssignmentId
242
            ]
243
        );
244
        $this->cache->save($cacheItem);
245
246
        return $roleAssignment;
247
    }
248
249
    /**
250
     * @see eZ\Publish\SPI\Persistence\User\Handler::loadRoleAssignmentsByRoleId