Completed
Push — master ( c55965...347886 )
by David
02:38
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 22
rs 9.2
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of A2lix projects.
5
 *
6
 * (c) David ALLIX
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace A2lix\AutoFormBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
class Configuration implements ConfigurationInterface
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function getConfigTreeBuilder()
23
    {
24
        $treeBuilder = new TreeBuilder();
25
        $rootNode = $treeBuilder->root('a2lix_auto_form');
26
27
        $rootNode
28
            ->children()
29
                ->arrayNode('excluded_fields')
30
                    ->defaultValue(['id', 'locale', 'translatable'])
31
                    ->beforeNormalization()
32
                        ->ifString()
33
                        ->then(function ($v) {
34
                            return preg_split('/\s*,\s*/', $v);
35
                        })
36
                    ->end()
37
                    ->prototype('scalar')->end()
38
                ->end()
39
            ->end()
40
        ;
41
42
        return $treeBuilder;
43
    }
44
}
45