equal
deleted
inserted
replaced
12 * obtain it through the world-wide-web, please send an email |
12 * obtain it through the world-wide-web, please send an email |
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_Validate |
16 * @package Zend_Validate |
17 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
17 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @version $Id: Identical.php 24593 2012-01-05 20:35:02Z matthew $ |
19 * @version $Id$ |
20 */ |
20 */ |
21 |
21 |
22 /** @see Zend_Validate_Abstract */ |
22 /** @see Zend_Validate_Abstract */ |
23 require_once 'Zend/Validate/Abstract.php'; |
23 require_once 'Zend/Validate/Abstract.php'; |
24 |
24 |
25 /** |
25 /** |
26 * @category Zend |
26 * @category Zend |
27 * @package Zend_Validate |
27 * @package Zend_Validate |
28 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
28 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
29 * @license http://framework.zend.com/license/new-bsd New BSD License |
29 * @license http://framework.zend.com/license/new-bsd New BSD License |
30 */ |
30 */ |
31 class Zend_Validate_Identical extends Zend_Validate_Abstract |
31 class Zend_Validate_Identical extends Zend_Validate_Abstract |
32 { |
32 { |
33 /** |
33 /** |
62 protected $_strict = true; |
62 protected $_strict = true; |
63 |
63 |
64 /** |
64 /** |
65 * Sets validator options |
65 * Sets validator options |
66 * |
66 * |
67 * @param mixed $token |
67 * @param mixed $token |
68 * @return void |
|
69 */ |
68 */ |
70 public function __construct($token = null) |
69 public function __construct($token = null) |
71 { |
70 { |
72 if ($token instanceof Zend_Config) { |
71 if ($token instanceof Zend_Config) { |
73 $token = $token->toArray(); |
72 $token = $token->toArray(); |
100 * @param mixed $token |
99 * @param mixed $token |
101 * @return Zend_Validate_Identical |
100 * @return Zend_Validate_Identical |
102 */ |
101 */ |
103 public function setToken($token) |
102 public function setToken($token) |
104 { |
103 { |
105 $this->_tokenString = (string) $token; |
104 $this->_tokenString = $token; |
106 $this->_token = $token; |
105 $this->_token = $token; |
107 return $this; |
106 return $this; |
108 } |
107 } |
109 |
108 |
110 /** |
109 /** |
119 |
118 |
120 /** |
119 /** |
121 * Sets the strict parameter |
120 * Sets the strict parameter |
122 * |
121 * |
123 * @param Zend_Validate_Identical |
122 * @param Zend_Validate_Identical |
|
123 * @return $this |
124 */ |
124 */ |
125 public function setStrict($strict) |
125 public function setStrict($strict) |
126 { |
126 { |
127 $this->_strict = (boolean) $strict; |
127 $this->_strict = (boolean) $strict; |
128 return $this; |
128 return $this; |
138 * @param array $context |
138 * @param array $context |
139 * @return boolean |
139 * @return boolean |
140 */ |
140 */ |
141 public function isValid($value, $context = null) |
141 public function isValid($value, $context = null) |
142 { |
142 { |
143 $this->_setValue((string) $value); |
143 $this->_setValue($value); |
144 |
144 |
145 if (($context !== null) && isset($context) && array_key_exists($this->getToken(), $context)) { |
145 if (($context !== null) && isset($context) && array_key_exists($this->getToken(), $context)) { |
146 $token = $context[$this->getToken()]; |
146 $token = $context[$this->getToken()]; |
147 } else { |
147 } else { |
148 $token = $this->getToken(); |
148 $token = $this->getToken(); |