Completed
Push — master ( 7e7da0...18ecc7 )
by Georges
01:55
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 26 1
1
<?php
2
3
/**
4
 *
5
 * This file is part of phpFastCache.
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For full copyright and license information, please see the docs/CREDITS.txt file.
10
 *
11
 * @author Georges.L (Geolim4)  <[email protected]>
12
 * @author PastisD https://github.com/PastisD
13
 * @author Khoa Bui (khoaofgod)  <[email protected]> http://www.phpfastcache.com
14
 *
15
 */
16
declare(strict_types=1);
17
18
namespace Phpfastcache\Bundle\DependencyInjection;
19
20
use Phpfastcache\CacheManager;
21
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
22
use Symfony\Component\Config\Definition\ConfigurationInterface;
23
24
/**
25
 * Class Configuration
26
 * @package Phpfastcache\Bundle\DependencyInjection
27
 */
28
class Configuration implements ConfigurationInterface
29
{
30
    /**
31
     * {@inheritDoc}
32
     *
33
     * @throws \RuntimeException
34
     */
35
    public function getConfigTreeBuilder()
36
    {
37
        $treeBuilder = new TreeBuilder();
38
        $rootNode = $treeBuilder->root('phpfastcache');
39
40
        $rootNode
41
            ->children()
42
                ->scalarNode('twig_driver')
43
                    ->isRequired()
44
                ->end()
45
                ->booleanNode('twig_block_debug')
46
                    ->defaultFalse()
47
                ->end()
48
                ->arrayNode('drivers')
49
                    ->useAttributeAsKey('name')
50
                    ->prototype('array')
51
                        ->children()
52
                            ->enumNode('type')->isRequired()->values(CacheManager::getDriverList())->end() // @TODO : Add all available drivers
53
                            ->arrayNode('parameters')->isRequired()->prototype('variable')->end()
54
                        ->end()
55
                    ->end()
56
                ->end()
57
            ->end();
58
59
        return $treeBuilder;
60
    }
61
}
62