Completed
Push — master ( 97c96f...884ea1 )
by Peter
09:54
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 17
ccs 0
cts 17
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 14
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
namespace GpsLab\Bundle\DomainEvent\DependencyInjection;
10
11
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
12
use Symfony\Component\Config\Definition\ConfigurationInterface;
13
14
class Configuration implements ConfigurationInterface
15
{
16
    /**
17
     * Config tree builder.
18
     *
19
     * Example config:
20
     *
21
     * gpslab_domain_event:
22
     *     locator: 'named_event'
23
     *     name_resolver: 'event_class'
24
     *
25
     * @return TreeBuilder
26
     */
27
    public function getConfigTreeBuilder()
28
    {
29
        return (new TreeBuilder())
30
            ->root('gpslab_domain_event')
31
                ->children()
32
                    ->scalarNode('locator')
33
                        ->cannotBeEmpty()
34
                        ->defaultValue('named_event')
35
                    ->end()
36
                    ->scalarNode('name_resolver')
37
                        ->cannotBeEmpty()
38
                        ->defaultValue('event_class')
39
                    ->end()
40
                ->end()
41
            ->end()
42
        ;
43
    }
44
}
45