Failed Conditions
Pull Request — master (#75)
by Yo
02:40
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 14
dl 0
loc 22
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 18 1
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
    public function getConfigTreeBuilder()
12
    {
13
        $treeBuilder = new TreeBuilder(JsonRpcHttpServerExtension::EXTENSION_IDENTIFIER);
14
15
        $rootNode = $treeBuilder->getRootNode();
16
17
        $rootNode
18
            ->addDefaultsIfNotSet()
19
            ->children()
20
                ->variableNode('endpoint')
21
                    ->info('Your custom JSON-RPC http endpoint path')
22
                    ->treatNullLike(self::DEFAULT_ENDPOINT)
23
                    ->defaultValue(self::DEFAULT_ENDPOINT)
24
                ->end()
25
            ->end()
26
        ;
27
28
        return $treeBuilder;
29
    }
30
}
31