You are here

public static function Twig_Token::typeToEnglish in Translation template extractor 7.2

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

Returns the english representation of a given type.

Parameters

integer $type The type as an integer:

Return value

string The string representation

1 call to Twig_Token::typeToEnglish()
Twig_TokenStream::expect in vendor/Twig/TokenStream.php
Tests a token and returns it or throws a syntax error.

File

vendor/Twig/Token.php, line 183

Class

Twig_Token
Represents a Token.

Code

public static function typeToEnglish($type) {
  switch ($type) {
    case self::EOF_TYPE:
      return 'end of template';
    case self::TEXT_TYPE:
      return 'text';
    case self::BLOCK_START_TYPE:
      return 'begin of statement block';
    case self::VAR_START_TYPE:
      return 'begin of print statement';
    case self::BLOCK_END_TYPE:
      return 'end of statement block';
    case self::VAR_END_TYPE:
      return 'end of print statement';
    case self::NAME_TYPE:
      return 'name';
    case self::NUMBER_TYPE:
      return 'number';
    case self::STRING_TYPE:
      return 'string';
    case self::OPERATOR_TYPE:
      return 'operator';
    case self::PUNCTUATION_TYPE:
      return 'punctuation';
    case self::INTERPOLATION_START_TYPE:
      return 'begin of string interpolation';
    case self::INTERPOLATION_END_TYPE:
      return 'end of string interpolation';
    default:
      throw new LogicException(sprintf('Token of type "%s" does not exist.', $type));
  }
}