Code Duplication    Length = 23-25 lines in 3 locations

src/Event/Event.php 1 location

@@ 258-280 (lines=23) @@
255
    /**
256
     * @param EventCdbXMLInterface $eventCdbXML
257
     */
258
    protected function setUDB2Data(
259
        EventCdbXMLInterface $eventCdbXML
260
    ) {
261
        $udb2Event = EventItemFactory::createEventFromCdbXml(
262
            $eventCdbXML->getCdbXmlNamespaceUri(),
263
            $eventCdbXML->getCdbXml()
264
        );
265
266
        // Just clear the facilities.
267
        $this->facilities = [];
268
269
        // Just clear the location id after an import or update.
270
        $this->locationId = null;
271
272
        // Just clear the contact point.
273
        $this->contactPoint = null;
274
275
        // Just clear the calendar.
276
        $this->calendar = null;
277
278
        $this->importWorkflowStatus($udb2Event);
279
        $this->labels = LabelCollection::fromKeywords($udb2Event->getKeywords(true));
280
    }
281
282
    /**
283
     * Update the major info.

src/Place/Place.php 2 locations

@@ 267-291 (lines=25) @@
264
    /**
265
     * @param PlaceImportedFromUDB2 $placeImported
266
     */
267
    public function applyPlaceImportedFromUDB2(
268
        PlaceImportedFromUDB2 $placeImported
269
    ) {
270
        $this->placeId = $placeImported->getActorId();
271
272
        // When importing from UDB2 the default main language is always 'nl'.
273
        $this->mainLanguage = new Language('nl');
274
275
        $udb2Actor = ActorItemFactory::createActorFromCdbXml(
276
            $placeImported->getCdbXmlNamespaceUri(),
277
            $placeImported->getCdbXml()
278
        );
279
280
        // Just clear the facilities.
281
        $this->facilities = [];
282
283
        // Just clear the contact point.
284
        $this->contactPoint = null;
285
286
        // Just clear the calendar.
287
        $this->calendar = null;
288
289
        $this->importWorkflowStatus($udb2Actor);
290
        $this->labels = LabelCollection::fromKeywords($udb2Actor->getKeywords(true));
291
    }
292
293
    /**
294
     * @param PlaceUpdatedFromUDB2 $placeUpdatedFromUDB2
@@ 296-319 (lines=24) @@
293
    /**
294
     * @param PlaceUpdatedFromUDB2 $placeUpdatedFromUDB2
295
     */
296
    public function applyPlaceUpdatedFromUDB2(
297
        PlaceUpdatedFromUDB2 $placeUpdatedFromUDB2
298
    ) {
299
        // Note: when updating from UDB2 never change the main language.
300
301
        $udb2Actor = ActorItemFactory::createActorFromCdbXml(
302
            $placeUpdatedFromUDB2->getCdbXmlNamespaceUri(),
303
            $placeUpdatedFromUDB2->getCdbXml()
304
        );
305
306
        // Just clear the facilities.
307
        $this->facilities = [];
308
309
        // Just clear the contact point.
310
        $this->contactPoint = null;
311
312
        // Just clear the calendar.
313
        $this->calendar = null;
314
315
        $this->importWorkflowStatus($udb2Actor);
316
        $this->labels = LabelCollection::fromKeywords($udb2Actor->getKeywords(true));
317
318
        unset($this->addresses[$this->mainLanguage->getCode()]);
319
    }
320
321
    /**
322
     * @inheritdoc