1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2015 SURFnet bv |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Surfnet\StepupGateway\U2fVerificationBundle\DependencyInjection; |
20
|
|
|
|
21
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
22
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
23
|
|
|
|
24
|
|
|
class Configuration implements ConfigurationInterface |
25
|
|
|
{ |
26
|
|
|
public function getConfigTreeBuilder() |
27
|
|
|
{ |
28
|
|
|
$treeBuilder = new TreeBuilder; |
29
|
|
|
|
30
|
|
|
$treeBuilder |
31
|
|
|
->root('surfnet_stepup_gateway_u2f_verification') |
32
|
|
|
->children() |
33
|
|
|
->arrayNode('migrations') |
34
|
|
|
->addDefaultsIfNotSet() |
35
|
|
|
->children() |
36
|
|
|
->scalarNode('diff_entity_manager') |
37
|
|
|
->info( |
38
|
|
|
'This is the name of the Doctrine entity manager that is used for schema ' . |
39
|
|
|
'diffing. If it is unspecified, or NULL, the default entity manager is used.' |
40
|
|
|
) |
41
|
|
|
->defaultNull() |
42
|
|
|
->validate() |
43
|
|
|
->ifTrue( |
44
|
|
|
function ($entityManagerName) { |
45
|
|
|
return !is_string($entityManagerName) && $entityManagerName !== null; |
46
|
|
|
} |
47
|
|
|
) |
48
|
|
|
->thenInvalid( |
49
|
|
|
'surfnet_stepup_gateway_u2f_verification.migrations.diff_entity_manager should ' . |
50
|
|
|
'be a string or NULL' |
51
|
|
|
) |
52
|
|
|
->end() |
53
|
|
|
->end() |
54
|
|
|
->scalarNode('migrate_entity_manager') |
55
|
|
|
->info( |
56
|
|
|
'This is the name of the Doctrine entity manager that is used for migrations. ' . |
57
|
|
|
'If it is unspecified, or NULL, the default entity manager is used.' |
58
|
|
|
) |
59
|
|
|
->defaultNull() |
60
|
|
|
->validate() |
61
|
|
|
->ifTrue( |
62
|
|
|
function ($entityManagerName) { |
63
|
|
|
return !is_string($entityManagerName) && $entityManagerName !== null; |
64
|
|
|
} |
65
|
|
|
) |
66
|
|
|
->thenInvalid( |
67
|
|
|
'surfnet_stepup_gateway_u2f_verification.migrations.migrate_entity_manager ' . |
68
|
|
|
'should be a string or NULL' |
69
|
|
|
) |
70
|
|
|
->end() |
71
|
|
|
->end() |
72
|
|
|
->end() |
73
|
|
|
->end() |
74
|
|
|
->end(); |
75
|
|
|
|
76
|
|
|
return $treeBuilder; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|