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

@@ 401-412 (lines=12) @@
398
     *
399
     * @param ImageAdded $imageAdded
400
     */
401
    protected function applyImageAdded(ImageAdded $imageAdded)
402
    {
403
404
        $document = $this->loadPlaceDocumentFromRepository($imageAdded);
405
406
        $placeLd = $document->getBody();
407
        $placeLd->mediaObject = isset($placeLd->mediaObject) ? $placeLd->mediaObject : [];
408
        $placeLd->mediaObject[] = $imageAdded->getMediaObject()->toJsonLd();
409
410
        $this->repository->save($document->withBody($placeLd));
411
412
    }
413
414
    /**
415
     * Apply the ImageUpdated event to the place repository.
@@ 419-429 (lines=11) @@
416
     *
417
     * @param ImageUpdated $imageUpdated
418
     */
419
    protected function applyImageUpdated(ImageUpdated $imageUpdated)
420
    {
421
422
        $document = $this->loadPlaceDocumentFromRepository($imageUpdated);
423
424
        $placeLd = $document->getBody();
425
        $placeLd->mediaObject = isset($placeLd->mediaObject) ? $placeLd->mediaObject : [];
426
        $placeLd->mediaObject[$imageUpdated->getIndexToUpdate()] = $imageUpdated->getMediaObject()->toJsonLd();
427
428
        $this->repository->save($document->withBody($placeLd));
429
    }
430
431
    /**
432
     * Apply the imageDeleted event to the place repository.