Code Duplication    Length = 11-12 lines in 4 locations

src/Event/EventLDProjector.php 2 locations

@@ 725-736 (lines=12) @@
722
     *
723
     * @param ImageAdded $imageAdded
724
     */
725
    protected function applyImageAdded(ImageAdded $imageAdded)
726
    {
727
728
        $document = $this->loadDocumentFromRepository($imageAdded);
729
730
        $eventLd = $document->getBody();
731
        $eventLd->mediaObject = isset($eventLd->mediaObject) ? $eventLd->mediaObject : [];
732
        $eventLd->mediaObject[] = $imageAdded->getMediaObject()->toJsonLd();
733
734
        $this->repository->save($document->withBody($eventLd));
735
736
    }
737
738
    /**
739
     * Apply the ImageUpdated event to the event repository.
@@ 743-754 (lines=12) @@
740
     *
741
     * @param ImageUpdated $imageUpdated
742
     */
743
    protected function applyImageUpdated(ImageUpdated $imageUpdated)
744
    {
745
746
        $document = $this->loadDocumentFromRepository($imageUpdated);
747
748
        $eventLd = $document->getBody();
749
        $eventLd->mediaObject = isset($eventLd->mediaObject) ? $eventLd->mediaObject : [];
750
        $eventLd->mediaObject[$imageUpdated->getIndexToUpdate()] = $imageUpdated->getMediaObject()->toJsonLd();
751
752
        $this->repository->save($document->withBody($eventLd));
753
754
    }
755
756
    /**
757
     * Apply the imageDeleted event to the event repository.

src/Place/ReadModel/JSONLD/PlaceLDProjector.php 2 locations

@@ 376-387 (lines=12) @@
373
     *
374
     * @param ImageAdded $imageAdded
375
     */
376
    protected function applyImageAdded(ImageAdded $imageAdded)
377
    {
378
379
        $document = $this->loadPlaceDocumentFromRepository($imageAdded);
380
381
        $placeLd = $document->getBody();
382
        $placeLd->mediaObject = isset($placeLd->mediaObject) ? $placeLd->mediaObject : [];
383
        $placeLd->mediaObject[] = $imageAdded->getMediaObject()->toJsonLd();
384
385
        $this->repository->save($document->withBody($placeLd));
386
387
    }
388
389
    /**
390
     * Apply the ImageUpdated event to the place repository.
@@ 394-404 (lines=11) @@
391
     *
392
     * @param ImageUpdated $imageUpdated
393
     */
394
    protected function applyImageUpdated(ImageUpdated $imageUpdated)
395
    {
396
397
        $document = $this->loadPlaceDocumentFromRepository($imageUpdated);
398
399
        $placeLd = $document->getBody();
400
        $placeLd->mediaObject = isset($placeLd->mediaObject) ? $placeLd->mediaObject : [];
401
        $placeLd->mediaObject[$imageUpdated->getIndexToUpdate()] = $imageUpdated->getMediaObject()->toJsonLd();
402
403
        $this->repository->save($document->withBody($placeLd));
404
    }
405
406
    /**
407
     * Apply the imageDeleted event to the place repository.