Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 37
dl 0
loc 46
ccs 38
cts 38
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 42 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 3
    public function getConfigTreeBuilder()
12
    {
13 3
        $treeBuilder = new TreeBuilder(JsonRpcHttpServerExtension::EXTENSION_IDENTIFIER);
14
15 3
        $rootNode = $treeBuilder->getRootNode();
16
17 3
        $rootNode
18 3
            ->addDefaultsIfNotSet()
19 3
            ->children()
20 3
                ->variableNode('endpoint')
21 3
                    ->info('Your custom JSON-RPC http endpoint path')
22 3
                    ->treatNullLike(self::DEFAULT_ENDPOINT)
23 3
                    ->defaultValue(self::DEFAULT_ENDPOINT)
24 3
                ->end()
25 3
                ->arrayNode('debug')
26 3
                    ->addDefaultsIfNotSet()
27 3
                    ->children()
28 3
                        ->booleanNode('enabled')
29 3
                            ->info(
30 3
                                'Whether to render debug information on error or not (should NOT be enabled on prod)'
31 3
                            )
32 3
                            ->defaultFalse()
33 3
                        ->end()
34 3
                        ->integerNode('max_trace_size')
35 3
                            ->info('Max debug trace size')
36 3
                            ->min(0)
37 3
                            ->defaultValue(10)
38 3
                        ->end()
39 3
                        ->booleanNode('show_trace_arguments')
40 3
                            ->info('Whether to render debug stack trace arguments or not')
41 3
                            ->defaultValue(true)
42 3
                        ->end()
43 3
                        ->booleanNode('simplify_trace_arguments')
44 3
                            ->info('Whether to simplify representation of debug stack trace arguments or not')
45 3
                            ->defaultValue(true)
46 3
                        ->end()
47 3
                    ->end()
48 3
                ->end()
49 3
            ->end()
50 3
        ;
51
52 3
        return $treeBuilder;
53
    }
54
}
55