Test Failed
Push — master ( 085c8a...c2447a )
by Alexey
01:55
created

Configuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 41.3%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 58
ccs 19
cts 46
cp 0.413
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConfigTreeBuilder() 0 52 1
1
<?php
2
3
/*
4
 * This file is part of the WoW-Apps/Symfony-Slack-Bot bundle for Symfony.
5
 * https://github.com/wow-apps/symfony-slack-bot
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 * https://github.com/wow-apps/symfony-slack-bot/blob/master/LICENSE
10
 *
11
 * For technical documentation.
12
 * https://wow-apps.github.io/symfony-slack-bot/docs/
13
 *
14
 * Author Alexey Samara <[email protected]>
15
 *
16
 * Copyright 2016 WoW-Apps.
17
 */
18
19
namespace WowApps\SlackBundle\DependencyInjection;
20
21
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
22
use Symfony\Component\Config\Definition\ConfigurationInterface;
23
24
/**
25
 * @author Alexey Samara <[email protected]>
26 1
 */
27
class Configuration implements ConfigurationInterface
28 1
{
29 1
    /**
30
     * {@inheritdoc}
31 1
     */
32 1
    public function getConfigTreeBuilder()
33 1
    {
34 1
        $treeBuilder = new TreeBuilder();
35 1
        $rootNode = $treeBuilder->root('wow_apps_slack');
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\Config...der\TreeBuilder::root() has been deprecated with message: since Symfony 4.3, pass the root name to the constructor instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
36 1
        $rootNode
37 1
            ->children()
38 1
                ->scalarNode('api_url')
39 1
                    ->isRequired()
40 1
                    ->cannotBeEmpty()
41 1
                ->end()
42 1
                ->arrayNode('channels')
43 1
                    ->scalarPrototype()->end()
44 1
                ->end()
45 1
                ->scalarNode('default_icon_url')
46 1
                    ->defaultValue('https://wow-apps.github.io/symfony-slack-bot/public/message-icon.png')
47
                ->end()
48 1
                ->scalarNode('default_username')
49
                    ->defaultValue('wow-apps/symfony-slack-bot')
50
                    ->cannotBeEmpty()
51
                ->end()
52
                ->scalarNode('default_fallback')->defaultValue('Can\'t display attachment in plain-text mode')->end()
53
                ->arrayNode('colors')
54
                    ->addDefaultsIfNotSet()
55
                    ->children()
56
                        ->scalarNode('default')->defaultValue('#607D8B')->end()
57
                        ->scalarNode('info')->defaultValue('#2196F3')->end()
58
                        ->scalarNode('warning')->defaultValue('#FF5722')->end()
59
                        ->scalarNode('success')->defaultValue('#8BC34A')->end()
60
                        ->scalarNode('danger')->defaultValue('#F44336')->end()
61
                    ->end()
62
                ->end()
63
                ->arrayNode('templates')
64
                    ->addDefaultsIfNotSet()
65
                    ->children()
66
                        ->arrayNode('exception')
67
                            ->addDefaultsIfNotSet()
68
                            ->children()
69
                                ->scalarNode('username')->defaultValue('Exception')->end()
70
                                ->scalarNode('channel')->defaultValue('general')->end()
71
                                ->scalarNode('icon')
72
                                    ->defaultValue(
73
                                        'https://wow-apps.github.io/symfony-slack-bot/public/exception-icon.png'
74
                                    )
75
                                ->end()
76
                            ->end()
77
                        ->end()
78
                    ->end()
79
                ->end()
80
            ->end();
81
82
        return $treeBuilder;
83
    }
84
}
85