• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Validate/Identical.php

00001 <?php
00023 require_once 'Zend/Validate/Abstract.php';
00024 
00031 class Zend_Validate_Identical extends Zend_Validate_Abstract
00032 {
00037     const NOT_SAME      = 'notSame';
00038     const MISSING_TOKEN = 'missingToken';
00039 
00044     protected $_messageTemplates = array(
00045         self::NOT_SAME      => "The token '%token%' does not match the given token '%value%'",
00046         self::MISSING_TOKEN => 'No token was provided to match against',
00047     );
00048 
00052     protected $_messageVariables = array(
00053         'token' => '_tokenString'
00054     );
00055 
00060     protected $_tokenString;
00061     protected $_token;
00062 
00069     public function __construct($token = null)
00070     {
00071         if (null !== $token) {
00072             $this->setToken($token);
00073         }
00074     }
00075 
00082     public function setToken($token)
00083     {
00084         $this->_tokenString = (string) $token;
00085         $this->_token       = $token;
00086         return $this;
00087     }
00088 
00094     public function getToken()
00095     {
00096         return $this->_token;
00097     }
00098 
00108     public function isValid($value)
00109     {
00110         $this->_setValue((string) $value);
00111         $token        = $this->getToken();
00112 
00113         if ($token === null) {
00114             $this->_error(self::MISSING_TOKEN);
00115             return false;
00116         }
00117 
00118         if ($value !== $token)  {
00119             $this->_error(self::NOT_SAME);
00120             return false;
00121         }
00122 
00123         return true;
00124     }
00125 }

Generated on Thu Apr 19 2012 17:01:18 for openbiz by  doxygen 1.7.2