Configuration.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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\DebugBundle\DependencyInjection;
  11. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  12. use Symfony\Component\Config\Definition\ConfigurationInterface;
  13. use Symfony\Component\VarDumper\Dumper\HtmlDumper;
  14. /**
  15. * DebugExtension configuration structure.
  16. *
  17. * @author Nicolas Grekas <p@tchwork.com>
  18. */
  19. class Configuration implements ConfigurationInterface
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function getConfigTreeBuilder()
  25. {
  26. $treeBuilder = new TreeBuilder('debug');
  27. $rootNode = $treeBuilder->getRootNode();
  28. $rootNode->children()
  29. ->integerNode('max_items')
  30. ->info('Max number of displayed items past the first level, -1 means no limit')
  31. ->min(-1)
  32. ->defaultValue(2500)
  33. ->end()
  34. ->integerNode('min_depth')
  35. ->info('Minimum tree depth to clone all the items, 1 is default')
  36. ->min(0)
  37. ->defaultValue(1)
  38. ->end()
  39. ->integerNode('max_string_length')
  40. ->info('Max length of displayed strings, -1 means no limit')
  41. ->min(-1)
  42. ->defaultValue(-1)
  43. ->end()
  44. ->scalarNode('dump_destination')
  45. ->info('A stream URL where dumps should be written to')
  46. ->example('php://stderr, or tcp://%env(VAR_DUMPER_SERVER)% when using the "server:dump" command')
  47. ->defaultNull()
  48. ->end()
  49. ->end()
  50. ;
  51. if (method_exists(HtmlDumper::class, 'setTheme')) {
  52. $rootNode
  53. ->children()
  54. ->enumNode('theme')
  55. ->info('Changes the color of the dump() output when rendered directly on the templating. "dark" (default) or "light"')
  56. ->example('dark')
  57. ->values(['dark', 'light'])
  58. ->defaultValue('dark')
  59. ->end()
  60. ->end()
  61. ;
  62. }
  63. return $treeBuilder;
  64. }
  65. }