1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the PierstovalCharacterManagerBundle package. |
7
|
|
|
* |
8
|
|
|
* (c) Alexandre Rock Ancelet <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Pierstoval\Bundle\CharacterManagerBundle\DependencyInjection; |
15
|
|
|
|
16
|
|
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
17
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* This is the class that validates and merges configuration from your app/config files. |
21
|
|
|
* |
22
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} |
23
|
|
|
*/ |
24
|
|
|
class Configuration implements ConfigurationInterface |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* {@inheritdoc} |
28
|
|
|
*/ |
29
|
|
|
public function getConfigTreeBuilder() |
30
|
|
|
{ |
31
|
|
|
$treeBuilder = new TreeBuilder('pierstoval_character_manager'); |
32
|
|
|
$rootNode = $treeBuilder->getRootNode(); |
33
|
|
|
|
34
|
|
|
$rootNode |
35
|
|
|
->addDefaultsIfNotSet() |
36
|
|
|
->children() |
37
|
|
|
->arrayNode('managers') |
38
|
|
|
->useAttributeAsKey('name') |
39
|
|
|
->normalizeKeys(true) |
40
|
|
|
->arrayPrototype() |
41
|
|
|
->children() |
42
|
|
|
->scalarNode('character_class')->isRequired()->end() |
43
|
|
|
->arrayNode('steps') |
44
|
|
|
->useAttributeAsKey('name') |
45
|
|
|
->arrayPrototype() |
46
|
|
|
->children() |
47
|
|
|
->scalarNode('action') |
48
|
|
|
->info('Can be a class or a service. Must implement StepActionInterface or extend abstract Action class.') |
49
|
|
|
->isRequired() |
50
|
|
|
->end() |
51
|
|
|
->scalarNode('label')->defaultValue('')->end() |
52
|
|
|
->arrayNode('dependencies') |
53
|
|
|
->info('Steps that the current step may depend on. If step is not set in session, will throw an exception.') |
54
|
|
|
->defaultValue([]) |
55
|
|
|
->scalarPrototype()->end() |
56
|
|
|
->end() |
57
|
|
|
->arrayNode('onchange_clear') |
58
|
|
|
->info("When this step will be updated, it will clear values for specified steps.\nOnly available for the abstract class") |
59
|
|
|
->defaultValue([]) |
60
|
|
|
->scalarPrototype()->end() |
61
|
|
|
->end() |
62
|
|
|
->end() |
63
|
|
|
->end() |
64
|
|
|
->end() |
65
|
|
|
->end() |
66
|
|
|
->end() |
67
|
|
|
->end() |
68
|
|
|
; |
69
|
|
|
|
70
|
|
|
return $treeBuilder; |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|