Code Duplication    Length = 27-30 lines in 2 locations

Core/Executor/LanguageManager.php 1 location

@@ 151-180 (lines=30) @@
148
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
149
     * @return array key: the reference names, values: the reference values
150
     */
151
    protected function getReferencesValues($language, array $references, $step)
152
    {
153
        $refs = array();
154
155
        foreach ($references as $reference) {
156
157
            switch ($reference['attribute']) {
158
                case 'language_id':
159
                case 'id':
160
                    $value = $language->id;
161
                    break;
162
                case 'enabled':
163
                    $value = $language->enabled;
164
                    break;
165
                case 'language_code':
166
                    $value = $language->languageCode;
167
                    break;
168
                case 'language_name':
169
                case 'name':
170
                    $value = $language->name;
171
                    break;
172
                default:
173
                    throw new \InvalidArgumentException('Language Manager does not support setting references for attribute ' . $reference['attribute']);
174
            }
175
176
            $refs[$reference['identifier']] = $value;
177
        }
178
179
        return $refs;
180
    }
181
182
    /**
183
     * @param array $matchCondition

Core/Executor/SectionManager.php 1 location

@@ 137-163 (lines=27) @@
134
     * @throws \InvalidArgumentException When trying to assign a reference to an unsupported attribute
135
     * @return array key: the reference names, values: the reference values
136
     */
137
    protected function getReferencesValues($section, array $references, $step)
138
    {
139
        $refs = array();
140
141
        foreach ($references as $reference) {
142
            switch ($reference['attribute']) {
143
                case 'section_id':
144
                case 'id':
145
                    $value = $section->id;
146
                    break;
147
                case 'section_identifier':
148
                case 'identifier':
149
                    $value = $section->identifier;
150
                    break;
151
                case 'section_name':
152
                case 'name':
153
                    $value = $section->name;
154
                    break;
155
                default:
156
                    throw new \InvalidArgumentException('Section Manager does not support setting references for attribute ' . $reference['attribute']);
157
            }
158
159
            $refs[$reference['identifier']] = $value;
160
        }
161
162
        return $refs;
163
    }
164
165
    /**
166
     * @param array $matchCondition