Code Duplication    Length = 22-22 lines in 2 locations

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

@@ 154-175 (lines=22) @@
151
    /**
152
     * {@inheritdoc}
153
     */
154
    public function loadRole($roleId, $status = Role::STATUS_DEFINED)
155
    {
156
        if ($status !== Role::STATUS_DEFINED) {
157
            $this->logger->logCall(__METHOD__, array('role' => $roleId));
158
159
            return $this->persistenceHandler->userHandler()->loadRole($roleId, $status);
160
        }
161
162
        $cacheItem = $this->cache->getItem("ez-role-${roleId}");
163
        if ($cacheItem->isHit()) {
164
            return $cacheItem->get();
165
        }
166
167
        $this->logger->logCall(__METHOD__, array('role' => $roleId));
168
        $role = $this->persistenceHandler->userHandler()->loadRole($roleId, $status);
169
170
        $cacheItem->set($role);
171
        $cacheItem->tag(['role-' . $role->id]);
172
        $this->cache->save($cacheItem);
173
174
        return $role;
175
    }
176
177
    /**
178
     * {@inheritdoc}
@@ 180-201 (lines=22) @@
177
    /**
178
     * {@inheritdoc}
179
     */
180
    public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED)
181
    {
182
        if ($status !== Role::STATUS_DEFINED) {
183
            $this->logger->logCall(__METHOD__, array('role' => $identifier));
184
185
            return $this->persistenceHandler->userHandler()->loadRoleByIdentifier($identifier, $status);
186
        }
187
188
        $cacheItem = $this->cache->getItem("ez-role-${identifier}-by-identifier");
189
        if ($cacheItem->isHit()) {
190
            return $cacheItem->get();
191
        }
192
193
        $this->logger->logCall(__METHOD__, array('role' => $identifier));
194
        $role = $this->persistenceHandler->userHandler()->loadRoleByIdentifier($identifier, $status);
195
196
        $cacheItem->set($role);
197
        $cacheItem->tag(['role-' . $role->id]);
198
        $this->cache->save($cacheItem);
199
200
        return $role;
201
    }
202
203
    /**
204
     * {@inheritdoc}