Code Duplication    Length = 30-30 lines in 2 locations

DependencyInjection/AbstractResourceConfiguration.php 2 locations

@@ 251-280 (lines=30) @@
248
     *
249
     * @return ArrayNodeDefinition
250
     */
251
    protected function createFormsNode($classes)
252
    {
253
        $builder = new TreeBuilder();
254
        $node = $builder->root('form');
255
256
        if (is_string($classes)) {
257
            $classes = array(self::DEFAULT_KEY => $classes);
258
        }
259
260
        if (!isset($classes['choice'])) {
261
            $classes['choice'] = 'DoS\ResourceBundle\Form\Type\ResourceChoiceType';
262
        }
263
264
        $node
265
            ->defaultValue($classes)
266
                ->useAttributeAsKey('name')
267
                ->prototype('scalar')
268
            ->end()
269
            ->beforeNormalization()
270
            ->ifString()
271
                ->then(function ($v) {
272
                    return array(
273
                        AbstractResourceConfiguration::DEFAULT_KEY => $v,
274
                    );
275
                })
276
            ->end()
277
        ;
278
279
        return $node;
280
    }
281
282
    /**
283
     * @param array|string $classes
@@ 287-316 (lines=30) @@
284
     *
285
     * @return ArrayNodeDefinition
286
     */
287
    protected function createTranslationFormsNode($classes)
288
    {
289
        $builder = new TreeBuilder();
290
        $node = $builder->root('form');
291
292
        if (is_string($classes)) {
293
            $classes = array(self::DEFAULT_KEY => $classes);
294
        }
295
296
        if (!isset($classes['choice'])) {
297
            $classes['choice'] = 'DoS\ResourceBundle\Form\Type\ResourceChoiceType';
298
        }
299
300
        $node
301
            ->defaultValue($classes)
302
                ->useAttributeAsKey('name')
303
                ->prototype('scalar')
304
            ->end()
305
            ->beforeNormalization()
306
            ->ifString()
307
                ->then(function ($v) {
308
                    return array(
309
                        AbstractResourceConfiguration::DEFAULT_KEY => $v,
310
                    );
311
                })
312
            ->end()
313
        ;
314
315
        return $node;
316
    }
317
318
    protected function setDefaults(ArrayNodeDefinition $node, array $configs = array())
319
    {