Failed Conditions
Pull Request — master (#75)
by Yo
03:03 queued 45s
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 18
ccs 0
cts 12
cp 0
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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
    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