Code Duplication    Length = 11-16 lines in 2 locations

src/Label/ReadModels/Relations/Projector.php 2 locations

@@ 45-60 (lines=16) @@
42
    /**
43
     * @inheritdoc
44
     */
45
    public function applyLabelAdded($labelAdded, Metadata $metadata)
46
    {
47
        $LabelRelation = $this->createLabelRelation($labelAdded, $metadata);
48
49
        try {
50
            if (!is_null($LabelRelation)) {
51
                $this->writeRepository->save(
52
                    $LabelRelation->getUuid(),
53
                    $LabelRelation->getRelationType(),
54
                    $LabelRelation->getRelationId()
55
                );
56
            }
57
        } catch (UniqueConstraintViolationException $exception) {
58
            // By design to catch unique exception.
59
        }
60
    }
61
62
    /**
63
     * @inheritdoc
@@ 65-75 (lines=11) @@
62
    /**
63
     * @inheritdoc
64
     */
65
    public function applyLabelDeleted($labelDeleted, Metadata $metadata)
66
    {
67
        $labelRelation = $this->createLabelRelation($labelDeleted, $metadata);
68
69
        if (!is_null($labelRelation)) {
70
            $this->writeRepository->deleteByUuidAndRelationId(
71
                $labelRelation->getUuid(),
72
                new StringLiteral($labelDeleted->getItemId())
73
            );
74
        }
75
    }
76
77
    /**
78
     * @param OfferAbstractLabelEvent|OrganizerAbstractLabelEvent $labelEvent