Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 43 1
1
<?php
2
3
namespace Doctrs\SonataImportBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * This is the class that validates and merges configuration from your app/config files
10
 *
11
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
12
 */
13
class Configuration implements ConfigurationInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function getConfigTreeBuilder()
19
    {
20
        $treeBuilder = new TreeBuilder();
21
        $rootNode = $treeBuilder->root('doctrs_sonata_import');
22
23
        $rootNode
24
            ->children()
25
                ->arrayNode('mappings')
26
                    ->defaultValue([])
27
                    ->prototype('array')
28
                        ->children()
29
                            ->scalarNode('name')->end()
30
                            ->scalarNode('class')->end()
31
                        ->end()
32
                    ->end()
33
                ->end()
34
                ->scalarNode('upload_dir')
35
                    ->defaultValue(null)
36
                ->end()
37
                ->arrayNode('class_loaders')
38
                    ->defaultValue([[
39
                        'name' => 'CSV',
40
                        'class' => 'Doctrs\SonataImportBundle\Loaders\CsvFileLoader'
41
                    ]])
42
                        ->prototype('array')
43
                        ->children()
44
                            ->scalarNode('name')->end()
45
                            ->scalarNode('class')->end()
46
                        ->end()
47
                    ->end()
48
                ->end()
49
                ->arrayNode('encode')
50
                    ->children()
51
                        ->scalarNode('default')->defaultValue('utf8')->end()
52
                        ->arrayNode('list')->defaultValue([])
53
                            ->prototype('scalar')
54
                            ->end()
55
                    ->end()
56
                ->end()
57
            ->end()
58
        ;
59
60
        return $treeBuilder;
61
    }
62
}
63