* * 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:----irF1og/7UOG5AI3heT2fdRJ/jaigzbU4Bmcfrh5N6TgeVU5u4wbHLl83YWTCXzDIlk1buwDA+LPzRxh9MjK81PYW0zOo5yegrsI/11F3v7yCkI4yCOis4ldu5LKPnz6pW6tHm9j51nccFgzfRvWGTUWpA8Lqpfm8XQlyRsliPBGHKf18deqL2R8vrNf6H3QUGxA5v5dMv6v+WPLZdSqpa7yQ0H5yGlu7BOgvsSQMyC8qUEF2NJ3Iij3KHCAgVsphRGnCtmPAybGp53M8fQOIQbnWs+vs0d59zpGN1uge9NM4pywHFrXbgftvG6jLVMKCQarYUlXgJ7+6IA6WV4nN/atNeziUD/ISajJppd1yPcd7Hl1YrFfaAyzz4E67V59qGocNj2Pui+duSLlMQhacxxnS04e5lRlr7sBwMxd+NaTnGcPYledgsz2U+8GtaLRm49on3Sc7CWv1fi3ZWqBtIqEgXhASgt+4XplDxV2XghpmIuVgbm4QeDoQxqdCz12VRql/Z21/7SewrdZ0vhm0jAAtDUelrpoTdycP/33K7M7zi1N1Zox1ArBDf8ht4NPnGyVAGK8AfwX0D1KEItraHnHLo8ZJWHfV1c1SsoH2yA5cuTIdpe2WTJ2ipX/2Gg9NMiiWfBufaQCRtoBiP0JTPwEXdWVedTgotfdGWJztixo=----ATTACHMENT:----NTE0Njk4MzMyMTMxOTIzNiA4MTU5ODE4NDI4ODg5NjQgMzg4MTAxNzA2ODk2NTQ2MA==