Completed
Push — master ( 324ca9...bf4d68 )
by Sullivan
8s
created

Configuration::getConfigTreeBuilder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 23
rs 9.0856
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
3
namespace Nexy\SlackBundle\DependencyInjection;
4
5
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
use Symfony\Component\Config\Definition\ConfigurationInterface;
7
8
/**
9
 * @author Sullivan Senechal <[email protected]>
10
 */
11
class Configuration implements ConfigurationInterface
12
{
13
    public function getConfigTreeBuilder()
14
    {
15
        $treeBuilder = new TreeBuilder();
16
        $rootNode = $treeBuilder->root('nexy_slack');
17
18
        $rootNode
19
            ->children()
20
                ->scalarNode('endpoint')->isRequired()->cannotBeEmpty()->end()
21
                ->scalarNode('channel')->defaultNull()->end()
22
                ->scalarNode('username')->defaultNull()->end()
23
                ->scalarNode('icon')->defaultNull()->end()
24
                ->booleanNode('link_names')->defaultFalse()->end()
25
                ->booleanNode('unfurl_links')->defaultFalse()->end()
26
                ->booleanNode('unfurl_media')->defaultTrue()->end()
27
                ->booleanNode('allow_markdown')->defaultTrue()->end()
28
                ->arrayNode('markdown_in_attachments')
29
                    ->prototype('scalar')->end()
30
                ->end()
31
            ->end()
32
        ;
33
34
        return $treeBuilder;
35
    }
36
}
37