Code Duplication    Length = 30-30 lines in 2 locations

DependencyInjection/AbstractResourceConfiguration.php 2 locations

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