Completed
Pull Request — master (#5)
by Márk
12:19 queued 04:46
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 0
loc 29
rs 8.8571
cc 1
eloc 24
nc 1
nop 0
1
<?php
2
3
namespace Indigo\Bundle\CookieConsentBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * @author Márk Sági-Kazár <[email protected]>
10
 */
11
class Configuration implements ConfigurationInterface
12
{
13
    public function getConfigTreeBuilder()
14
    {
15
        $treeBuilder = new TreeBuilder();
16
        $rootNode = $treeBuilder->root('indigo_cookie_consent');
17
18
        $rootNode
19
            ->children()
20
                ->arrayNode('options')
21
                    ->addDefaultsIfNotSet()
22
                    ->info('See valid options at https://silktide.com/tools/cookie-consent/docs/installation')
23
                    ->children()
24
                        ->scalarNode('link')->end()
25
                        ->scalarNode('container')->end()
26
                        ->scalarNode('theme')->end()
27
                        ->scalarNode('path')->end()
28
                        ->scalarNode('domain')->end()
29
                        ->integerNode('expiryDays')->end()
30
                        ->scalarNode('target')->end()
31
                    ->end()
32
                ->end()
33
                ->scalarNode('script')
34
                    ->defaultValue('//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.10/cookieconsent.min.js')
35
                    ->info('Set this to false to disable script (eg. when you compiled it into yours)')
36
                ->end()
37
            ->end()
38
        ;
39
40
        return $treeBuilder;
41
    }
42
}
43