"'%value%' must contain only digits", self::STRING_EMPTY => "'%value%' is an empty string", self::INVALID => "Invalid type given. String, integer or float expected", ); /** * Defined by Zend_Validate_Interface * * Returns true if and only if $value only contains digit characters * * @param string $value * @return boolean */ public function isValid($value) { if (!is_string($value) && !is_int($value) && !is_float($value)) { $this->_error(self::INVALID); return false; } $this->_setValue((string) $value); if ('' === $this->_value) { $this->_error(self::STRING_EMPTY); return false; } if (null === self::$_filter) { require_once 'Zend/Filter/Digits.php'; self::$_filter = new Zend_Filter_Digits(); } if ($this->_value !== self::$_filter->filter($this->_value)) { $this->_error(self::NOT_DIGITS); return false; } return true; } }