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'); |
|
|
|
|
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
|
|
|
|
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.