Completed
Push — master ( a77802...307218 )
by Peter
04:13
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 50
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 47 1
1
<?php
2
/**
3
 * AnimeDb package
4
 *
5
 * @package   AnimeDb
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2014, Peter Gribanov
8
 * @license   http://opensource.org/licenses/MIT
9
 */
10
11
namespace AnimeDb\Bundle\CacheTimeKeeperBundle\DependencyInjection;
12
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
/**
17
 * DI Configuration
18
 *
19
 * @package AnimeDb\Bundle\CacheTimeKeeperBundle\DependencyInjection
20
 * @author  Peter Gribanov <[email protected]>
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    public function getConfigTreeBuilder()
25
    {
26
        $treeBuilder = new TreeBuilder();
27
        $rootNode = $treeBuilder->root('anime_db_cache_time_keeper');
28
29
        /**
30
         * Example config:
31
         *
32
         * anime_db_cache_time_keeper:
33
         *     use_driver: multi
34
         *     drivers:
35
         *         multi:
36
         *             fast: shmop
37
         *             slow: file
38
         *         shmop:
39
         *             salt: '%secret%'
40
         *         file:
41
         *             path: '%kernel.root_dir%/cache/cache-time-keeper/'
42
         */
43
        $rootNode
44
            ->children()
45
                ->scalarNode('use_driver')->end()
46
                ->arrayNode('drivers')
47
                    ->children()
48
                        ->arrayNode('multi')
49
                            ->children()
50
                                ->scalarNode('fast')->end()
51
                                ->scalarNode('slow')->end()
52
                            ->end()
53
                        ->end() // multi
54
                        ->arrayNode('shmop')
55
                            ->children()
56
                                ->scalarNode('salt')->end()
57
                            ->end()
58
                        ->end() // shmop
59
                        ->arrayNode('file')
60
                            ->children()
61
                                ->scalarNode('path')->end()
62
                            ->end()
63
                        ->end() // file
64
                    ->end()
65
                ->end() // drivers
66
            ->end()
67
        ;
68
69
        return $treeBuilder;
70
    }
71
}
72