|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types = 1); |
|
3
|
|
|
|
|
4
|
|
|
namespace Innmind\Rest\ServerBundle\DependencyInjection; |
|
5
|
|
|
|
|
6
|
|
|
use Symfony\Component\Config\Definition\{ |
|
7
|
|
|
Builder\TreeBuilder, |
|
8
|
|
|
Builder\NodeBuilder, |
|
9
|
|
|
ConfigurationInterface |
|
10
|
|
|
}; |
|
11
|
|
|
|
|
12
|
|
|
final class Configuration implements ConfigurationInterface |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* {@inheritdoc} |
|
16
|
|
|
*/ |
|
17
|
15 |
|
public function getConfigTreeBuilder() |
|
18
|
|
|
{ |
|
19
|
15 |
|
$treeBuilder = new TreeBuilder; |
|
20
|
15 |
|
$root = $treeBuilder->root('innmind_rest_server'); |
|
21
|
|
|
|
|
22
|
|
|
$root |
|
23
|
15 |
|
->children() |
|
24
|
15 |
|
->arrayNode('types') |
|
25
|
15 |
|
->defaultValue([]) |
|
26
|
15 |
|
->prototype('scalar')->end() |
|
27
|
15 |
|
->end() |
|
28
|
15 |
|
->arrayNode('accept') |
|
29
|
15 |
|
->info('The list of formats you accept in the "Accept" header') |
|
30
|
15 |
|
->useAttributeAsKey('name') |
|
31
|
15 |
|
->requiresAtLeastOneElement() |
|
32
|
15 |
|
->prototype('array') |
|
33
|
15 |
|
->children() |
|
34
|
15 |
|
->integerNode('priority')->end() |
|
35
|
15 |
|
->arrayNode('media_types') |
|
36
|
15 |
|
->useAttributeAsKey('name') |
|
37
|
15 |
|
->requiresAtLeastOneElement() |
|
38
|
15 |
|
->prototype('scalar')->end() |
|
39
|
15 |
|
->end() |
|
40
|
15 |
|
->end() |
|
41
|
15 |
|
->end() |
|
42
|
15 |
|
->end() |
|
43
|
15 |
|
->arrayNode('content_type') |
|
44
|
15 |
|
->info('The list of formats you support as content output') |
|
45
|
15 |
|
->useAttributeAsKey('name') |
|
46
|
15 |
|
->requiresAtLeastOneElement() |
|
47
|
15 |
|
->prototype('array') |
|
48
|
15 |
|
->children() |
|
49
|
15 |
|
->integerNode('priority')->end() |
|
50
|
15 |
|
->arrayNode('media_types') |
|
51
|
15 |
|
->useAttributeAsKey('name') |
|
52
|
15 |
|
->requiresAtLeastOneElement() |
|
53
|
15 |
|
->prototype('integer')->end() |
|
54
|
15 |
|
->end() |
|
55
|
15 |
|
->end() |
|
56
|
15 |
|
->end() |
|
57
|
15 |
|
->end() |
|
58
|
15 |
|
->scalarNode('specification_builder') |
|
59
|
15 |
|
->defaultValue('innmind_rest_server.specification_builder.default') |
|
60
|
15 |
|
->end() |
|
61
|
15 |
|
->scalarNode('range_extractor') |
|
62
|
15 |
|
->defaultValue('innmind_rest_server.range_extractor.delegation') |
|
63
|
15 |
|
->end() |
|
64
|
15 |
|
->arrayNode('response') |
|
65
|
15 |
|
->addDefaultsIfNotSet() |
|
66
|
15 |
|
->children() |
|
67
|
15 |
|
->arrayNode('header_builders') |
|
68
|
15 |
|
->addDefaultsIfNotSet() |
|
69
|
15 |
|
->children() |
|
70
|
15 |
|
->scalarNode('list') |
|
71
|
15 |
|
->defaultValue('innmind_rest_server.response.header_builder.list_delegation') |
|
72
|
15 |
|
->end() |
|
73
|
15 |
|
->end() |
|
74
|
15 |
|
->end() |
|
75
|
15 |
|
->end() |
|
76
|
15 |
|
->end() |
|
77
|
15 |
|
->end(); |
|
78
|
|
|
|
|
79
|
15 |
|
return $treeBuilder; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|