Code Duplication    Length = 30-30 lines in 2 locations

DependencyInjection/AbstractResourceConfiguration.php 2 locations

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