Code Duplication    Length = 15-15 lines in 3 locations

eZ/Publish/Core/Persistence/Legacy/User/Handler.php 3 locations

@@ 242-256 (lines=15) @@
239
     *
240
     * @return \eZ\Publish\SPI\Persistence\User\Role
241
     */
242
    public function loadRole($roleId, $status = Role::STATUS_DEFINED)
243
    {
244
        $data = $this->roleGateway->loadRole($roleId, $status);
245
246
        if (empty($data)) {
247
            throw new RoleNotFound($roleId, $status);
248
        }
249
250
        $role = $this->mapper->mapRole($data);
251
        foreach ($role->policies as $policy) {
252
            $this->limitationConverter->toSPI($policy);
253
        }
254
255
        return $role;
256
    }
257
258
    /**
259
     * Loads a specified role (draft) by $identifier and $status.
@@ 268-282 (lines=15) @@
265
     *
266
     * @return \eZ\Publish\SPI\Persistence\User\Role
267
     */
268
    public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED)
269
    {
270
        $data = $this->roleGateway->loadRoleByIdentifier($identifier, $status);
271
272
        if (empty($data)) {
273
            throw new RoleNotFound($identifier, $status);
274
        }
275
276
        $role = $this->mapper->mapRole($data);
277
        foreach ($role->policies as $policy) {
278
            $this->limitationConverter->toSPI($policy);
279
        }
280
281
        return $role;
282
    }
283
284
    /**
285
     * Loads a role draft by the original role ID.
@@ 293-307 (lines=15) @@
290
     *
291
     * @return \eZ\Publish\SPI\Persistence\User\Role
292
     */
293
    public function loadRoleDraftByRoleId($roleId)
294
    {
295
        $data = $this->roleGateway->loadRoleDraftByRoleId($roleId);
296
297
        if (empty($data)) {
298
            throw new RoleNotFound($roleId, Role::STATUS_DRAFT);
299
        }
300
301
        $role = $this->mapper->mapRole($data);
302
        foreach ($role->policies as $policy) {
303
            $this->limitationConverter->toSPI($policy);
304
        }
305
306
        return $role;
307
    }
308
309
    /**
310
     * Loads all roles.