| 1 | <?php |
||
| 8 | class KernelSubExtension extends AbstractSubExtension |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @inheritDoc |
||
| 12 | */ |
||
| 13 | 5 | public function getConfigKey() |
|
| 17 | |||
| 18 | /** |
||
| 19 | * @inheritDoc |
||
| 20 | */ |
||
| 21 | public function configure(ArrayNodeDefinition $builder) |
||
| 22 | { |
||
| 23 | 1 | $castToBool = function ($value) { |
|
| 24 | $filtered = filter_var( |
||
| 25 | $value, |
||
| 26 | FILTER_VALIDATE_BOOLEAN, |
||
| 27 | FILTER_NULL_ON_FAILURE |
||
| 28 | ); |
||
| 29 | |||
| 30 | return (null === $filtered) ? (bool) $value : $filtered; |
||
| 31 | 1 | }; |
|
| 32 | $builder |
||
| 33 | 1 | ->addDefaultsIfNotSet() |
|
| 34 | 1 | ->children() |
|
| 35 | 1 | ->scalarNode('bootstrap') |
|
| 36 | 1 | ->defaultValue('app/autoload.php') |
|
| 37 | 1 | ->end() |
|
| 38 | 1 | ->scalarNode('path') |
|
| 39 | 1 | ->defaultValue('app/AppKernel.php') |
|
| 40 | 1 | ->end() |
|
| 41 | 1 | ->scalarNode('class') |
|
| 42 | 1 | ->defaultValue('AppKernel') |
|
| 43 | 1 | ->end() |
|
| 44 | 1 | ->scalarNode('env') |
|
| 45 | 1 | ->defaultValue('test') |
|
| 46 | 1 | ->end() |
|
| 47 | 1 | ->booleanNode('debug') |
|
| 48 | 1 | ->beforeNormalization() |
|
| 49 | 1 | ->always() |
|
| 50 | 1 | ->then($castToBool) |
|
| 51 | 1 | ->end() |
|
| 52 | 1 | ->defaultTrue() |
|
| 53 | 1 | ->end() |
|
| 54 | 1 | ->booleanNode('reboot') |
|
| 55 | 1 | ->info('If true symfony kernel will be rebooted after each scenario/example') |
|
| 56 | 1 | ->beforeNormalization() |
|
| 57 | 1 | ->always() |
|
| 58 | 1 | ->then($castToBool) |
|
| 59 | 1 | ->end() |
|
| 60 | 1 | ->defaultTrue() |
|
| 61 | 1 | ->end() |
|
| 62 | 1 | ->end(); |
|
| 63 | 1 | } |
|
| 64 | |||
| 65 | /** |
||
| 66 | * {@inheritdoc} |
||
| 67 | */ |
||
| 68 | 3 | public function load(ContainerBuilder $container, array $config) |
|
| 85 | |||
| 86 | /** |
||
| 87 | * {@inheritdoc} |
||
| 88 | */ |
||
| 89 | 4 | public function process(ContainerBuilder $container) |
|
| 105 | } |
||
| 106 |