Code Duplication    Length = 21-22 lines in 2 locations

src/ReadModel/Index/Projector.php 2 locations

@@ 291-312 (lines=22) @@
288
     * @param EventCreated $eventCreated
289
     * @param DomainMessage $domainMessage
290
     */
291
    protected function applyEventCreated(EventCreated $eventCreated, DomainMessage $domainMessage)
292
    {
293
294
        $eventId = $eventCreated->getEventId();
295
296
        $metaData = $domainMessage->getMetadata()->serialize();
297
        $userId = isset($metaData['user_id']) ? $metaData['user_id'] : '';
298
299
        $location = $eventCreated->getLocation();
300
301
        $creationDate = new DateTime('now', new DateTimeZone('Europe/Brussels'));
302
303
        $this->updateIndex(
304
            $eventId,
305
            EntityType::EVENT(),
306
            $userId,
307
            $eventCreated->getTitle(),
308
            $location->getAddress()->getPostalCode(),
309
            $this->localDomain,
310
            $creationDate
311
        );
312
    }
313
314
    /**
315
     * Listener for place created commands.
@@ 319-339 (lines=21) @@
316
     * @param PlaceCreated $placeCreated
317
     * @param DomainMessage $domainMessage
318
     */
319
    protected function applyPlaceCreated(PlaceCreated $placeCreated, DomainMessage $domainMessage)
320
    {
321
322
        $placeId = $placeCreated->getPlaceId();
323
324
        $metaData = $domainMessage->getMetadata()->serialize();
325
        $userId = isset($metaData['user_id']) ? $metaData['user_id'] : '';
326
327
        $address = $placeCreated->getAddress();
328
329
        $creationDate = new DateTime('now', new DateTimeZone('Europe/Brussels'));
330
        $this->updateIndex(
331
            $placeId,
332
            EntityType::PLACE(),
333
            $userId,
334
            $placeCreated->getTitle(),
335
            $address->getPostalCode(),
336
            $this->localDomain,
337
            $creationDate
338
        );
339
    }
340
341
    /**
342
     * @param $dateString