Code Duplication    Length = 26-28 lines in 3 locations

src/Event/Event.php 1 location

@@ 258-283 (lines=26) @@
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
        // Just clear typical age range.
279
        $this->typicalAgeRange = null;
280
281
        $this->importWorkflowStatus($udb2Event);
282
        $this->labels = LabelCollection::fromKeywords($udb2Event->getKeywords(true));
283
    }
284
285
    /**
286
     * Update the major info.

src/Place/Place.php 2 locations

@@ 267-294 (lines=28) @@
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
        // Just clear typical age range.
290
        $this->typicalAgeRange = null;
291
292
        $this->importWorkflowStatus($udb2Actor);
293
        $this->labels = LabelCollection::fromKeywords($udb2Actor->getKeywords(true));
294
    }
295
296
    /**
297
     * @param PlaceUpdatedFromUDB2 $placeUpdatedFromUDB2
@@ 299-325 (lines=27) @@
296
    /**
297
     * @param PlaceUpdatedFromUDB2 $placeUpdatedFromUDB2
298
     */
299
    public function applyPlaceUpdatedFromUDB2(
300
        PlaceUpdatedFromUDB2 $placeUpdatedFromUDB2
301
    ) {
302
        // Note: when updating from UDB2 never change the main language.
303
304
        $udb2Actor = ActorItemFactory::createActorFromCdbXml(
305
            $placeUpdatedFromUDB2->getCdbXmlNamespaceUri(),
306
            $placeUpdatedFromUDB2->getCdbXml()
307
        );
308
309
        // Just clear the facilities.
310
        $this->facilities = [];
311
312
        // Just clear the contact point.
313
        $this->contactPoint = null;
314
315
        // Just clear the calendar.
316
        $this->calendar = null;
317
318
        // Just clear typical age range.
319
        $this->typicalAgeRange = null;
320
321
        $this->importWorkflowStatus($udb2Actor);
322
        $this->labels = LabelCollection::fromKeywords($udb2Actor->getKeywords(true));
323
324
        unset($this->addresses[$this->mainLanguage->getCode()]);
325
    }
326
327
    /**
328
     * @inheritdoc