Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LessThan.php
Go to the documentation of this file.
1 <?php
25 #require_once 'Zend/Validate/Abstract.php';
26 
34 {
35  const NOT_LESS = 'notLessThan';
36 
40  protected $_messageTemplates = array(
41  self::NOT_LESS => "'%value%' is not less than '%max%'"
42  );
43 
47  protected $_messageVariables = array(
48  'max' => '_max'
49  );
50 
56  protected $_max;
57 
64  public function __construct($max)
65  {
66  if ($max instanceof Zend_Config) {
67  $max = $max->toArray();
68  }
69 
70  if (is_array($max)) {
71  if (array_key_exists('max', $max)) {
72  $max = $max['max'];
73  } else {
74  #require_once 'Zend/Validate/Exception.php';
75  throw new Zend_Validate_Exception("Missing option 'max'");
76  }
77  }
78 
79  $this->setMax($max);
80  }
81 
87  public function getMax()
88  {
89  return $this->_max;
90  }
91 
98  public function setMax($max)
99  {
100  $this->_max = $max;
101  return $this;
102  }
103 
112  public function isValid($value)
113  {
114  $this->_setValue($value);
115  if ($this->_max <= $value) {
116  $this->_error(self::NOT_LESS);
117  return false;
118  }
119  return true;
120  }
121 
122 }
_error($messageKey, $value=null)
Definition: Abstract.php:284
$value
Definition: gender.phtml:16