Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
zendframework1
library
Zend
Validate
Between.php
Go to the documentation of this file.
1
<?php
25
#require_once 'Zend/Validate/Abstract.php';
26
33
class
Zend_Validate_Between
extends
Zend_Validate_Abstract
34
{
38
const
NOT_BETWEEN
=
'notBetween'
;
39
43
const
NOT_BETWEEN_STRICT
=
'notBetweenStrict'
;
44
50
protected
$_messageTemplates
= array(
51
self::NOT_BETWEEN =>
"'%value%' is not between '%min%' and '%max%', inclusively"
,
52
self::NOT_BETWEEN_STRICT =>
"'%value%' is not strictly between '%min%' and '%max%'"
53
);
54
60
protected
$_messageVariables
= array(
61
'min'
=>
'_min'
,
62
'max'
=>
'_max'
63
);
64
70
protected
$_min
;
71
77
protected
$_max
;
78
87
protected
$_inclusive
;
88
99
public
function
__construct
(
$options
)
100
{
101
if
(
$options
instanceof
Zend_Config
) {
102
$options
=
$options
->toArray();
103
}
else
if
(!is_array(
$options
)) {
104
$options
= func_get_args();
105
$temp[
'min'
] = array_shift(
$options
);
106
if
(!empty(
$options
)) {
107
$temp[
'max'
] = array_shift(
$options
);
108
}
109
110
if
(!empty(
$options
)) {
111
$temp[
'inclusive'
] = array_shift(
$options
);
112
}
113
114
$options
= $temp;
115
}
116
117
if
(!array_key_exists(
'min'
,
$options
) || !array_key_exists(
'max'
,
$options
)) {
118
#require_once 'Zend/Validate/Exception.php';
119
throw
new
Zend_Validate_Exception
(
"Missing option. 'min' and 'max' has to be given"
);
120
}
121
122
if
(!array_key_exists(
'inclusive'
,
$options
)) {
123
$options
[
'inclusive'
] =
true
;
124
}
125
126
$this->
setMin
(
$options
[
'min'
])
127
->setMax(
$options
[
'max'
])
128
->setInclusive(
$options
[
'inclusive'
]);
129
}
130
136
public
function
getMin
()
137
{
138
return
$this->_min
;
139
}
140
147
public
function
setMin
($min)
148
{
149
$this->_min = $min;
150
return
$this;
151
}
152
158
public
function
getMax
()
159
{
160
return
$this->_max
;
161
}
162
169
public
function
setMax
($max)
170
{
171
$this->_max = $max;
172
return
$this;
173
}
174
180
public
function
getInclusive
()
181
{
182
return
$this->_inclusive
;
183
}
184
191
public
function
setInclusive
($inclusive)
192
{
193
$this->_inclusive = $inclusive;
194
return
$this;
195
}
196
206
public
function
isValid
(
$value
)
207
{
208
$this->
_setValue
(
$value
);
209
210
if
($this->_inclusive) {
211
if
($this->_min >
$value
||
$value
> $this->_max) {
212
$this->
_error
(self::NOT_BETWEEN);
213
return
false
;
214
}
215
}
else
{
216
if
($this->_min >=
$value
||
$value
>= $this->_max) {
217
$this->
_error
(self::NOT_BETWEEN_STRICT);
218
return
false
;
219
}
220
}
221
return
true
;
222
}
223
224
}
Zend_Validate_Between\$_messageVariables
$_messageVariables
Definition:
Between.php:60
Zend_Validate_Between\$_inclusive
$_inclusive
Definition:
Between.php:87
Zend_Validate_Between\getMax
getMax()
Definition:
Between.php:158
Zend_Validate_Between\getMin
getMin()
Definition:
Between.php:136
Zend_Validate_Between\setMax
setMax($max)
Definition:
Between.php:169
Zend_Validate_Between
Definition:
Between.php:33
Zend_Validate_Abstract\_error
_error($messageKey, $value=null)
Definition:
Abstract.php:284
Zend_Validate_Between\__construct
__construct($options)
Definition:
Between.php:99
Zend_Validate_Between\$_max
$_max
Definition:
Between.php:77
$value
$value
Definition:
gender.phtml:16
Zend_Validate_Abstract
Definition:
Abstract.php:33
Zend_Validate_Between\getInclusive
getInclusive()
Definition:
Between.php:180
Zend_Validate_Abstract\_setValue
_setValue($value)
Definition:
Abstract.php:303
Zend_Validate_Between\setInclusive
setInclusive($inclusive)
Definition:
Between.php:191
Zend_Validate_Between\isValid
isValid($value)
Definition:
Between.php:206
Zend_Validate_Between\setMin
setMin($min)
Definition:
Between.php:147
Zend_Config
Zend_Validate_Exception
Definition:
Exception.php:33
Zend_Validate_Between\NOT_BETWEEN_STRICT
const NOT_BETWEEN_STRICT
Definition:
Between.php:43
Zend_Validate_Between\NOT_BETWEEN
const NOT_BETWEEN
Definition:
Between.php:38
$options
$options
Definition:
multiple_mixed_products.php:29
Zend_Validate_Between\$_min
$_min
Definition:
Between.php:70
Zend_Validate_Between\$_messageTemplates
$_messageTemplates
Definition:
Between.php:50