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