Passed
Push — master ( f8b368...4df760 )
by Martin
05:42
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 13
nc 2
nop 0
dl 0
loc 18
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace Lendable\GoCardlessEnterpriseBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
class Configuration implements ConfigurationInterface
9
{
10
    public function getConfigTreeBuilder()
11
    {
12
        $treeBuilder = new TreeBuilder('gocardless_enterprise');
13
        if (method_exists($treeBuilder, 'getRootNode')) {
14
            $rootNode = $treeBuilder->getRootNode();
15
        } else {
16
            $rootNode = $treeBuilder->root('gocardless_enterprise');
0 ignored issues
show
Deprecated Code introduced by
The function Symfony\Component\Config...der\TreeBuilder::root() has been deprecated: since Symfony 4.3, pass the root name to the constructor instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

16
            $rootNode = /** @scrutinizer ignore-deprecated */ $treeBuilder->root('gocardless_enterprise');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
17
        }
18
19
        $rootNode
20
            ->children()
21
            ->scalarNode('baseUrl')->isRequired()->cannotBeEmpty()->end()
22
            ->scalarNode('gocardlessVersion')->isRequired()->cannotBeEmpty()->end()
23
            ->scalarNode('webhook_secret')->isRequired()->cannotBeEmpty()->end()
24
            ->scalarNode('token')->isRequired()->cannotBeEmpty()->end()
25
            ->end();
26
27
        return $treeBuilder;
28
    }
29
}
30