You are here

public function Twig_Token::test in Translation template extractor 7.2

Same name and namespace in other branches
  1. 6.3 vendor/Twig/Token.php \Twig_Token::test()
  2. 7.3 vendor/Twig/Token.php \Twig_Token::test()

Tests the current token for a type and/or a value.

Parameters may be:

  • just type
  • type and value (or array of possible values)
  • just value (or array of possible values) (NAME_TYPE is used as type)

Parameters

array|integer $type The type to test:

array|string|null $values The token value:

Return value

Boolean

File

vendor/Twig/Token.php, line 75

Class

Twig_Token
Represents a Token.

Code

public function test($type, $values = null) {
  if (null === $values && !is_int($type)) {
    $values = $type;
    $type = self::NAME_TYPE;
  }
  return $this->type === $type && (null === $values || is_array($values) && in_array($this->value, $values) || $this->value == $values);
}