Configuration::getConfigTreeBuilder()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 14
nc 2
nop 0
dl 0
loc 19
rs 9.7998
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
            ->arrayPrototype()
0 ignored issues
show
Bug introduced by
The method arrayPrototype() does not exist on Symfony\Component\Config...\Builder\NodeDefinition. It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition. ( Ignorable by Annotation )

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

20
            ->/** @scrutinizer ignore-call */ 
21
              arrayPrototype()
Loading history...
21
            ->children()
22
            ->scalarNode('baseUrl')->isRequired()->cannotBeEmpty()->end()
23
            ->scalarNode('gocardlessVersion')->isRequired()->cannotBeEmpty()->end()
24
            ->scalarNode('webhook_secret')->isRequired()->cannotBeEmpty()->end()
25
            ->scalarNode('token')->isRequired()->cannotBeEmpty()->end()
26
            ->end();
27
28
        return $treeBuilder;
29
    }
30
}
31