Check if the value of the token conforms to the given policy for all-caps words.

@param  Token $token  Required.
@param  int   $policy Either ALLOW_ALL_CAPS, REQUIRE_ALL_CAPS or NO_ALL_CAPS.

@return bool
762732
protected function conforms_to_caps_policy( Token $token, $policy ) {
		return $this->check_policy(
			$token,
			$policy,
			self::ALLOW_ALL_CAPS,
			self::REQUIRE_ALL_CAPS,
			self::NO_ALL_CAPS,
			$this->current_strtoupper
		);
	}
909826
protected function validateTagToken(TagToken $token) : bool
    {
        $tagName = $token->getTagName();
        $tagDef = $this->tagDefs->get($tagName);
        if (!isset($tagDef)) {
            return false;
        }

        return $tagDef->validate($token);
    }
748991
public static function isValid(string $name, string $token): bool
    {
        $savedToken = Session::get($name, null, self::$namespace);
        if (isset($savedToken['token'])) {
            if (time() >= $savedToken['time'] + $savedToken['lifetime']) {
                $savedToken['token'] = '';
            }
            return $token === $savedToken['token'];
        }
        return false;
    }
739266
public static function match(Token $token, array $pattern)
    {
        // Token.
        if (isset($pattern['token'])
            && ($pattern['token'] !== $token->token)
        ) {
            return false;
        }

        // Value.
        if (isset($pattern['value'])
            && ($pattern['value'] !== $token->value)
        ) {
            return false;
        }

        if (isset($pattern['value_str'])
            && strcasecmp($pattern['value_str'], (string) $token->value)
        ) {
            return false;
        }

        // Type.
        if (isset($pattern['type'])
            && ($pattern['type'] !== $token->type)
        ) {
            return false;
        }

        // Flags.
        if (isset($pattern['flags'])
            && (($pattern['flags'] & $token->flags) === 0)
        ) {
            return false;
        }

        return true;
    }
413630
public function acceptToken($type, &$token = null)
    {
        $token = $this->peek();
        if (! isset($token[0]) or $token[0] != $type) {
            return false;
        }
        $this->pop();
        return true;
    }
703952
public static function isValid($token) {
        // Get configuration
        $expiration = Config::get('security.anti_csrf.expiration', 18000);
        // Compute for token availablity
        $computed = microtime(true) - (double)Text::unlock($token, self::getKey());
        
        return $computed <= $expiration;
    }
1341516
public static function isClause($token)
    {
        if (($token->type === Token::TYPE_KEYWORD && isset(Parser::$STATEMENT_PARSERS[$token->keyword]))
            || ($token->type === Token::TYPE_NONE && strtoupper($token->token) === 'DELIMITER')
        ) {
            return 2;
        } elseif ($token->type === Token::TYPE_KEYWORD && isset(Parser::$KEYWORD_PARSERS[$token->keyword])
        ) {
            return 1;
        }

        return false;
    }
154675
public static function hasToken(array $coll, $token)
    {
        if (!\is_array($token)) {
            return false;
        }

        return \in_array(\token_name($token[0]), $coll);
    }
344545
public function verify(TokenInterface $token): bool
    {
        $signer = $this->factory->create($token->algorithm());
        $key    = new Key($this->verifyKey->content(), $this->verifyKey->passphrase());

        return $signer->verify($token->signature(), $token->payload(), $key);
    }
233357
public static function validate(string $token, string $secret): bool
    {
        $parse = self::parser($token, $secret);

        if (!self::validateWithExpiration($parse)) {
            return false;
        }

        if (!self::validateNotBefore($parse)) {
            return false;
        }

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

		return false;
	}
642757
public function validateForgotPasswordToken($username, $token)
    {
        $this->username = $username;

        if ($this->getMeta()->forgotPasswordToken == $token) {
            $this->getMeta()->forgotPasswordToken = '';
            $this->getMeta()->save();

            return true;
        }

        return false;
    }
557055
public function requestHasToken($key)
    {
        $token = $this->request->input($key, null);
        
        if($token && $token === $this->getToken($key))
        {
            return true;
        }

        return false;
    }
1109629
private boolean _validate(Token token, Term term) {

		if (token == null) {
			return true;
		}

		Set<String> terms = token.getTerms();
		if ((!terms.contains(Token.ALL)) && !terms.contains(term.getName()) && !(terms.contains(":" + term.getNatureStr()))) {
			return true;
		}

		boolean flag = token.getRegexs().size() != 0;

		for (String regex : token.getRegexs()) {
			if (term.getName().matches(regex)) {
				flag = false;
				break;
			}
		}

		return flag;
	}
420462
final protected static function RawVerify( string $token ) : bool {
        
        self::InitSession( );
        
        $key = self::GetSessionKey( );
        foreach( $_SESSION[ $key ] as $i => $t ) {
            if( hash_equals( $t[self::key_Token], $token ) ) {
                unset( $_SESSION[ $key ][ $i ] );
                return true;
            }
        }
        
        return false;
        
    }
464203
protected function isCsrfTokenValid(string $id, ?string $token): bool
    {
        if (!$this->container->has('security.csrf.token_manager')) {
            throw new \LogicException('CSRF protection is not enabled in your application. Enable it with the "csrf_protection" key in "config/packages/framework.yaml".');
        }

        return $this->container->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($id, $token));
    }
161299
private function _checkComplexVariable2($token) {

		// Right after the { there is a $ with no space between
		if ($this->tokenizer->checkNextToken(T_DOLLAR) || ($this->tokenizer->checkNextToken(T_VARIABLE))) {

			// Detect the end of the complexe variable
			$closePos = $this->tokenizer->findNextTokenPosition(T_BRACES_CLOSE);

			if ($closePos !== null) {

				// Skip the analysis of the content of the variable.
				$this->tokenizer->setCurrentPosition($closePos + 1);

				return true;
			}
		}

		return false;
	}