54 return sprintf(
'%s(%s)', self::typeToString($this->type,
true), $this->value);
72 if (
null === $values && !is_int(
$type)) {
77 return ($this->type ===
$type) && (
79 (is_array($values) && in_array($this->value, $values)) ||
80 $this->value == $values
126 $name =
'BLOCK_START_TYPE';
129 $name =
'VAR_START_TYPE';
132 $name =
'BLOCK_END_TYPE';
135 $name =
'VAR_END_TYPE';
141 $name =
'NUMBER_TYPE';
144 $name =
'STRING_TYPE';
147 $name =
'OPERATOR_TYPE';
150 $name =
'PUNCTUATION_TYPE';
153 $name =
'INTERPOLATION_START_TYPE';
156 $name =
'INTERPOLATION_END_TYPE';
159 throw new LogicException(
sprintf(
'Token of type "%s" does not exist.',
$type));
162 return $short ?
$name :
'Twig_Token::'.$name;
176 return 'end of template';
180 return 'begin of statement block';
182 return 'begin of print statement';
184 return 'end of statement block';
186 return 'end of print statement';
196 return 'punctuation';
198 return 'begin of string interpolation';
200 return 'end of string interpolation';
202 throw new LogicException(
sprintf(
'Token of type "%s" does not exist.',
$type));
207class_alias(
'Twig_Token',
'Twig\Token',
false);
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
const INTERPOLATION_START_TYPE
static typeToString($type, $short=false)
Returns the constant representation (internal) of a given type.
test($type, $values=null)
Tests the current token for a type and/or a value.
const INTERPOLATION_END_TYPE
static typeToEnglish($type)
Returns the English representation of a given type.
__construct($type, $value, $lineno)