You are here

public function Twig_TokenStream::nextIf in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/TokenStream.php \Twig_TokenStream::nextIf()
  2. 7.2 vendor/Twig/TokenStream.php \Twig_TokenStream::nextIf()

Tests a token, sets the pointer to the next one and returns it or throws a syntax error.

Return value

Twig_Token|null The next token if the condition is true, null otherwise

File

vendor/Twig/TokenStream.php, line 71

Class

Twig_TokenStream
Represents a token stream.

Code

public function nextIf($primary, $secondary = null) {
  if ($this->tokens[$this->current]
    ->test($primary, $secondary)) {
    return $this
      ->next();
  }
}