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

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 1
c 3
b 0
f 0
lcom 0
cbo 3
dl 0
loc 41
ccs 0
cts 25
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getConfigTreeBuilder() 0 25 1
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