Configuration.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection;
  11. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  12. use Symfony\Component\Config\Definition\ConfigurationInterface;
  13. /**
  14. * This class contains the configuration information for the bundle
  15. *
  16. * This information is solely responsible for how the different configuration
  17. * sections are normalized, and merged.
  18. *
  19. * @author Fabien Potencier <fabien@symfony.com>
  20. */
  21. class Configuration implements ConfigurationInterface
  22. {
  23. /**
  24. * Generates the configuration tree builder.
  25. *
  26. * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
  27. */
  28. public function getConfigTreeBuilder()
  29. {
  30. $treeBuilder = new TreeBuilder();
  31. $rootNode = $treeBuilder->root('web_profiler');
  32. $rootNode
  33. ->children()
  34. ->booleanNode('toolbar')->defaultFalse()->end()
  35. ->scalarNode('position')
  36. ->defaultValue('bottom')
  37. ->validate()
  38. ->ifNotInArray(array('bottom', 'top'))
  39. ->thenInvalid('The CSS position %s is not supported')
  40. ->end()
  41. ->end()
  42. ->booleanNode('intercept_redirects')->defaultFalse()->end()
  43. ->end()
  44. ;
  45. return $treeBuilder;
  46. }
  47. }