Code Duplication    Length = 20-20 lines in 4 locations

eZ/Publish/Core/Event/ContentTypeService.php 1 location

@@ 294-313 (lines=20) @@
291
        $this->eventDispatcher->dispatch(new RemoveFieldDefinitionEvent(...$eventData));
292
    }
293
294
    public function updateFieldDefinition(
295
        ContentTypeDraft $contentTypeDraft,
296
        FieldDefinition $fieldDefinition,
297
        FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct
298
    ): void {
299
        $eventData = [
300
            $contentTypeDraft,
301
            $fieldDefinition,
302
            $fieldDefinitionUpdateStruct,
303
        ];
304
305
        $beforeEvent = new BeforeUpdateFieldDefinitionEvent(...$eventData);
306
        if ($this->eventDispatcher->dispatch($beforeEvent)->isPropagationStopped()) {
307
            return;
308
        }
309
310
        $this->innerService->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct);
311
312
        $this->eventDispatcher->dispatch(new UpdateFieldDefinitionEvent(...$eventData));
313
    }
314
315
    public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft): void
316
    {

eZ/Publish/Core/Event/ObjectStateService.php 1 location

@@ 186-205 (lines=20) @@
183
        $this->eventDispatcher->dispatch(new DeleteObjectStateEvent(...$eventData));
184
    }
185
186
    public function setContentState(
187
        ContentInfo $contentInfo,
188
        ObjectStateGroup $objectStateGroup,
189
        ObjectState $objectState
190
    ): void {
191
        $eventData = [
192
            $contentInfo,
193
            $objectStateGroup,
194
            $objectState,
195
        ];
196
197
        $beforeEvent = new BeforeSetContentStateEvent(...$eventData);
198
        if ($this->eventDispatcher->dispatch($beforeEvent)->isPropagationStopped()) {
199
            return;
200
        }
201
202
        $this->innerService->setContentState($contentInfo, $objectStateGroup, $objectState);
203
204
        $this->eventDispatcher->dispatch(new SetContentStateEvent(...$eventData));
205
    }
206
}
207

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

@@ 332-351 (lines=20) @@
329
        $this->eventDispatcher->dispatch(new DeleteRoleEvent(...$eventData));
330
    }
331
332
    public function assignRoleToUserGroup(
333
        Role $role,
334
        UserGroup $userGroup,
335
        RoleLimitation $roleLimitation = null
336
    ): void {
337
        $eventData = [
338
            $role,
339
            $userGroup,
340
            $roleLimitation,
341
        ];
342
343
        $beforeEvent = new BeforeAssignRoleToUserGroupEvent(...$eventData);
344
        if ($this->eventDispatcher->dispatch($beforeEvent)->isPropagationStopped()) {
345
            return;
346
        }
347
348
        $this->innerService->assignRoleToUserGroup($role, $userGroup, $roleLimitation);
349
350
        $this->eventDispatcher->dispatch(new AssignRoleToUserGroupEvent(...$eventData));
351
    }
352
353
    public function unassignRoleFromUserGroup(
354
        Role $role,
@@ 372-391 (lines=20) @@
369
        $this->eventDispatcher->dispatch(new UnassignRoleFromUserGroupEvent(...$eventData));
370
    }
371
372
    public function assignRoleToUser(
373
        Role $role,
374
        User $user,
375
        RoleLimitation $roleLimitation = null
376
    ): void {
377
        $eventData = [
378
            $role,
379
            $user,
380
            $roleLimitation,
381
        ];
382
383
        $beforeEvent = new BeforeAssignRoleToUserEvent(...$eventData);
384
        if ($this->eventDispatcher->dispatch($beforeEvent)->isPropagationStopped()) {
385
            return;
386
        }
387
388
        $this->innerService->assignRoleToUser($role, $user, $roleLimitation);
389
390
        $this->eventDispatcher->dispatch(new AssignRoleToUserEvent(...$eventData));
391
    }
392
393
    public function unassignRoleFromUser(
394
        Role $role,