Failed Conditions
Pull Request — master (#46)
by
unknown
01:56
created

Configuration   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 92.86%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 17
c 2
b 0
f 0
dl 0
loc 27
ccs 13
cts 14
cp 0.9286
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 23 2
1
<?php
2
namespace Yoanm\SymfonyJsonRpcHttpServer\DependencyInjection;
3
4
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
5
use Symfony\Component\Config\Definition\ConfigurationInterface;
6
7
class Configuration implements ConfigurationInterface
8
{
9
    const DEFAULT_ENDPOINT = '/json-rpc';
10
11 1
    public function getConfigTreeBuilder()
12
    {
13 1
        $treeBuilder = new TreeBuilder(JsonRpcHttpServerExtension::EXTENSION_IDENTIFIER);
14
15 1
        if (method_exists($treeBuilder, 'getRootNode')) {
16 1
            $rootNode = $treeBuilder->getRootNode();
17
        } else {
18
            // BC layer for symfony/config 4.1 and older
19
            $rootNode = $treeBuilder->root(JsonRpcHttpServerExtension::EXTENSION_IDENTIFIER);
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

19
            $rootNode = /** @scrutinizer ignore-deprecated */ $treeBuilder->root(JsonRpcHttpServerExtension::EXTENSION_IDENTIFIER);

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...
20
        }
21
22
        $rootNode
23 1
            ->addDefaultsIfNotSet()
24 1
            ->children()
25 1
                ->variableNode('endpoint')
26 1
                    ->info('Your custom JSON-RPC http endpoint path')
27 1
                    ->treatNullLike(self::DEFAULT_ENDPOINT)
28 1
                    ->defaultValue(self::DEFAULT_ENDPOINT)
29 1
                ->end()
30 1
            ->end()
31
        ;
32
33 1
        return $treeBuilder;
34
    }
35
}
36