Code Duplication    Length = 30-30 lines in 2 locations

DependencyInjection/AbstractResourceConfiguration.php 2 locations

@@ 227-256 (lines=30) @@
224
     *
225
     * @return ArrayNodeDefinition
226
     */
227
    protected function createFormsNode($classes)
228
    {
229
        $builder = new TreeBuilder();
230
        $node = $builder->root('form');
231
232
        if (is_string($classes)) {
233
            $classes = array(self::DEFAULT_KEY => $classes);
234
        }
235
236
        if (!isset($classes['choice'])) {
237
            $classes['choice'] = 'DoS\ResourceBundle\Form\Type\ResourceChoiceType';
238
        }
239
240
        $node
241
            ->defaultValue($classes)
242
                ->useAttributeAsKey('name')
243
                ->prototype('scalar')
244
            ->end()
245
            ->beforeNormalization()
246
            ->ifString()
247
                ->then(function ($v) {
248
                    return array(
249
                        AbstractResourceConfiguration::DEFAULT_KEY => $v,
250
                    );
251
                })
252
            ->end()
253
        ;
254
255
        return $node;
256
    }
257
258
    /**
259
     * @param array|string $classes
@@ 263-292 (lines=30) @@
260
     *
261
     * @return ArrayNodeDefinition
262
     */
263
    protected function createTranslationFormsNode($classes)
264
    {
265
        $builder = new TreeBuilder();
266
        $node = $builder->root('form');
267
268
        if (is_string($classes)) {
269
            $classes = array(self::DEFAULT_KEY => $classes);
270
        }
271
272
        if (!isset($classes['choice'])) {
273
            $classes['choice'] = 'DoS\ResourceBundle\Form\Type\ResourceChoiceType';
274
        }
275
276
        $node
277
            ->defaultValue($classes)
278
                ->useAttributeAsKey('name')
279
                ->prototype('scalar')
280
            ->end()
281
            ->beforeNormalization()
282
            ->ifString()
283
                ->then(function ($v) {
284
                    return array(
285
                        AbstractResourceConfiguration::DEFAULT_KEY => $v,
286
                    );
287
                })
288
            ->end()
289
        ;
290
291
        return $node;
292
    }
293
294
    protected function setDefaults(ArrayNodeDefinition $node, array $configs = array())
295
    {