Code Duplication    Length = 15-15 lines in 3 locations

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

@@ 283-297 (lines=15) @@
280
     *
281
     * @return \eZ\Publish\SPI\Persistence\User\Role
282
     */
283
    public function loadRole($roleId, $status = Role::STATUS_DEFINED)
284
    {
285
        $data = $this->roleGateway->loadRole($roleId, $status);
286
287
        if (empty($data)) {
288
            throw new RoleNotFound($roleId, $status);
289
        }
290
291
        $role = $this->mapper->mapRole($data);
292
        foreach ($role->policies as $policy) {
293
            $this->limitationConverter->toSPI($policy);
294
        }
295
296
        return $role;
297
    }
298
299
    /**
300
     * Loads a specified role (draft) by $identifier and $status.
@@ 309-323 (lines=15) @@
306
     *
307
     * @return \eZ\Publish\SPI\Persistence\User\Role
308
     */
309
    public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED)
310
    {
311
        $data = $this->roleGateway->loadRoleByIdentifier($identifier, $status);
312
313
        if (empty($data)) {
314
            throw new RoleNotFound($identifier, $status);
315
        }
316
317
        $role = $this->mapper->mapRole($data);
318
        foreach ($role->policies as $policy) {
319
            $this->limitationConverter->toSPI($policy);
320
        }
321
322
        return $role;
323
    }
324
325
    /**
326
     * Loads a role draft by the original role ID.
@@ 334-348 (lines=15) @@
331
     *
332
     * @return \eZ\Publish\SPI\Persistence\User\Role
333
     */
334
    public function loadRoleDraftByRoleId($roleId)
335
    {
336
        $data = $this->roleGateway->loadRoleDraftByRoleId($roleId);
337
338
        if (empty($data)) {
339
            throw new RoleNotFound($roleId, Role::STATUS_DRAFT);
340
        }
341
342
        $role = $this->mapper->mapRole($data);
343
        foreach ($role->policies as $policy) {
344
            $this->limitationConverter->toSPI($policy);
345
        }
346
347
        return $role;
348
    }
349
350
    /**
351
     * Loads all roles.