BooleanNodeDefinition.php 945 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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\Component\Config\Definition\Builder;
  11. use Symfony\Component\Config\Definition\BooleanNode;
  12. /**
  13. * This class provides a fluent interface for defining a node.
  14. *
  15. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  16. */
  17. class BooleanNodeDefinition extends ScalarNodeDefinition
  18. {
  19. /**
  20. * {@inheritDoc}
  21. */
  22. public function __construct($name, NodeParentInterface $parent = null)
  23. {
  24. parent::__construct($name, $parent);
  25. $this->nullEquivalent = true;
  26. }
  27. /**
  28. * Instantiate a Node
  29. *
  30. * @return BooleanNode The node
  31. */
  32. protected function instantiateNode()
  33. {
  34. return new BooleanNode($this->name, $this->parent);
  35. }
  36. }