You are here

protected function Twig_TokenParser_Include::parseArguments in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/TokenParser/Include.php \Twig_TokenParser_Include::parseArguments()
2 calls to Twig_TokenParser_Include::parseArguments()
Twig_TokenParser_Embed::parse in vendor/twig/twig/lib/Twig/TokenParser/Embed.php
Parses a token and returns a node.
Twig_TokenParser_Include::parse in vendor/twig/twig/lib/Twig/TokenParser/Include.php
Parses a token and returns a node.

File

vendor/twig/twig/lib/Twig/TokenParser/Include.php, line 33

Class

Twig_TokenParser_Include
Includes a template.

Code

protected function parseArguments() {
  $stream = $this->parser
    ->getStream();
  $ignoreMissing = false;
  if ($stream
    ->nextIf(Twig_Token::NAME_TYPE, 'ignore')) {
    $stream
      ->expect(Twig_Token::NAME_TYPE, 'missing');
    $ignoreMissing = true;
  }
  $variables = null;
  if ($stream
    ->nextIf(Twig_Token::NAME_TYPE, 'with')) {
    $variables = $this->parser
      ->getExpressionParser()
      ->parseExpression();
  }
  $only = false;
  if ($stream
    ->nextIf(Twig_Token::NAME_TYPE, 'only')) {
    $only = true;
  }
  $stream
    ->expect(Twig_Token::BLOCK_END_TYPE);
  return array(
    $variables,
    $only,
    $ignoreMissing,
  );
}