Completed
Push — master ( dfb193...8dd935 )
by Peter
09:44
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
ccs 0
cts 25
cp 0
rs 8.8571
cc 1
eloc 22
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2016, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace GpsLab\Bundle\DomainEvent\DependencyInjection;
11
12
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
13
use Symfony\Component\Config\Definition\ConfigurationInterface;
14
15
class Configuration implements ConfigurationInterface
16
{
17
    /**
18
     * Config tree builder.
19
     *
20
     * Example config:
21
     *
22
     * gpslab_domain_event:
23
     *     bus: 'listener_locator'
24
     *     queue: 'memory_unique'
25
     *     locator: 'named_event'
26
     *     name_resolver: 'event_class'
27
     *
28
     * @return TreeBuilder
29
     */
30
    public function getConfigTreeBuilder()
31
    {
32
        return (new TreeBuilder())
33
            ->root('gpslab_domain_event')
34
                ->children()
35
                    ->scalarNode('bus')
36
                        ->cannotBeEmpty()
37
                        ->defaultValue('listener_locator')
38
                    ->end()
39
                    ->scalarNode('queue')
40
                        ->cannotBeEmpty()
41
                        ->defaultValue('memory_unique')
42
                    ->end()
43
                    ->scalarNode('locator')
44
                        ->cannotBeEmpty()
45
                        ->defaultValue('named_event')
46
                    ->end()
47
                    ->scalarNode('name_resolver')
48
                        ->cannotBeEmpty()
49
                        ->defaultValue('event_class')
50
                    ->end()
51
                ->end()
52
            ->end()
53
        ;
54
    }
55
}
56