1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace SavinMikhail\ResponseProfilerBundle\DependencyInjection; |
||
6 | |||
7 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||
8 | use Symfony\Component\Config\Definition\Builder\NodeBuilder; |
||
9 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
10 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
11 | |||
12 | final class Configuration implements ConfigurationInterface |
||
13 | { |
||
14 | 1 | public function getConfigTreeBuilder(): TreeBuilder |
|
15 | { |
||
16 | 1 | $treeBuilder = new TreeBuilder(name: 'response_profiler'); |
|
17 | /** @var ArrayNodeDefinition $rootNode */ |
||
18 | 1 | $rootNode = $treeBuilder->getRootNode(); |
|
19 | |||
20 | /** @var NodeBuilder $children */ |
||
21 | 1 | $children = $rootNode->children(); |
|
22 | |||
23 | 1 | $children->booleanNode('enabled')->defaultTrue()->end(); |
|
24 | |||
25 | 1 | $children |
|
26 | 1 | ->integerNode('max_length') |
|
27 | 1 | ->min(1_024) |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
28 | 1 | ->defaultValue(262_144) // 256 KB |
|
29 | 1 | ->end(); |
|
30 | |||
31 | 1 | $children |
|
32 | 1 | ->arrayNode('allowed_mime_types') |
|
33 | 1 | ->scalarPrototype()->end() |
|
34 | 1 | ->defaultValue([ |
|
35 | 1 | 'application/json', |
|
36 | 1 | 'application/ld+json', |
|
37 | 1 | 'application/problem+json', |
|
38 | 1 | 'application/vnd.api+json', |
|
39 | 1 | 'text/plain', |
|
40 | 1 | 'text/json', |
|
41 | 1 | 'application/x-ndjson', |
|
42 | 1 | ]) |
|
43 | 1 | ->end(); |
|
44 | |||
45 | // close children builder |
||
46 | 1 | $children->end(); |
|
47 | |||
48 | 1 | return $treeBuilder; |
|
49 | } |
||
50 | } |
||
51 |