Completed
Push — master ( 8dd935...0e2bba )
by Peter
04:33
created

Configuration::getConfigTreeBuilder()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 24
ccs 21
cts 21
cp 1
rs 8.9713
c 1
b 0
f 0
cc 1
eloc 21
nc 1
nop 0
crap 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_located'
24
     *     queue: 'pull_memory'
25
     *     locator: 'symfony'
26
     *
27
     * @return TreeBuilder
28
     */
29 5
    public function getConfigTreeBuilder()
30
    {
31 5
        return (new TreeBuilder())
32 5
            ->root('gpslab_domain_event')
33 5
                ->children()
34 5
                    ->scalarNode('bus')
35 5
                        ->cannotBeEmpty()
36 5
                        ->defaultValue('listener_located')
37 5
                    ->end()
38 5
                    ->scalarNode('queue')
39 5
                        ->cannotBeEmpty()
40 5
                        ->defaultValue('pull_memory')
41 5
                    ->end()
42 5
                    ->scalarNode('locator')
43 5
                        ->cannotBeEmpty()
44 5
                        ->defaultValue('symfony')
45 5
                    ->end()
46 5
                    ->booleanNode('publish_on_flush')
47 5
                        ->defaultValue(false)
48 5
                    ->end()
49 5
                ->end()
50 5
            ->end()
51
        ;
52
    }
53
}
54