Code Duplication    Length = 6-11 lines in 4 locations

Core/Executor/ContentTypeManager.php 1 location

@@ 408-418 (lines=11) @@
405
406
        if (is_array($value)) {
407
            $ret = array();
408
            foreach ($value as $key => $val)
409
            {
410
                $ret[$key] = $val;
411
412
                // we do NOT check for refs in field settings which are arrays, even though we could, maybe *should*...
413
                if (!is_array($val)) {
414
                    if ($this->referenceResolver->isReference($val)) {
415
                        $ret[$key] = $this->referenceResolver->getReferenceValue($val);
416
                    }
417
                }
418
            }
419
        }
420
        else {
421
            $ret = $value;

Core/Executor/RoleManager.php 1 location

@@ 164-169 (lines=6) @@
161
162
        $limitationValue = is_array($limitation['values']) ? $limitation['values'] : array($limitation['values']);
163
164
        foreach($limitationValue as $id => $value) {
165
            if ($this->referenceResolver->isReference($value)) {
166
                $value = $this->referenceResolver->getReferenceValue($value);
167
                $limitationValue[$id] = $value;
168
            }
169
        }
170
        $limitationValue = $this->roleHandler->convertLimitationToValue($limitation['identifier'], $limitationValue);
171
        return $limitationType->buildValue($limitationValue);
172
    }

Core/Executor/UserGroupManager.php 1 location

@@ 135-143 (lines=9) @@
132
            $groupIds = array($groupIds);
133
        }
134
135
        foreach($groupIds as $groupId) {
136
137
            if ($this->referenceResolver->isReference($groupId)) {
138
                $groupId = $this->referenceResolver->getReferenceValue($groupId);
139
            }
140
141
            $userGroup = $userService->loadUserGroup($groupId);
142
            $userService->deleteUserGroup($userGroup);
143
        }
144
    }
145
146
    /**

Core/Executor/ContentManager.php 1 location

@@ 72-79 (lines=8) @@
69
        $locations = array($locationCreateStruct);
70
71
        if (array_key_exists('other_locations', $this->dsl)) {
72
            foreach ($this->dsl['other_locations'] as $otherLocation) {
73
                $locationId = $otherLocation;
74
                if ($this->referenceResolver->isReference($locationId)) {
75
                    $locationId = $this->referenceResolver->getReferenceValue($otherLocation);
76
                }
77
                $secondaryLocationCreateStruct = $locationService->newLocationCreateStruct($locationId);
78
                array_push($locations, $secondaryLocationCreateStruct);
79
            }
80
        }
81
82
        // create a draft using the content and location create struct and publish it