Code Duplication    Length = 12-12 lines in 3 locations

eZ/Publish/Core/Repository/RoleService.php 3 locations

@@ 196-207 (lines=12) @@
193
     *
194
     * @return \eZ\Publish\API\Repository\Values\User\RoleDraft
195
     */
196
    public function loadRoleDraft($id)
197
    {
198
        $spiRole = $this->userHandler->loadRole($id, Role::STATUS_DRAFT);
199
200
        $role = $this->roleDomainMapper->buildDomainRoleDraftObject($spiRole);
201
202
        if (!$this->permissionResolver->canUser('role', 'read', $role)) {
203
            throw new UnauthorizedException('role', 'read');
204
        }
205
206
        return $role;
207
    }
208
209
    /**
210
     * Loads a RoleDraft by the ID of the role it was created from.
@@ 219-230 (lines=12) @@
216
     *
217
     * @return \eZ\Publish\API\Repository\Values\User\RoleDraft
218
     */
219
    public function loadRoleDraftByRoleId($roleId)
220
    {
221
        $spiRole = $this->userHandler->loadRoleDraftByRoleId($roleId);
222
223
        $role = $this->roleDomainMapper->buildDomainRoleDraftObject($spiRole);
224
225
        if (!$this->permissionResolver->canUser('role', 'read', $role)) {
226
            throw new UnauthorizedException('role', 'read');
227
        }
228
229
        return $role;
230
    }
231
232
    /**
233
     * Updates the properties of a RoleDraft.
@@ 543-554 (lines=12) @@
540
     *
541
     * @return \eZ\Publish\API\Repository\Values\User\Role
542
     */
543
    public function loadRole($id)
544
    {
545
        $spiRole = $this->userHandler->loadRole($id);
546
547
        $role = $this->roleDomainMapper->buildDomainRoleObject($spiRole);
548
549
        if (!$this->permissionResolver->canUser('role', 'read', $role)) {
550
            throw new UnauthorizedException('role', 'read');
551
        }
552
553
        return $role;
554
    }
555
556
    /**
557
     * Loads a role for the given identifier.