diff options
Diffstat (limited to 'libs/Zend/Validate/Identical.php')
-rw-r--r-- | libs/Zend/Validate/Identical.php | 65 |
1 files changed, 13 insertions, 52 deletions
diff --git a/libs/Zend/Validate/Identical.php b/libs/Zend/Validate/Identical.php index 7b37574050..d1a046ea9f 100644 --- a/libs/Zend/Validate/Identical.php +++ b/libs/Zend/Validate/Identical.php @@ -14,18 +14,18 @@ * * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Identical.php 22077 2010-05-02 13:44:46Z thomas $ + * @version $Id: Identical.php 17684 2009-08-20 09:20:36Z yoshida@zend.co.jp $ */ /** @see Zend_Validate_Abstract */ -// require_once 'Zend/Validate/Abstract.php'; +require_once 'Zend/Validate/Abstract.php'; /** * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Validate_Identical extends Zend_Validate_Abstract @@ -42,7 +42,7 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract * @var array */ protected $_messageTemplates = array( - self::NOT_SAME => "The two given tokens do not match", + self::NOT_SAME => "The token '%token%' does not match the given token '%value%'", self::MISSING_TOKEN => 'No token was provided to match against', ); @@ -59,7 +59,6 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract */ protected $_tokenString; protected $_token; - protected $_strict = true; /** * Sets validator options @@ -69,32 +68,12 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract */ public function __construct($token = null) { - if ($token instanceof Zend_Config) { - $token = $token->toArray(); - } - - if (is_array($token) && array_key_exists('token', $token)) { - if (array_key_exists('strict', $token)) { - $this->setStrict($token['strict']); - } - - $this->setToken($token['token']); - } else if (null !== $token) { + if (null !== $token) { $this->setToken($token); } } /** - * Retrieve token - * - * @return string - */ - public function getToken() - { - return $this->_token; - } - - /** * Set token against which to compare * * @param mixed $token @@ -108,24 +87,13 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract } /** - * Returns the strict parameter - * - * @return boolean - */ - public function getStrict() - { - return $this->_strict; - } - - /** - * Sets the strict parameter + * Retrieve token * - * @param Zend_Validate_Identical + * @return string */ - public function setStrict($strict) + public function getToken() { - $this->_strict = (boolean) $strict; - return $this; + return $this->_token; } /** @@ -135,26 +103,19 @@ class Zend_Validate_Identical extends Zend_Validate_Abstract * matches that token. * * @param mixed $value - * @param array $context * @return boolean */ - public function isValid($value, $context = null) + public function isValid($value) { $this->_setValue((string) $value); - - if (($context !== null) && isset($context) && array_key_exists($this->getToken(), $context)) { - $token = $context[$this->getToken()]; - } else { - $token = $this->getToken(); - } + $token = $this->getToken(); if ($token === null) { $this->_error(self::MISSING_TOKEN); return false; } - $strict = $this->getStrict(); - if (($strict && ($value !== $token)) || (!$strict && ($value != $token))) { + if ($value !== $token) { $this->_error(self::NOT_SAME); return false; } |