You are here

public function Twig_Extension_Core::parseTestExpression in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Extension/Core.php \Twig_Extension_Core::parseTestExpression()
1 call to Twig_Extension_Core::parseTestExpression()
Twig_Extension_Core::parseNotTestExpression in vendor/Twig/Extension/Core.php

File

vendor/Twig/Extension/Core.php, line 298

Class

Twig_Extension_Core

Code

public function parseTestExpression(Twig_Parser $parser, Twig_NodeInterface $node) {
  $stream = $parser
    ->getStream();
  $name = $this
    ->getTestName($parser, $node
    ->getLine());
  $class = $this
    ->getTestNodeClass($parser, $name);
  $arguments = null;
  if ($stream
    ->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
    $arguments = $parser
      ->getExpressionParser()
      ->parseArguments(true);
  }
  return new $class($node, $name, $arguments, $parser
    ->getCurrentToken()
    ->getLine());
}