1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Deamon\LoggerExtraBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
6
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* This is the class that validates and merges configuration from your app/config files. |
10
|
|
|
* |
11
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
12
|
|
|
*/ |
13
|
|
|
class Configuration implements ConfigurationInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritdoc} |
17
|
|
|
*/ |
18
|
3 |
|
public function getConfigTreeBuilder(): TreeBuilder |
19
|
|
|
{ |
20
|
3 |
|
$treeBuilder = new TreeBuilder('deamon_logger_extra'); |
21
|
|
|
|
22
|
3 |
|
$treeBuilder->getRootNode()->children() |
23
|
3 |
|
->arrayNode('application')->isRequired() |
24
|
3 |
|
->children() |
25
|
3 |
|
->scalarNode('name')->defaultNull()->cannotBeEmpty()->end() |
26
|
3 |
|
->scalarNode('locale')->defaultNull()->end() |
27
|
3 |
|
->end() |
28
|
3 |
|
->end() |
29
|
3 |
|
->arrayNode('handlers')->isRequired() |
30
|
3 |
|
->beforeNormalization() |
31
|
3 |
|
->ifString() |
32
|
|
|
->then(function($v) { |
33
|
1 |
|
return array($v); |
34
|
3 |
|
}) |
35
|
3 |
|
->end() |
36
|
3 |
|
->prototype('scalar')->isRequired()->cannotBeEmpty()->end() |
37
|
3 |
|
->end() |
38
|
3 |
|
->arrayNode('config')->isRequired()->addDefaultsIfNotSet() |
39
|
3 |
|
->children() |
40
|
3 |
|
->scalarNode('channel_prefix')->defaultNull()->end() |
41
|
3 |
|
->scalarNode('user_class')->defaultValue(null)->end() |
42
|
3 |
|
->arrayNode('user_methods') |
43
|
3 |
|
->useAttributeAsKey('value') |
44
|
3 |
|
->normalizeKeys(false) |
45
|
3 |
|
->defaultValue(array( |
46
|
3 |
|
'user_name' => 'getUsername', |
47
|
|
|
)) |
48
|
3 |
|
->prototype('scalar')->end() |
49
|
3 |
|
->end() |
50
|
3 |
|
->arrayNode('display')->addDefaultsIfNotSet() |
51
|
3 |
|
->children() |
52
|
3 |
|
->booleanNode('env')->defaultTrue()->end() |
53
|
3 |
|
->booleanNode('locale')->defaultTrue()->end() |
54
|
3 |
|
->booleanNode('application_name')->defaultTrue()->end() |
55
|
3 |
|
->booleanNode('url')->defaultTrue()->end() |
56
|
3 |
|
->booleanNode('route')->defaultTrue()->end() |
57
|
3 |
|
->booleanNode('user_agent')->defaultTrue()->end() |
58
|
3 |
|
->booleanNode('accept_encoding')->defaultTrue()->end() |
59
|
3 |
|
->booleanNode('client_ip')->defaultTrue()->end() |
60
|
3 |
|
->booleanNode('user')->defaultTrue()->end() |
61
|
3 |
|
->booleanNode('global_channel')->defaultTrue()->end() |
62
|
3 |
|
->end() |
63
|
3 |
|
->end() |
64
|
3 |
|
->end() |
65
|
3 |
|
->end(); |
66
|
|
|
|
67
|
3 |
|
return $treeBuilder; |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|