Completed
Push — master ( bdae2a...a60672 )
by Colin
02:04
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 20
CRAP Score 1.0022

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 20
cts 23
cp 0.8696
rs 9.52
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1.0022
1
<?php
2
3
/*
4
 * This file is part of the colinodell\omnipay-bundle package.
5
 *
6
 * (c) 2018 Colin O'Dell <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ColinODell\OmnipayBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
15
use Symfony\Component\Config\Definition\ConfigurationInterface;
16
17
/**
18
 * This is the class that validates and merges configuration from your app/config files
19
 *
20
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
21
 */
22
class Configuration implements ConfigurationInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27 6
    public function getConfigTreeBuilder()
28
    {
29 6
        $treeBuilder = new TreeBuilder();
30 6
        $rootNode = $treeBuilder->root('omnipay');
31
32
        $rootNode
33 6
            ->children()
34 6
                ->arrayNode('methods')
35 6
                    ->useAttributeAsKey('name')
36 6
                    ->prototype('variable')
37 6
                    ->end()
38 6
                ->end()
39 6
                ->scalarNode('default_gateway')
40 6
                    ->defaultNull()
41 6
                ->end()
42 6
                ->booleanNode('initialize_gateway_on_registration')
43 6
                    ->defaultFalse()
44 6
                ->end()
45 6
                ->arrayNode('disabled_gateways')
46 6
                    ->prototype('scalar')
47 6
                ->end()
48 6
            ->end();
49
50 6
        return $treeBuilder;
51
    }
52
}
53