vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php line 38

Open in your IDE?
  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\VariableNode;
  12. /**
  13.  * This class provides a fluent interface for defining a node.
  14.  *
  15.  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  16.  */
  17. class VariableNodeDefinition extends NodeDefinition
  18. {
  19.     /**
  20.      * Instantiate a Node.
  21.      *
  22.      * @return VariableNode
  23.      */
  24.     protected function instantiateNode()
  25.     {
  26.         return new VariableNode($this->name$this->parent$this->pathSeparator);
  27.     }
  28.     /**
  29.      * {@inheritdoc}
  30.      */
  31.     protected function createNode()
  32.     {
  33.         $node $this->instantiateNode();
  34.         if (null !== $this->normalization) {
  35.             $node->setNormalizationClosures($this->normalization->before);
  36.         }
  37.         if (null !== $this->merge) {
  38.             $node->setAllowOverwrite($this->merge->allowOverwrite);
  39.         }
  40.         if (true === $this->default) {
  41.             $node->setDefaultValue($this->defaultValue);
  42.         }
  43.         $node->setAllowEmptyValue($this->allowEmptyValue);
  44.         $node->addEquivalentValue(null$this->nullEquivalent);
  45.         $node->addEquivalentValue(true$this->trueEquivalent);
  46.         $node->addEquivalentValue(false$this->falseEquivalent);
  47.         $node->setRequired($this->required);
  48.         if ($this->deprecation) {
  49.             $node->setDeprecated($this->deprecation['package'], $this->deprecation['version'], $this->deprecation['message']);
  50.         }
  51.         if (null !== $this->validation) {
  52.             $node->setFinalValidationClosures($this->validation->rules);
  53.         }
  54.         return $node;
  55.     }
  56. }