You are here

public function Twig_TokenStream::nextIf in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/twig/twig/lib/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/twig/lib/Twig/TokenStream.php, line 70

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();
  }
}