Code Duplication    Length = 21-24 lines in 5 locations

Core/Executor/ContentTypeGroupManager.php 1 location

@@ 124-147 (lines=24) @@
121
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
122
     * @return array key: the reference names, values: the reference values
123
     */
124
    protected function getReferencesValues($object, array $references, $step)
125
    {
126
        $refs = array();
127
128
        foreach ($references as $reference) {
129
130
            switch ($reference['attribute']) {
131
                case 'content_type_group_id':
132
                case 'id':
133
                    $value = $object->id;
134
                    break;
135
                case 'content_type_group_identifier':
136
                case 'identifier':
137
                    $value = $object->identifier;
138
                    break;
139
                default:
140
                    throw new \InvalidArgumentException('Content Type Group Manager does not support setting references for attribute ' . $reference['attribute']);
141
            }
142
143
            $refs[$reference['identifier']] = $value;
144
        }
145
146
        return $refs;
147
    }
148
149
    /**
150
     * @param array $matchCondition

Core/Executor/ObjectStateGroupManager.php 1 location

@@ 150-172 (lines=23) @@
147
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
148
     * @return array key: the reference names, values: the reference values
149
     */
150
    protected function getReferencesValues($objectStateGroup, array $references, $step)
151
    {
152
        $refs = array();
153
154
        foreach ($references as $reference) {
155
            switch ($reference['attribute']) {
156
                case 'object_state_group_id':
157
                case 'id':
158
                    $value = $objectStateGroup->id;
159
                    break;
160
                case 'object_state_group_identifier':
161
                case 'identifier':
162
                    $value = $objectStateGroup->id;
163
                    break;
164
                default:
165
                    throw new \InvalidArgumentException('Object State Group Manager does not support setting references for attribute ' . $reference['attribute']);
166
            }
167
168
            $refs[$reference['identifier']] = $value;
169
        }
170
171
        return $refs;
172
    }
173
174
    /**
175
     * @param array $matchCondition

Core/Executor/ObjectStateManager.php 1 location

@@ 168-189 (lines=22) @@
165
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
166
     * @return array key: the reference names, values: the reference values
167
     */
168
    protected function getReferencesValues($objectState, array $references, $step)
169
    {
170
        $refs = array();
171
172
        foreach ($references as $reference) {
173
            switch ($reference['attribute']) {
174
                case 'object_state_id':
175
                case 'id':
176
                    $value = $objectState->id;
177
                    break;
178
                case 'priority':
179
                    $value = $objectState->priority;
180
                    break;
181
                default:
182
                    throw new \InvalidArgumentException('Object State Manager does not support setting references for attribute ' . $reference['attribute']);
183
            }
184
185
            $refs[$reference['identifier']] = $value;
186
        }
187
188
        return $refs;
189
    }
190
191
    /**
192
     * @param array $matchCondition

Core/Executor/RoleManager.php 1 location

@@ 164-186 (lines=23) @@
161
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
162
     * @return array key: the reference names, values: the reference values
163
     */
164
    protected function getReferencesValues($role, array $references, $step)
165
    {
166
        $refs = array();
167
168
        foreach ($references as $reference) {
169
            switch ($reference['attribute']) {
170
                case 'role_id':
171
                case 'id':
172
                    $value = $role->id;
173
                    break;
174
                case 'identifier':
175
                case 'role_identifier':
176
                    $value = $role->identifier;
177
                    break;
178
                default:
179
                    throw new \InvalidArgumentException('Role Manager does not support setting references for attribute ' . $reference['attribute']);
180
            }
181
182
            $refs[$reference['identifier']] = $value;
183
        }
184
185
        return $refs;
186
    }
187
188
    /**
189
     * @param array $matchCondition

Core/Executor/UserGroupManager.php 1 location

@@ 193-213 (lines=21) @@
190
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
191
     * @return array key: the reference names, values: the reference values
192
     */
193
    protected function getReferencesValues($userGroup, array $references, $step)
194
    {
195
        $refs = array();
196
197
        foreach ($references as $reference) {
198
            switch ($reference['attribute']) {
199
                case 'object_id':
200
                case 'content_id':
201
                case 'user_group_id':
202
                case 'id':
203
                    $value = $userGroup->id;
204
                    break;
205
                default:
206
                    throw new \InvalidArgumentException('User Group Manager does not support setting references for attribute ' . $reference['attribute']);
207
            }
208
209
            $refs[$reference['identifier']] = $value;
210
        }
211
212
        return $refs;
213
    }
214
215
    protected function setSection(Content $content, $sectionKey)
216
    {