Code Duplication    Length = 24-24 lines in 4 locations

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

@@ 342-365 (lines=24) @@
339
        );
340
    }
341
342
    public function updateFieldDefinition(
343
        ContentTypeDraft $contentTypeDraft,
344
        FieldDefinition $fieldDefinition,
345
        FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct
346
    ): void {
347
        $eventData = [
348
            $contentTypeDraft,
349
            $fieldDefinition,
350
            $fieldDefinitionUpdateStruct,
351
        ];
352
353
        $beforeEvent = new BeforeUpdateFieldDefinitionEvent(...$eventData);
354
355
        $this->eventDispatcher->dispatch($beforeEvent);
356
        if ($beforeEvent->isPropagationStopped()) {
357
            return;
358
        }
359
360
        $this->innerService->updateFieldDefinition($contentTypeDraft, $fieldDefinition, $fieldDefinitionUpdateStruct);
361
362
        $this->eventDispatcher->dispatch(
363
            new UpdateFieldDefinitionEvent(...$eventData)
364
        );
365
    }
366
367
    public function publishContentTypeDraft(ContentTypeDraft $contentTypeDraft): void
368
    {

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

@@ 214-237 (lines=24) @@
211
        );
212
    }
213
214
    public function setContentState(
215
        ContentInfo $contentInfo,
216
        ObjectStateGroup $objectStateGroup,
217
        ObjectState $objectState
218
    ): void {
219
        $eventData = [
220
            $contentInfo,
221
            $objectStateGroup,
222
            $objectState,
223
        ];
224
225
        $beforeEvent = new BeforeSetContentStateEvent(...$eventData);
226
227
        $this->eventDispatcher->dispatch($beforeEvent);
228
        if ($beforeEvent->isPropagationStopped()) {
229
            return;
230
        }
231
232
        $this->innerService->setContentState($contentInfo, $objectStateGroup, $objectState);
233
234
        $this->eventDispatcher->dispatch(
235
            new SetContentStateEvent(...$eventData)
236
        );
237
    }
238
}
239

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

@@ 272-295 (lines=24) @@
269
        );
270
    }
271
272
    public function assignRoleToUserGroup(
273
        Role $role,
274
        UserGroup $userGroup,
275
        RoleLimitation $roleLimitation = null
276
    ): void {
277
        $eventData = [
278
            $role,
279
            $userGroup,
280
            $roleLimitation,
281
        ];
282
283
        $beforeEvent = new BeforeAssignRoleToUserGroupEvent(...$eventData);
284
285
        $this->eventDispatcher->dispatch($beforeEvent);
286
        if ($beforeEvent->isPropagationStopped()) {
287
            return;
288
        }
289
290
        $this->innerService->assignRoleToUserGroup($role, $userGroup, $roleLimitation);
291
292
        $this->eventDispatcher->dispatch(
293
            new AssignRoleToUserGroupEvent(...$eventData)
294
        );
295
    }
296
297
    public function assignRoleToUser(
298
        Role $role,
@@ 297-320 (lines=24) @@
294
        );
295
    }
296
297
    public function assignRoleToUser(
298
        Role $role,
299
        User $user,
300
        RoleLimitation $roleLimitation = null
301
    ): void {
302
        $eventData = [
303
            $role,
304
            $user,
305
            $roleLimitation,
306
        ];
307
308
        $beforeEvent = new BeforeAssignRoleToUserEvent(...$eventData);
309
310
        $this->eventDispatcher->dispatch($beforeEvent);
311
        if ($beforeEvent->isPropagationStopped()) {
312
            return;
313
        }
314
315
        $this->innerService->assignRoleToUser($role, $user, $roleLimitation);
316
317
        $this->eventDispatcher->dispatch(
318
            new AssignRoleToUserEvent(...$eventData)
319
        );
320
    }
321
322
    public function removeRoleAssignment(RoleAssignment $roleAssignment): void
323
    {