Horde_Token_Base::isValid PHP Метод

isValid() публичный Метод

Validate a signed token.
public isValid ( string $token, string $seed = '', integer $timeout = null, boolean $unique = false ) : boolean
$token string The signed token.
$seed string The unique ID of the token.
$timeout integer Timout of the token in seconds. Values below zero represent no timeout.
$unique boolean Should validation of the token succeed only once?
Результат boolean True if the token was valid.
    public function isValid($token, $seed = '', $timeout = null, $unique = false)
    {
        list($nonce, $hash) = $this->_decode($token);
        if ($hash != $this->_hash($nonce . $seed)) {
            return false;
        }
        if ($timeout === null) {
            $timeout = $this->_params['token_lifetime'];
        }
        if ($this->_isExpired($nonce, $timeout)) {
            return false;
        }
        if ($unique) {
            return $this->verify($token);
        }
        return true;
    }