Configuration::getConfigTreeBuilder()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 36
rs 8.8571
cc 1
eloc 31
nc 1
nop 0
1
<?php
2
3
namespace StoreFactory\ZohoSubscriptionBundle\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('zoho_subscription');
22
23
        $rootNode
24
            ->children()
25
                ->arrayNode('api')
26
                    ->children()
27
                        ->scalarNode('key')
28
                            ->isRequired()
29
                            ->info('The service is not free. You must provide an API Key which can be found on : https://www.zoho.com/subscriptions/')
30
                        ->end()
31
                        ->scalarNode('organization_id')
32
                            ->isRequired()
33
                            ->info('Organization ID from Zoho Subscription')
34
                        ->end()
35
                    ->end()
36
                ->end()
37
                ->arrayNode('cache')
38
                    ->children()
39
                        ->scalarNode('service')
40
                            ->info('Defines the service id of the cache that will be used')
41
                            ->defaultValue('zoho.array.cache')
42
                        ->end()
43
                        ->integerNode('ttl')
44
                            ->info('Defines the TTL of the cache')
45
                            ->defaultValue(null)
46
                        ->end()
47
                    ->end()
48
                ->end()
49
            ->end()
50
        ;
51
52
        return $treeBuilder;
53
    }
54
}
55