00001 <?php 00002 00027 require_once 'Zend/Validate/Abstract.php'; 00028 00029 00036 class Zend_Validate_LessThan extends Zend_Validate_Abstract 00037 { 00038 00039 const NOT_LESS = 'notLessThan'; 00040 00044 protected $_messageTemplates = array( 00045 self::NOT_LESS => "'%value%' is not less than '%max%'" 00046 ); 00047 00051 protected $_messageVariables = array( 00052 'max' => '_max' 00053 ); 00054 00060 protected $_max; 00061 00068 public function __construct($max) 00069 { 00070 $this->setMax($max); 00071 } 00072 00078 public function getMax() 00079 { 00080 return $this->_max; 00081 } 00082 00089 public function setMax($max) 00090 { 00091 $this->_max = $max; 00092 return $this; 00093 } 00094 00103 public function isValid($value) 00104 { 00105 $this->_setValue($value); 00106 if ($this->_max <= $value) { 00107 $this->_error(self::NOT_LESS); 00108 return false; 00109 } 00110 return true; 00111 } 00112 00113 }