You are here

protected function Twig_Node_Expression_Call::compileArguments in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Node/Expression/Call.php \Twig_Node_Expression_Call::compileArguments()
1 call to Twig_Node_Expression_Call::compileArguments()
Twig_Node_Expression_Call::compileCallable in vendor/Twig/Node/Expression/Call.php

File

vendor/Twig/Node/Expression/Call.php, line 37

Class

Twig_Node_Expression_Call

Code

protected function compileArguments(Twig_Compiler $compiler) {
  $compiler
    ->raw('(');
  $first = true;
  if ($this
    ->hasAttribute('needs_environment') && $this
    ->getAttribute('needs_environment')) {
    $compiler
      ->raw('$this->env');
    $first = false;
  }
  if ($this
    ->hasAttribute('needs_context') && $this
    ->getAttribute('needs_context')) {
    if (!$first) {
      $compiler
        ->raw(', ');
    }
    $compiler
      ->raw('$context');
    $first = false;
  }
  if ($this
    ->hasAttribute('arguments')) {
    foreach ($this
      ->getAttribute('arguments') as $argument) {
      if (!$first) {
        $compiler
          ->raw(', ');
      }
      $compiler
        ->string($argument);
      $first = false;
    }
  }
  if ($this
    ->hasNode('node')) {
    if (!$first) {
      $compiler
        ->raw(', ');
    }
    $compiler
      ->subcompile($this
      ->getNode('node'));
    $first = false;
  }
  if ($this
    ->hasNode('arguments') && null !== $this
    ->getNode('arguments')) {
    $callable = $this
      ->hasAttribute('callable') ? $this
      ->getAttribute('callable') : null;
    $arguments = $this
      ->getArguments($callable, $this
      ->getNode('arguments'));
    foreach ($arguments as $node) {
      if (!$first) {
        $compiler
          ->raw(', ');
      }
      $compiler
        ->subcompile($node);
      $first = false;
    }
  }
  $compiler
    ->raw(')');
}