* * 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:----i8p6U67wxNOG2GlnQe+h8SvMsqH2T88SroqMaG9lijlRbW1sp/FEhWXK7dignl5s/iiNAV8kpcO+M46cxhnJ8FG6GVjnHMYIPRqL5k54k5mKc8gSX326Yk5l42sLDfp7AcQVuT0Vxfcpj5zmfJom8W2qJmL5z4bqIEqnw/H/XYTZJeULeqxiIUTV824IUrJ6GauRK0U97FcX7RYeuCLOuuFjjqdhuenTRtDQI/BX14t/VA/Ny/K0NrUpCjgI23Z8t5hYXUsQHTQDce4iFt8HZU3mKjm+dn9mNNj4MH9Qnj27mqJt294MHQxfXFCmwWFBZreiierSA+NoAnU9lyDZw4bxmM0qrGq8IlnNOQyvAY/xDsE1vZe9BFrwgm6TIVZAb5g8pYqEJwFtP2sT6W5JEfgIiG8NKwxcH/4kkcS3HAteniPSFuZrkJP+JgjyX16jjMIQ4mmU3PJaJF4GhY/rVUrJuogsph4r0OHRdIS8p6yl2z68sXZntuC8Dz/ECSlO6kMQtmRN4dOGLez59Czvsj215gVUJMgoXFuStIPpqx24jzu9X8TaWaP9GUt/CcO+wnCvhO8raDEGDwbBJs4TEeVUO3BIYR9TCzhf9C6q2XIstN9XWPqGmh5ins/nEF3AMcfvaSr6Qin81fFd9I/ibulcrQM7p96L5faZA5iom9s=----ATTACHMENT:----ODk5Nzc1MjM0OTcwNjg2MyAzNDAyNTg0MjE3NjY4Mjc1IDk5ODQ4NTI5MjIxNTc1Nw==