Code Duplication    Length = 23-23 lines in 2 locations

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

@@ 356-378 (lines=23) @@
353
        );
354
    }
355
356
    public function assignRoleToUserGroup(
357
        Role $role,
358
        UserGroup $userGroup,
359
        RoleLimitation $roleLimitation = null
360
    ) {
361
        $eventData = [
362
            $role,
363
            $userGroup,
364
            $roleLimitation,
365
        ];
366
367
        $beforeEvent = new BeforeAssignRoleToUserGroupEvent(...$eventData);
368
        if ($this->eventDispatcher->dispatch(RoleEvents::BEFORE_ASSIGN_ROLE_TO_USER_GROUP, $beforeEvent)->isPropagationStopped()) {
369
            return;
370
        } else {
371
            parent::assignRoleToUserGroup($role, $userGroup, $roleLimitation);
372
        }
373
374
        $this->eventDispatcher->dispatch(
375
            RoleEvents::ASSIGN_ROLE_TO_USER_GROUP,
376
            new AssignRoleToUserGroupEvent(...$eventData)
377
        );
378
    }
379
380
    public function unassignRoleFromUserGroup(
381
        Role $role,
@@ 402-424 (lines=23) @@
399
        );
400
    }
401
402
    public function assignRoleToUser(
403
        Role $role,
404
        User $user,
405
        RoleLimitation $roleLimitation = null
406
    ) {
407
        $eventData = [
408
            $role,
409
            $user,
410
            $roleLimitation,
411
        ];
412
413
        $beforeEvent = new BeforeAssignRoleToUserEvent(...$eventData);
414
        if ($this->eventDispatcher->dispatch(RoleEvents::BEFORE_ASSIGN_ROLE_TO_USER, $beforeEvent)->isPropagationStopped()) {
415
            return;
416
        } else {
417
            parent::assignRoleToUser($role, $user, $roleLimitation);
418
        }
419
420
        $this->eventDispatcher->dispatch(
421
            RoleEvents::ASSIGN_ROLE_TO_USER,
422
            new AssignRoleToUserEvent(...$eventData)
423
        );
424
    }
425
426
    public function unassignRoleFromUser(
427
        Role $role,