/var/www/vhosts/ihelp.ro/httpdocs/vendor/twig/twig/src
NameSizeModeActions
Cache/-0755rm
Error/-0755rm
Extension/-0755rm
Loader/-0755rm
Node/-0755rm
NodeVisitor/-0755rm
Profiler/-0755rm
RuntimeLoader/-0755rm
Sandbox/-0755rm
Test/-0755rm
TokenParser/-0755rm
Util/-0755rm
Compiler.php50540644editdlrm
Environment.php249160644editdlrm
ExpressionParser.php336440644editdlrm
ExtensionSet.php133860644editdlrm
FileExtensionEscapingStrategy.php14390644editdlrm
Lexer.php199760644editdlrm
Markup.php9390644editdlrm
NodeTraverser.php18180644editdlrm
Parser.php112680644editdlrm
Source.php10230644editdlrm
Template.php128240644editdlrm
TemplateWrapper.php26930644editdlrm
Token.php55100644editdlrm
TokenStream.php35310644editdlrm
TwigFilter.php31830644editdlrm
TwigFunction.php29170644editdlrm
TwigTest.php23550644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/twig/twig/src/TokenStream.php (3531B)
*/ final class TokenStream { private $tokens; private $current = 0; private $source; public function __construct(array $tokens, Source $source = null) { $this->tokens = $tokens; $this->source = $source ?: new Source('', ''); } public function __toString() { return implode("\n", $this->tokens); } public function injectTokens(array $tokens) { $this->tokens = array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current)); } /** * Sets the pointer to the next token and returns the old one. */ public function next(): Token { if (!isset($this->tokens[++$this->current])) { throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current - 1]->getLine(), $this->source); } return $this->tokens[$this->current - 1]; } /** * Tests a token, sets the pointer to the next one and returns it or throws a syntax error. * * @return Token|null The next token if the condition is true, null otherwise */ public function nextIf($primary, $secondary = null) { if ($this->tokens[$this->current]->test($primary, $secondary)) { return $this->next(); } } /** * Tests a token and returns it or throws a syntax error. */ public function expect($type, $value = null, string $message = null): Token { $token = $this->tokens[$this->current]; if (!$token->test($type, $value)) { $line = $token->getLine(); throw new SyntaxError(sprintf('%sUnexpected token "%s"%s ("%s" expected%s).', $message ? $message.'. ' : '', Token::typeToEnglish($token->getType()), $token->getValue() ? sprintf(' of value "%s"', $token->getValue()) : '', Token::typeToEnglish($type), $value ? sprintf(' with value "%s"', $value) : ''), $line, $this->source ); } $this->next(); return $token; } /** * Looks at the next token. */ public function look(int $number = 1): Token { if (!isset($this->tokens[$this->current + $number])) { throw new SyntaxError('Unexpected end of template.', $this->tokens[$this->current + $number - 1]->getLine(), $this->source); } return $this->tokens[$this->current + $number]; } /** * Tests the current token. */ public function test($primary, $secondary = null): bool { return $this->tokens[$this->current]->test($primary, $secondary); } /** * Checks if end of stream was reached. */ public function isEOF(): bool { return /* Token::EOF_TYPE */ -1 === $this->tokens[$this->current]->getType(); } public function getCurrent(): Token { return $this->tokens[$this->current]; } /** * Gets the source associated with this stream. * * @internal */ public function getSourceContext(): Source { return $this->source; } }