protected function Twig_TokenParser_Include::parseArguments

2 calls to Twig_TokenParser_Include::parseArguments()
Twig_TokenParser_Embed::parse in drupal/core/vendor/twig/twig/lib/Twig/TokenParser/Embed.php
Parses a token and returns a node.
Twig_TokenParser_Include::parse in drupal/core/vendor/twig/twig/lib/Twig/TokenParser/Include.php
Parses a token and returns a node.

File

drupal/core/vendor/twig/twig/lib/Twig/TokenParser/Include.php, line 40

Class

Twig_TokenParser_Include
Includes a template.

Code

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