Code Duplication    Length = 15-15 lines in 3 locations

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

@@ 305-319 (lines=15) @@
302
     *
303
     * @return \eZ\Publish\SPI\Persistence\User\Role
304
     */
305
    public function loadRole($roleId, $status = Role::STATUS_DEFINED)
306
    {
307
        $data = $this->roleGateway->loadRole($roleId, $status);
308
309
        if (empty($data)) {
310
            throw new RoleNotFound($roleId, $status);
311
        }
312
313
        $role = $this->mapper->mapRole($data);
314
        foreach ($role->policies as $policy) {
315
            $this->limitationConverter->toSPI($policy);
316
        }
317
318
        return $role;
319
    }
320
321
    /**
322
     * Loads a specified role (draft) by $identifier and $status.
@@ 331-345 (lines=15) @@
328
     *
329
     * @return \eZ\Publish\SPI\Persistence\User\Role
330
     */
331
    public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED)
332
    {
333
        $data = $this->roleGateway->loadRoleByIdentifier($identifier, $status);
334
335
        if (empty($data)) {
336
            throw new RoleNotFound($identifier, $status);
337
        }
338
339
        $role = $this->mapper->mapRole($data);
340
        foreach ($role->policies as $policy) {
341
            $this->limitationConverter->toSPI($policy);
342
        }
343
344
        return $role;
345
    }
346
347
    /**
348
     * Loads a role draft by the original role ID.
@@ 356-370 (lines=15) @@
353
     *
354
     * @return \eZ\Publish\SPI\Persistence\User\Role
355
     */
356
    public function loadRoleDraftByRoleId($roleId)
357
    {
358
        $data = $this->roleGateway->loadRoleDraftByRoleId($roleId);
359
360
        if (empty($data)) {
361
            throw new RoleNotFound($roleId, Role::STATUS_DRAFT);
362
        }
363
364
        $role = $this->mapper->mapRole($data);
365
        foreach ($role->policies as $policy) {
366
            $this->limitationConverter->toSPI($policy);
367
        }
368
369
        return $role;
370
    }
371
372
    /**
373
     * Loads all roles.