Code Duplication    Length = 11-12 lines in 3 locations

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

@@ 36-46 (lines=11) @@
33
    /**
34
     * @param RoleRenamed $roleRenamed
35
     */
36
    protected function applyRoleRenamed(RoleRenamed $roleRenamed)
37
    {
38
        $document = $this->loadDocumentFromRepositoryByUuid(
39
            $roleRenamed->getUuid()->toNative()
40
        );
41
42
        $json = $document->getBody();
43
        $json->name = $roleRenamed->getName()->toNative();
44
45
        $this->repository->save($document->withBody($json));
46
    }
47
48
    /**
49
     * @param RoleDeleted $roleDeleted
@@ 79-90 (lines=12) @@
76
    /**
77
     * @param ConstraintUpdated $constraintUpdated
78
     */
79
    protected function applyConstraintUpdated(
80
        ConstraintUpdated $constraintUpdated
81
    ) {
82
        $document = $this->loadDocumentFromRepositoryByUuid(
83
            $constraintUpdated->getUuid()->toNative()
84
        );
85
86
        $json = $document->getBody();
87
        $json->constraints->{$constraintUpdated->getSapiVersion()->toNative()} = $constraintUpdated->getQuery()->toNative();
88
89
        $this->repository->save($document->withBody($json));
90
    }
91
92
    /**
93
     * @param ConstraintRemoved $constraintRemoved
@@ 95-106 (lines=12) @@
92
    /**
93
     * @param ConstraintRemoved $constraintRemoved
94
     */
95
    protected function applyConstraintRemoved(
96
        ConstraintRemoved $constraintRemoved
97
    ) {
98
        $document = $this->loadDocumentFromRepositoryByUuid(
99
            $constraintRemoved->getUuid()->toNative()
100
        );
101
102
        $json = $document->getBody();
103
        $json->constraints->{$constraintRemoved->getSapiVersion()->toNative()} = null;
104
105
        $this->repository->save($document->withBody($json));
106
    }
107
108
    /**
109
     * @param PermissionAdded $permissionAdded