Completed
Pull Request — master (#13)
by Guilh
02:03
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 30
rs 8.8571
cc 1
eloc 27
nc 1
nop 0
1
<?php
2
3
/*
4
 * (c) Kévin Dunglas <[email protected]>
5
 *
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
namespace Dunglas\ActionBundle\DependencyInjection;
11
12
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
15
/**
16
 * {@inheritdoc}
17
 *
18
 * @author Kévin Dunglas <[email protected]>
19
 */
20
class Configuration implements ConfigurationInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getConfigTreeBuilder()
26
    {
27
        $treeBuilder = new TreeBuilder();
28
        $treeBuilder->root('dunglas_action')
29
            ->children()
30
                ->arrayNode('autodiscover')
31
                    ->info('Autodiscover action classes stored in the configured directory of bundles and register them as service.')
32
                    ->canBeDisabled()
33
                    ->children()
34
                        ->arrayNode('directories')
35
                            ->info('The directory name to autodiscover in bundles.')
36
                            ->prototype('array')
37
                                ->prototype('scalar')->end()
38
                            ->end()
39
                            ->defaultValue(['action' => 'Action', 'command' => 'Command'])
40
                        ->end()
41
                    ->end()
42
                ->end()
43
                ->arrayNode('directories')
44
                    ->info('List of directories relative to the kernel root directory containing classes.')
45
                    ->prototype('array')
46
                        ->prototype('scalar')->end()
47
                    ->end()
48
                    ->defaultValue([])
49
                ->end()
50
            ->end()
51
        ->end();
52
53
        return $treeBuilder;
54
    }
55
}
56