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() |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
27 | 3 | ->scalarNode('version')->defaultNull()->end() |
|
28 | 3 | ->end() |
|
29 | 3 | ->end() |
|
30 | 3 | ->arrayNode('handlers')->isRequired() |
|
31 | 3 | ->beforeNormalization() |
|
32 | 3 | ->ifString() |
|
33 | 3 | ->then(function($v) { |
|
34 | 1 | return array($v); |
|
35 | 3 | }) |
|
36 | 3 | ->end() |
|
37 | 3 | ->prototype('scalar')->isRequired()->cannotBeEmpty()->end() |
|
38 | 3 | ->end() |
|
39 | 3 | ->arrayNode('config')->isRequired()->addDefaultsIfNotSet() |
|
40 | 3 | ->children() |
|
41 | 3 | ->scalarNode('channel_prefix')->defaultNull()->end() |
|
42 | 3 | ->scalarNode('user_class')->defaultValue(null)->end() |
|
43 | 3 | ->arrayNode('user_methods') |
|
44 | 3 | ->useAttributeAsKey('value') |
|
45 | 3 | ->normalizeKeys(false) |
|
46 | 3 | ->defaultValue(array( |
|
47 | 3 | 'user_name' => 'getUsername', |
|
48 | 3 | )) |
|
49 | 3 | ->prototype('scalar')->end() |
|
50 | 3 | ->end() |
|
51 | 3 | ->arrayNode('display')->addDefaultsIfNotSet() |
|
52 | 3 | ->children() |
|
53 | 3 | ->booleanNode('env')->defaultTrue()->end() |
|
54 | 3 | ->booleanNode('locale')->defaultTrue()->end() |
|
55 | 3 | ->booleanNode('application_name')->defaultTrue()->end() |
|
56 | 3 | ->booleanNode('application_version')->defaultTrue()->end() |
|
57 | 3 | ->booleanNode('url')->defaultTrue()->end() |
|
58 | 3 | ->booleanNode('route')->defaultTrue()->end() |
|
59 | 3 | ->booleanNode('user_agent')->defaultTrue()->end() |
|
60 | 3 | ->booleanNode('accept_encoding')->defaultTrue()->end() |
|
61 | 3 | ->booleanNode('client_ip')->defaultTrue()->end() |
|
62 | 3 | ->booleanNode('user')->defaultTrue()->end() |
|
63 | 3 | ->booleanNode('global_channel')->defaultFalse()->end() |
|
64 | 3 | ->end() |
|
65 | 3 | ->end() |
|
66 | 3 | ->end() |
|
67 | 3 | ->end(); |
|
68 | |||
69 | 3 | return $treeBuilder; |
|
70 | } |
||
71 | } |
||
72 |