Code Duplication    Length = 6-11 lines in 3 locations

Core/Executor/UserGroupManager.php 2 locations

@@ 63-71 (lines=9) @@
60
61
        $userGroup = $userService->createUserGroup($userGroupCreateStruct, $parentGroup);
62
63
        if (isset($step->dsl['roles'])) {
64
            $roleService = $this->repository->getRoleService();
65
            // we support both Ids and Identifiers
66
            foreach ($step->dsl['roles'] as $roleId) {
67
                $roleId = $this->referenceResolver->resolveReference($roleId);
68
                $role = $this->roleMatcher->matchOneByKey($roleId);
69
                $roleService->assignRoleToUserGroup($role, $userGroup);
70
            }
71
        }
72
73
        $this->setReferences($userGroup, $step);
74
@@ 127-137 (lines=11) @@
124
125
            $userGroup = $userService->updateUserGroup($userGroup, $updateStruct);
126
127
            if (isset($step->dsl['parent_group_id'])) {
128
                $parentGroupId = $step->dsl['parent_group_id'];
129
                $parentGroupId = $this->referenceResolver->resolveReference($parentGroupId);
130
                $newParentGroup = $this->userGroupMatcher->matchOneByKey($parentGroupId);
131
132
                // Move group to new parent
133
                $userService->moveUserGroup($userGroup, $newParentGroup);
134
135
                // reload user group to be able to set refs correctly
136
                $userGroup = $userService->loadUserGroup($userGroup->id);
137
            }
138
139
            if (isset($step->dsl['section'])) {
140
                $this->setSection($userGroup, $step->dsl['section']);

Core/Executor/RoleManager.php 1 location

@@ 94-99 (lines=6) @@
91
        foreach ($roleCollection as $key => $role) {
92
93
            // Updating role name
94
            if (isset($step->dsl['new_name'])) {
95
                $update = $roleService->newRoleUpdateStruct();
96
                $newRoleName = $this->referenceResolver->resolveReference($step->dsl['new_name']);
97
                $update->identifier = $this->referenceResolver->resolveReference($newRoleName);
98
                $role = $roleService->updateRole($role, $update);
99
            }
100
101
            if (isset($step->dsl['policies'])) {
102
                $ymlPolicies = $step->dsl['policies'];