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
Identical.php
Go to the documentation of this file.
1
<?php
23
#require_once 'Zend/Validate/Abstract.php';
24
31
class
Zend_Validate_Identical
extends
Zend_Validate_Abstract
32
{
37
const
NOT_SAME
=
'notSame'
;
38
const
MISSING_TOKEN
=
'missingToken'
;
39
44
protected
$_messageTemplates
= array(
45
self::NOT_SAME =>
"The two given tokens do not match"
,
46
self::MISSING_TOKEN =>
'No token was provided to match against'
,
47
);
48
52
protected
$_messageVariables
= array(
53
'token'
=>
'_tokenString'
54
);
55
60
protected
$_tokenString
;
61
protected
$_token
;
62
protected
$_strict
=
true
;
63
69
public
function
__construct
(
$token
=
null
)
70
{
71
if
(
$token
instanceof
Zend_Config
) {
72
$token
=
$token
->toArray();
73
}
74
75
if
(is_array(
$token
) && array_key_exists(
'token'
,
$token
)) {
76
if
(array_key_exists(
'strict'
,
$token
)) {
77
$this->
setStrict
(
$token
[
'strict'
]);
78
}
79
80
$this->
setToken
(
$token
[
'token'
]);
81
}
else
if
(
null
!==
$token
) {
82
$this->
setToken
(
$token
);
83
}
84
}
85
91
public
function
getToken
()
92
{
93
return
$this->_token
;
94
}
95
102
public
function
setToken
(
$token
)
103
{
104
$this->_tokenString =
$token
;
105
$this->_token =
$token
;
106
return
$this;
107
}
108
114
public
function
getStrict
()
115
{
116
return
$this->_strict
;
117
}
118
125
public
function
setStrict
($strict)
126
{
127
$this->_strict = (boolean) $strict;
128
return
$this;
129
}
130
141
public
function
isValid
(
$value
, $context =
null
)
142
{
143
$this->
_setValue
(
$value
);
144
145
if
(($context !==
null
) && isset($context) && array_key_exists($this->
getToken
(), $context)) {
146
$token
= $context[$this->
getToken
()];
147
}
else
{
148
$token
= $this->
getToken
();
149
}
150
151
if
(
$token
===
null
) {
152
$this->
_error
(self::MISSING_TOKEN);
153
return
false
;
154
}
155
156
$strict = $this->
getStrict
();
157
if
(($strict && (
$value
!==
$token
)) || (!$strict && (
$value
!=
$token
))) {
158
$this->
_error
(self::NOT_SAME);
159
return
false
;
160
}
161
162
return
true
;
163
}
164
}
Zend_Validate_Identical\$_messageTemplates
$_messageTemplates
Definition:
Identical.php:44
Zend_Validate_Identical\MISSING_TOKEN
const MISSING_TOKEN
Definition:
Identical.php:38
Zend_Validate_Identical\$_token
$_token
Definition:
Identical.php:61
Zend_Validate_Abstract\_error
_error($messageKey, $value=null)
Definition:
Abstract.php:284
Zend_Validate_Identical\__construct
__construct($token=null)
Definition:
Identical.php:69
$token
$token
Definition:
fake_payment_token.php:14
Zend_Validate_Identical\getStrict
getStrict()
Definition:
Identical.php:114
$value
$value
Definition:
gender.phtml:16
Zend_Validate_Identical
Definition:
Identical.php:31
Zend_Validate_Abstract
Definition:
Abstract.php:33
Zend_Validate_Identical\$_strict
$_strict
Definition:
Identical.php:62
Zend_Validate_Abstract\_setValue
_setValue($value)
Definition:
Abstract.php:303
Zend_Validate_Identical\isValid
isValid($value, $context=null)
Definition:
Identical.php:141
Zend_Validate_Identical\setToken
setToken($token)
Definition:
Identical.php:102
Zend_Config
Zend_Validate_Identical\setStrict
setStrict($strict)
Definition:
Identical.php:125
Zend_Validate_Identical\getToken
getToken()
Definition:
Identical.php:91
Zend_Validate_Identical\NOT_SAME
const NOT_SAME
Definition:
Identical.php:37
Zend_Validate_Identical\$_messageVariables
$_messageVariables
Definition:
Identical.php:52
Zend_Validate_Identical\$_tokenString
$_tokenString
Definition:
Identical.php:60