Code Duplication    Length = 16-16 lines in 2 locations

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

@@ 245-260 (lines=16) @@
242
     *
243
     * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a user group
244
     */
245
    public function deleteUserGroup(APIUserGroup $userGroup)
246
    {
247
        $loadedUserGroup = $this->loadUserGroup($userGroup->id);
248
249
        $this->repository->beginTransaction();
250
        try {
251
            //@todo: what happens to sub user groups and users below sub user groups
252
            $affectedLocationIds = $this->repository->getContentService()->deleteContent($loadedUserGroup->getVersionInfo()->getContentInfo());
253
            $this->repository->commit();
254
        } catch (Exception $e) {
255
            $this->repository->rollback();
256
            throw $e;
257
        }
258
259
        return $affectedLocationIds;
260
    }
261
262
    /**
263
     * Moves the user group to another parent.
@@ 682-697 (lines=16) @@
679
     *
680
     * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete the user
681
     */
682
    public function deleteUser(APIUser $user)
683
    {
684
        $loadedUser = $this->loadUser($user->id);
685
686
        $this->repository->beginTransaction();
687
        try {
688
            $affectedLocationIds = $this->repository->getContentService()->deleteContent($loadedUser->getVersionInfo()->getContentInfo());
689
            $this->userHandler->delete($loadedUser->id);
690
            $this->repository->commit();
691
        } catch (Exception $e) {
692
            $this->repository->rollback();
693
            throw $e;
694
        }
695
696
        return $affectedLocationIds;
697
    }
698
699
    /**
700
     * Updates a user.