Code Duplication    Length = 27-27 lines in 2 locations

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

@@ 140-166 (lines=27) @@
137
        return $locations;
138
    }
139
140
    public function createContentDraft(
141
        ContentInfo $contentInfo,
142
        VersionInfo $versionInfo = null,
143
        User $creator = null
144
    ): Content {
145
        $eventData = [
146
            $contentInfo,
147
            $versionInfo,
148
            $creator,
149
        ];
150
151
        $beforeEvent = new BeforeCreateContentDraftEvent(...$eventData);
152
        if ($this->eventDispatcher->dispatch(ContentEvents::BEFORE_CREATE_CONTENT_DRAFT, $beforeEvent)->isPropagationStopped()) {
153
            return $beforeEvent->getContentDraft();
154
        }
155
156
        $contentDraft = $beforeEvent->hasContentDraft()
157
            ? $beforeEvent->getContentDraft()
158
            : parent::createContentDraft($contentInfo, $versionInfo, $creator);
159
160
        $this->eventDispatcher->dispatch(
161
            ContentEvents::CREATE_CONTENT_DRAFT,
162
            new CreateContentDraftEvent($contentDraft, ...$eventData)
163
        );
164
165
        return $contentDraft;
166
    }
167
168
    public function updateContent(
169
        VersionInfo $versionInfo,
@@ 232-258 (lines=27) @@
229
        );
230
    }
231
232
    public function copyContent(
233
        ContentInfo $contentInfo,
234
        LocationCreateStruct $destinationLocationCreateStruct,
235
        VersionInfo $versionInfo = null
236
    ): Content {
237
        $eventData = [
238
            $contentInfo,
239
            $destinationLocationCreateStruct,
240
            $versionInfo,
241
        ];
242
243
        $beforeEvent = new BeforeCopyContentEvent(...$eventData);
244
        if ($this->eventDispatcher->dispatch(ContentEvents::BEFORE_COPY_CONTENT, $beforeEvent)->isPropagationStopped()) {
245
            return $beforeEvent->getContent();
246
        }
247
248
        $content = $beforeEvent->hasContent()
249
            ? $beforeEvent->getContent()
250
            : parent::copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo);
251
252
        $this->eventDispatcher->dispatch(
253
            ContentEvents::COPY_CONTENT,
254
            new CopyContentEvent($content, ...$eventData)
255
        );
256
257
        return $content;
258
    }
259
260
    public function addRelation(
261
        VersionInfo $sourceVersion,