@param mixed $token

@return bool
10365
private function isOpenTag($token): bool
    {
        if (!is_array($token)) {
            return false;
        }

        if ($token[0] == T_ECHO && $token[1] == '<?=') {
            return true;
        }

        return $token[0] == T_OPEN_TAG || $token[0] == T_OPEN_TAG_WITH_ECHO;
    }
1347288
public function isValid($token)
    {
        $this->validatePrepared();

        return $this->sessionBag->has(self::CSRF_TKN_NAME) && 
               $this->sessionBag->has(self::CSRF_TKN_TIME) && 
               $this->sessionBag->get(self::CSRF_TKN_NAME) === $token;
    }
6298
public static function isTokenValid(string $token): bool
    {
        if (!static::hasTokenStored()) {
            return false;
        }

        $storedToken = static::getStoredToken();
        return $storedToken->getToken() === $token;
    }
104266
public function revokeToken($token)
    {
        $revoked = false;
        $store = $this->getStore();
        $pool = $store->getTokens();
        if(!is_null($pool)){
            foreach($pool as $key => $savedToken){
                if($savedToken['token'] == $token){
                    unset($pool[$key]);
                    $revoked = true;
                    break;
                }
            }
        }
        $store->setTokens($pool);

        return $revoked;
    }
400585
public static function validate($token)
    {
        if ($token === null) {
            return false;
        }

        if (gettype($token) == 'string' && trim($token) == '') {
            // False if String Empty
            return false;
        }

        if (strlen($token) < 20) return false;
        if (strlen($token) > 50) return false;

        // Type 0: c0afcccdde5081d6429de37d16166ead
        $type0RegExpression = '/(^[a-z0-9]+$)/i';

        // Type 1: de305d54-75b4-431b-adb2-eb6b9e546014
        // UUID strict: http://en.wikipedia.org/wiki/Universally_unique_identifier#Definition
        $type1RegExpression = '/(^[a-f0-9]{8}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{12}$)/i';

        if (preg_match($type0RegExpression, $token) == false
            && preg_match($type1RegExpression, $token) == false
        ) {
            return false;
        }

        return true;
    }
110118
public static function isPasswordResetTokenValid(string $token) : bool
    {
        if (empty($token)) {
            return false;
        }
        $timestamp = (int) substr($token, strrpos($token, '_') + 1);
        $expire    = 3600;
        return $timestamp + $expire >= time();
    }
710639
public function checkObfuscatePart(Token $token)
    {
        $tokenValue = $token->getValue();
        return substr($tokenValue, 0, $this->config['hash']['session.index']) == $this->obfuscate($this->deobfuscate($tokenValue), $token->getDate());
    }
107409
public function validateToken($token)
    {
        // The token must match of course.
        if ($this->Token != $token) {
            return false;
        }

        // Has the token expired?
        if (strtotime($this->TokenExpiry) < time()) {
            return false;
        }

        $hashProvider = HashProvider::getProvider();
        return $hashProvider->compareHash($this->getSavedPasswordTokenData(), $token);
    }
373738
public function invalidate($token = false)
    {
        $this->requireToken($token);

        return $this->manager->invalidate($this->token);
    }
135237
protected function skipTo($token)
	{
		while (++$this->i < $this->cnt)
		{
			if ($this->tokens[$this->i] === $token)
			{
				return true;
			}
		}

		return false;
	}
519109
public function revokeToken($token)
    {
        $this->oauth->token = $token;
        $this->oauth->calltokenHandler();

        if ( ! $this->hasErrors()) {
            return $this->model->deleteToken(['key' => $token]);
        }

        return false;
    }
723031
public static function get_by_token($token) {
	$mysql = bootstrap::get_library('mysql');
	
	$sql   = "SELECT * FROM `login_tokens` WHERE `code` = '%s';";
	$login = $mysql::select('row', $sql, $token);
	if (empty($login)) {
		return false;
	}
	
	return new static($login['id']);
}
1370954
public function validateRequest($token)
    {

        // If no token was sent, don't try to _validate it.
        if (empty($token)) {
            $this->_badToken401();
        }

        $validateResponse = $this->_validate($token);

        // If the result is not an array or doesn't contain a subject, send a 401
        if ((!is_array($validateResponse)) || (!array_key_exists('sub', $validateResponse))) {
            $this->_badToken401();
        }

        if (array_key_exists('sub', $validateResponse)) {
            $this->_tokenData = $validateResponse;
            $this->_setPrincipal();
            $this->_setAttributes();
        }

        return true;
    }
906483
protected function checkToken($token)
    {
        if (!$token) {
            return false;
        }

        $file = $this->pathForToken($token);
        $content = null;

        if (file_exists($file)) {
            $content = file_get_contents($file);
            unlink($file);
        }

        return $content === $token;
    }
205863
public function validateOneTimeToken(string $token): bool
	{
		if(!empty($this->sessionData['mako.tokens']))
		{
			foreach($this->sessionData['mako.tokens'] as $key => $value)
			{
				if(hash_equals($value, $token))
				{
					unset($this->sessionData['mako.tokens'][$key]);

					return true;
				}
			}
		}

		return false;
	}
1075589
protected function validateToken($token)
  {
    $hash   = explode(':', config('app.key'))[0];
    $secret = explode(':', config('app.key'))[1];

    if ($hash == 'base64') $secret = base64_decode($secret);

    $validator = new TokenValidator;

    $validator->splitToken($token)
        ->validateExpiration()
        ->validateSignature($secret);

    $payLoad = $validator->getPayload();

    return json_decode($payLoad, true);
  }
1018099
public function saveToken($token)
    {
        $rows = $this->_db->query(
            'UPDATE '.$this->_dbConfig['table']
                        .' SET '.$this->_dbConfig['token'].' = :tk'
                        .' WHERE '.$this->_dbConfig['id'].' = :id',
            [':tk'=>$token, ':id'=>$this->_data['id']]
        );
        if ($rows > 0) {
            $this->_data['token'] = $token;
            return true;
        }
        return false;
    }