public static function Twig_Token::typeToString in Translation template extractor 6.3
Same name and namespace in other branches
- 7.3 vendor/Twig/Token.php \Twig_Token::typeToString()
- 7.2 vendor/Twig/Token.php \Twig_Token::typeToString()
Returns the constant representation (internal) of a given type.
Parameters
int $type The type as an integer:
bool $short Whether to return a short representation or not:
Return value
string The string representation
1 call to Twig_Token::typeToString()
- Twig_Token::__toString in vendor/
Twig/ Token.php - Returns a string representation of the token.
File
- vendor/
Twig/ Token.php, line 127
Class
- Twig_Token
- Represents a Token.
Code
public static function typeToString($type, $short = false) {
switch ($type) {
case self::EOF_TYPE:
$name = 'EOF_TYPE';
break;
case self::TEXT_TYPE:
$name = 'TEXT_TYPE';
break;
case self::BLOCK_START_TYPE:
$name = 'BLOCK_START_TYPE';
break;
case self::VAR_START_TYPE:
$name = 'VAR_START_TYPE';
break;
case self::BLOCK_END_TYPE:
$name = 'BLOCK_END_TYPE';
break;
case self::VAR_END_TYPE:
$name = 'VAR_END_TYPE';
break;
case self::NAME_TYPE:
$name = 'NAME_TYPE';
break;
case self::NUMBER_TYPE:
$name = 'NUMBER_TYPE';
break;
case self::STRING_TYPE:
$name = 'STRING_TYPE';
break;
case self::OPERATOR_TYPE:
$name = 'OPERATOR_TYPE';
break;
case self::PUNCTUATION_TYPE:
$name = 'PUNCTUATION_TYPE';
break;
case self::INTERPOLATION_START_TYPE:
$name = 'INTERPOLATION_START_TYPE';
break;
case self::INTERPOLATION_END_TYPE:
$name = 'INTERPOLATION_END_TYPE';
break;
default:
throw new LogicException(sprintf('Token of type "%s" does not exist.', $type));
}
return $short ? $name : 'Twig_Token::' . $name;
}