xiidea /
EasyConfigBundle
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Xiidea\EasyConfigBundle\DependencyInjection; |
||
| 4 | |||
| 5 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||
| 6 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
| 7 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||
| 8 | |||
| 9 | class Configuration implements ConfigurationInterface |
||
| 10 | { |
||
| 11 | const ROOT_NODE_NAME = 'xiidea_easy_config'; |
||
| 12 | |||
| 13 | public function getConfigTreeBuilder(): TreeBuilder |
||
| 14 | { |
||
| 15 | $treeBuilder = new TreeBuilder(self::ROOT_NODE_NAME); |
||
| 16 | $rootNode = $treeBuilder->getRootNode(); |
||
| 17 | |||
| 18 | $this->addRequiredConfigs($rootNode); |
||
| 19 | |||
| 20 | return $treeBuilder; |
||
| 21 | } |
||
| 22 | |||
| 23 | private function addRequiredConfigs(ArrayNodeDefinition $rootNode) |
||
| 24 | { |
||
| 25 | $rootNode |
||
| 26 | ->children() |
||
| 27 | ->scalarNode('config_class') |
||
| 28 | ->cannotBeOverwritten() |
||
| 29 | ->isRequired() |
||
| 30 | ->cannotBeEmpty() |
||
| 31 | ->end() |
||
| 32 | ->end(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 33 | } |
||
| 34 | } |
||
| 35 |