Completed
Push — develop ( f5bb1e...33cc42 )
by Baptiste
02:31
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 46
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 41
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 46
ccs 41
cts 41
cp 1
rs 8.9411
cc 1
eloc 42
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Neo4jBundle\DependencyInjection;
5
6
use Symfony\Component\Config\Definition\{
7
    Builder\TreeBuilder,
8
    Builder\NodeBuilder,
9
    ConfigurationInterface
10
};
11
12
class Configuration implements ConfigurationInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 40
    public function getConfigTreeBuilder()
18
    {
19 40
        $treeBuilder = new TreeBuilder;
20 40
        $root = $treeBuilder->root('innmind_neo4j');
21
22
        $root
23 40
            ->children()
24 40
                ->arrayNode('connection')
25 40
                    ->addDefaultsIfNotSet()
26 40
                    ->children()
27 40
                        ->scalarNode('host')
28 40
                            ->defaultValue('localhost')
29 40
                        ->end()
30 40
                        ->scalarNode('scheme')
31 40
                            ->defaultValue('https')
32 40
                        ->end()
33 40
                        ->integerNode('port')
34 40
                            ->defaultValue(7474)
35 40
                        ->end()
36 40
                        ->scalarNode('user')
37 40
                            ->defaultValue('neo4j')
38 40
                        ->end()
39 40
                        ->scalarNode('password')
40 40
                            ->defaultValue('neo4j')
41 40
                        ->end()
42 40
                        ->integerNode('timeout')
43 40
                            ->defaultValue(60)
44 40
                        ->end()
45 40
                    ->end()
46 40
                ->end()
47 40
                ->arrayNode('types')
48 40
                    ->defaultValue([])
49 40
                    ->prototype('scalar')->end()
50 40
                ->end()
51 40
                ->scalarNode('persister')
52 40
                    ->info('The service name to use in the unit of work to persist the entity container')
53 40
                    ->defaultValue('innmind_neo4j.persister.delegation')
54 40
                ->end()
55 40
                ->scalarNode('metadata_configuration')
56 40
                    ->info('The service to use to validate a metadata configuration')
57 40
                    ->defaultValue('innmind_neo4j.metadata_builder.configuration')
58 40
                ->end()
59 40
            ->end();
60
61 40
        return $treeBuilder;
62
    }
63
}
64