Code Duplication    Length = 23-23 lines in 2 locations

eZ/Publish/Core/Event/RoleService.php 2 locations

@@ 374-396 (lines=23) @@
371
        );
372
    }
373
374
    public function assignRoleToUserGroup(
375
        Role $role,
376
        UserGroup $userGroup,
377
        RoleLimitation $roleLimitation = null
378
    ) {
379
        $eventData = [
380
            $role,
381
            $userGroup,
382
            $roleLimitation,
383
        ];
384
385
        $beforeEvent = new BeforeAssignRoleToUserGroupEvent(...$eventData);
386
        if ($this->eventDispatcher->dispatch(RoleEvents::BEFORE_ASSIGN_ROLE_TO_USER_GROUP, $beforeEvent)->isPropagationStopped()) {
387
            return;
388
        }
389
390
        parent::assignRoleToUserGroup($role, $userGroup, $roleLimitation);
391
392
        $this->eventDispatcher->dispatch(
393
            RoleEvents::ASSIGN_ROLE_TO_USER_GROUP,
394
            new AssignRoleToUserGroupEvent(...$eventData)
395
        );
396
    }
397
398
    public function unassignRoleFromUserGroup(
399
        Role $role,
@@ 420-442 (lines=23) @@
417
        );
418
    }
419
420
    public function assignRoleToUser(
421
        Role $role,
422
        User $user,
423
        RoleLimitation $roleLimitation = null
424
    ) {
425
        $eventData = [
426
            $role,
427
            $user,
428
            $roleLimitation,
429
        ];
430
431
        $beforeEvent = new BeforeAssignRoleToUserEvent(...$eventData);
432
        if ($this->eventDispatcher->dispatch(RoleEvents::BEFORE_ASSIGN_ROLE_TO_USER, $beforeEvent)->isPropagationStopped()) {
433
            return;
434
        }
435
436
        parent::assignRoleToUser($role, $user, $roleLimitation);
437
438
        $this->eventDispatcher->dispatch(
439
            RoleEvents::ASSIGN_ROLE_TO_USER,
440
            new AssignRoleToUserEvent(...$eventData)
441
        );
442
    }
443
444
    public function unassignRoleFromUser(
445
        Role $role,