Code Duplication    Length = 15-15 lines in 3 locations

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

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