Code Duplication    Length = 14-14 lines in 2 locations

eZ/Publish/Core/Repository/UserService.php 2 locations

@@ 249-262 (lines=14) @@
246
     *
247
     * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a user group
248
     */
249
    public function deleteUserGroup(APIUserGroup $userGroup)
250
    {
251
        $loadedUserGroup = $this->loadUserGroup($userGroup->id);
252
253
        $this->repository->beginTransaction();
254
        try {
255
            //@todo: what happens to sub user groups and users below sub user groups
256
            $this->repository->getContentService()->deleteContent($loadedUserGroup->getVersionInfo()->getContentInfo());
257
            $this->repository->commit();
258
        } catch (Exception $e) {
259
            $this->repository->rollback();
260
            throw $e;
261
        }
262
    }
263
264
    /**
265
     * Moves the user group to another parent.
@@ 644-657 (lines=14) @@
641
     *
642
     * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete the user
643
     */
644
    public function deleteUser(APIUser $user)
645
    {
646
        $loadedUser = $this->loadUser($user->id);
647
648
        $this->repository->beginTransaction();
649
        try {
650
            $this->repository->getContentService()->deleteContent($loadedUser->getVersionInfo()->getContentInfo());
651
            $this->userHandler->delete($loadedUser->id);
652
            $this->repository->commit();
653
        } catch (Exception $e) {
654
            $this->repository->rollback();
655
            throw $e;
656
        }
657
    }
658
659
    /**
660
     * Updates a user.