Code Duplication    Length = 22-24 lines in 4 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

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

Core/Executor/ObjectStateManager.php 1 location

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

Core/Executor/RoleManager.php 1 location

@@ 176-198 (lines=23) @@
173
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
174
     * @return array key: the reference names, values: the reference values
175
     */
176
    protected function getReferencesValues($role, array $references, $step)
177
    {
178
        $refs = array();
179
180
        foreach ($references as $reference) {
181
            switch ($reference['attribute']) {
182
                case 'role_id':
183
                case 'id':
184
                    $value = $role->id;
185
                    break;
186
                case 'identifier':
187
                case 'role_identifier':
188
                    $value = $role->identifier;
189
                    break;
190
                default:
191
                    throw new \InvalidArgumentException('Role Manager does not support setting references for attribute ' . $reference['attribute']);
192
            }
193
194
            $refs[$reference['identifier']] = $value;
195
        }
196
197
        return $refs;
198
    }
199
200
    /**
201
     * @param array $matchCondition