Code Duplication    Length = 18-18 lines in 2 locations

src/Kunstmaan/AdminBundle/Service/AclManager.php 1 location

@@ 42-59 (lines=18) @@
39
     * @param $originalNode
40
     * @param $nodeNewPage
41
     */
42
    public function updateNodeAcl(Node $originalNode, Node $nodeNewPage)
43
    {
44
        $originalIdentity = $this->objectIdentityRetrievalStrategy->getObjectIdentity($originalNode);
45
        $originalAcl = $this->aclProvider->findAcl($originalIdentity);
46
47
        $newIdentity = $this->objectIdentityRetrievalStrategy->getObjectIdentity($nodeNewPage);
48
        $newAcl = $this->aclProvider->createAcl($newIdentity);
49
50
        $aces = $originalAcl->getObjectAces();
51
        /* @var EntryInterface $ace */
52
        foreach ($aces as $ace) {
53
            $securityIdentity = $ace->getSecurityIdentity();
54
            if ($securityIdentity instanceof RoleSecurityIdentity) {
55
                $newAcl->insertObjectAce($securityIdentity, $ace->getMask());
56
            }
57
        }
58
        $this->aclProvider->updateAcl($newAcl);
59
    }
60
61
    /**
62
     * @param array  $nodes

src/Kunstmaan/NodeBundle/Helper/PageCloningHelper.php 1 location

@@ 127-144 (lines=18) @@
124
        return $nodeNewPage;
125
    }
126
127
    private function updateAcl($originalNode, $nodeNewPage): void
128
    {
129
        $originalIdentity = $this->identityRetrievalStrategy->getObjectIdentity($originalNode);
130
        $originalAcl = $this->aclProvider->findAcl($originalIdentity);
131
132
        $newIdentity = $this->identityRetrievalStrategy->getObjectIdentity($nodeNewPage);
133
        $newAcl = $this->aclProvider->createAcl($newIdentity);
134
135
        $aces = $originalAcl->getObjectAces();
136
        /* @var EntryInterface $ace */
137
        foreach ($aces as $ace) {
138
            $securityIdentity = $ace->getSecurityIdentity();
139
            if ($securityIdentity instanceof RoleSecurityIdentity) {
140
                $newAcl->insertObjectAce($securityIdentity, $ace->getMask());
141
            }
142
        }
143
        $this->aclProvider->updateAcl($newAcl);
144
    }
145
146
    private function cloneChildren(Node $originalNode, PageInterface $newPage, BaseUser $user, string $locale): void
147
    {