Completed
Push — master ( f20bc4...886a11 )
by Baptiste
02:52 queued 43s
created

Configuration::createConnectionTree()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 17
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 21
ccs 17
cts 17
cp 1
rs 9.3143
cc 1
eloc 18
nc 1
nop 1
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 20
    public function getConfigTreeBuilder()
18
    {
19 20
        $treeBuilder = new TreeBuilder;
20 20
        $root = $treeBuilder->root('innmind_neo4j');
21
22
        $root
23 20
            ->children()
24 20
                ->arrayNode('connection')
25 20
                    ->addDefaultsIfNotSet()
26 20
                    ->children()
27 20
                        ->scalarNode('host')
28 20
                            ->defaultValue('localhost')
29 20
                        ->end()
30 20
                        ->scalarNode('scheme')
31 20
                            ->defaultValue('https')
32 20
                        ->end()
33 20
                        ->integerNode('port')
34 20
                            ->defaultValue(7474)
35 20
                        ->end()
36 20
                        ->scalarNode('user')
37 20
                            ->defaultValue('neo4j')
38 20
                        ->end()
39 20
                        ->scalarNode('password')
40 20
                            ->defaultValue('neo4j')
41 20
                        ->end()
42 20
                        ->integerNode('timeout')
43 20
                            ->defaultValue(60)
44 20
                        ->end()
45 20
                    ->end()
46 20
                ->end()
47 20
                ->arrayNode('types')
48 20
                    ->defaultValue([])
49 20
                    ->prototype('scalar')->end()
50 20
                ->end()
51 20
                ->scalarNode('persister')
52 20
                    ->info('The service name to use in the unit of work to persist the entity container')
53 20
                    ->defaultValue('innmind_neo4j.persister.delegation')
54 20
                ->end()
55 20
                ->scalarNode('metadata_configuration')
56 20
                    ->info('The service to use to validate a metadata configuration')
57 20
                    ->defaultValue('innmind_neo4j.metadata_builder.configuration')
58 20
                ->end()
59 20
            ->end();
60
61 20
        return $treeBuilder;
62
    }
63
}
64