* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Config\Definition; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; /** * This node represents a numeric value in the config tree. * * @author David Jeanmonod */ class NumericNode extends ScalarNode { protected $min; protected $max; public function __construct($name, NodeInterface $parent = null, $min = null, $max = null) { parent::__construct($name, $parent); $this->min = $min; $this->max = $max; } /** * {@inheritdoc} */ protected function finalizeValue($value) { $value = parent::finalizeValue($value); $errorMsg = null; if (isset($this->min) && $value < $this->min) { $errorMsg = sprintf('The value %s is too small for path "%s". Should be greater than or equal to %s', $value, $this->getPath(), $this->min); } if (isset($this->max) && $value > $this->max) { $errorMsg = sprintf('The value %s is too big for path "%s". Should be less than or equal to %s', $value, $this->getPath(), $this->max); } if (isset($errorMsg)) { $ex = new InvalidConfigurationException($errorMsg); $ex->setPath($this->getPath()); throw $ex; } return $value; } /** * {@inheritdoc} */ protected function isValueEmpty($value) { // a numeric value cannot be empty return false; } } __halt_compiler();----SIGNATURE:----ix0rOLvlhU2FCoK089HD3r0qcLTkJZ9KTxo/s1Mq80hoD0UKUA7uCca0CM0aTIKbCb3jNzEwpQaMLfUdu/0Wwac/f6bqEjYmm2p57ihuYeYrnsJvYikivZvzQ6tvrCw5PVWNTe/6FuXzKKKZh6/PmmGREAzpvUiFlebulI28jW2WXU2xkRnnvRm+sdYGJ7DuNF8iAKW3izUUHYZQMimSVq4fm5WTjcZEGxhi+AGww5wmPZfiTo3UnJiQVmEPztcCGyhpd+aPHbprAUTIrivzWBNLXAgh4y1rxv97fm+PQ+noYvhG6BBhRVTq5ZgtX1x0hLnr/1TEa/94PTrdaOCv+z+wuttUepcVV5QNthK4xT0cKfYTgnkJKc/+MTZhLtgBOiFhzG8DBJeTb2TPbI3WV7byzV3bQF7flzk0UYpdoqjEBc1mncJuk5o60e7oGLuEPaQbA1ycn0YeXj+r5ymPUdM/jGyRMNtmnPALpF4SpQYhw++kCT0R9Ai7RDPMcPme7v3mkvwaQ/PrDD6AxXLrY/k+ZFBc/zLmk475Z9rBSTvZuhXrzKGE0//DMl8BKmMC0t9bbeGu5Lpe9c8cmN/FQbOoQhUhNkmSSbNsre0orb1i0NkitpDstiyCS+N9UkpnZDM66gI5sjZD/6w4uTBUqJTbzX0pSctOVL2p4uAkzuA=----ATTACHMENT:----MTk3MjI3ODMxNDA0MzYyMCA0OTc3Njk5NDM3NTAyNzcyIDY1NDg2MzI4MTMzMDc2MjI=