Code Duplication    Length = 13-15 lines in 2 locations

src/Role/ReadModel/Detail/Projector.php 2 locations

@@ 59-73 (lines=15) @@
56
    /**
57
     * @param ConstraintAdded $constraintAdded
58
     */
59
    protected function applyConstraintAdded(
60
        ConstraintAdded $constraintAdded
61
    ) {
62
        $document = $this->loadDocumentFromRepositoryByUuid(
63
            $constraintAdded->getUuid()->toNative()
64
        );
65
66
        $json = $document->getBody();
67
        $json->constraint = $constraintAdded->getQuery()->toNative();
68
69
        $json->constraints = new \stdClass();
70
        $json->constraints->{$constraintAdded->getSapiVersion()->toNative()} = $constraintAdded->getQuery()->toNative();
71
72
        $this->repository->save($document->withBody($json));
73
    }
74
75
    /**
76
     * @param ConstraintUpdated $constraintUpdated
@@ 78-90 (lines=13) @@
75
    /**
76
     * @param ConstraintUpdated $constraintUpdated
77
     */
78
    protected function applyConstraintUpdated(
79
        ConstraintUpdated $constraintUpdated
80
    ) {
81
        $document = $this->loadDocumentFromRepositoryByUuid(
82
            $constraintUpdated->getUuid()->toNative()
83
        );
84
85
        $json = $document->getBody();
86
        $json->constraint = $constraintUpdated->getQuery()->toNative();
87
        $json->constraints->{$constraintUpdated->getSapiVersion()->toNative()} = $constraintUpdated->getQuery()->toNative();
88
89
        $this->repository->save($document->withBody($json));
90
    }
91
92
    /**
93
     * @param ConstraintRemoved $constraintRemoved