Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 44

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 9.216
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Beelab\PaypalBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
final class Configuration implements ConfigurationInterface
9
{
10
    public function getConfigTreeBuilder(): TreeBuilder
11
    {
12
        $treeBuilder = new TreeBuilder('beelab_paypal');
13
        // BC layer for symfony/config < 4.2
14
        $rootNode = \method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('beelab_paypal');
0 ignored issues
show
Bug introduced by
The method root() does not seem to exist on object<Symfony\Component...on\Builder\TreeBuilder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
15
        $rootNode
16
            ->children()
17
                ->scalarNode('username')
18
                    ->isRequired()
19
                    ->cannotBeEmpty()
20
                ->end()
21
                ->scalarNode('password')
22
                    ->isRequired()
23
                    ->cannotBeEmpty()
24
                ->end()
25
                ->scalarNode('signature')
26
                    ->isRequired()
27
                    ->cannotBeEmpty()
28
                ->end()
29
                ->scalarNode('currency')
30
                    ->cannotBeEmpty()
31
                    ->defaultValue('EUR')
32
                ->end()
33
                ->scalarNode('return_route')
34
                    ->isRequired()
35
                    ->cannotBeEmpty()
36
                ->end()
37
                ->scalarNode('cancel_route')
38
                    ->isRequired()
39
                    ->cannotBeEmpty()
40
                ->end()
41
                ->scalarNode('service_class')
42
                    ->cannotBeEmpty()
43
                    ->defaultValue('Beelab\PaypalBundle\Paypal\Service')
44
                    ->setDeprecated('The "service_class" option is deprecated. Define your class as service instead.')
45
                ->end()
46
                ->booleanNode('test_mode')
47
                    ->defaultValue(false)
48
                ->end()
49
            ->end()
50
        ;
51
52
        return $treeBuilder;
53
    }
54
}
55