Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 200-221 (lines=22) @@
197
    /**
198
     * {@inheritdoc}
199
     */
200
    public function loadRole($roleId, $status = Role::STATUS_DEFINED)
201
    {
202
        if ($status !== Role::STATUS_DEFINED) {
203
            $this->logger->logCall(__METHOD__, array('role' => $roleId));
204
205
            return $this->persistenceHandler->userHandler()->loadRole($roleId, $status);
206
        }
207
208
        $cacheItem = $this->cache->getItem("ez-role-${roleId}");
209
        if ($cacheItem->isHit()) {
210
            return $cacheItem->get();
211
        }
212
213
        $this->logger->logCall(__METHOD__, array('role' => $roleId));
214
        $role = $this->persistenceHandler->userHandler()->loadRole($roleId, $status);
215
216
        $cacheItem->set($role);
217
        $cacheItem->tag(['role-' . $role->id]);
218
        $this->cache->save($cacheItem);
219
220
        return $role;
221
    }
222
223
    /**
224
     * {@inheritdoc}
@@ 226-247 (lines=22) @@
223
    /**
224
     * {@inheritdoc}
225
     */
226
    public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED)
227
    {
228
        if ($status !== Role::STATUS_DEFINED) {
229
            $this->logger->logCall(__METHOD__, array('role' => $identifier));
230
231
            return $this->persistenceHandler->userHandler()->loadRoleByIdentifier($identifier, $status);
232
        }
233
234
        $cacheItem = $this->cache->getItem("ez-role-${identifier}-by-identifier");
235
        if ($cacheItem->isHit()) {
236
            return $cacheItem->get();
237
        }
238
239
        $this->logger->logCall(__METHOD__, array('role' => $identifier));
240
        $role = $this->persistenceHandler->userHandler()->loadRoleByIdentifier($identifier, $status);
241
242
        $cacheItem->set($role);
243
        $cacheItem->tag(['role-' . $role->id]);
244
        $this->cache->save($cacheItem);
245
246
        return $role;
247
    }
248
249
    /**
250
     * {@inheritdoc}