コード例 #1
0
ファイル: Call.php プロジェクト: jasmun/Noco100
 protected function compileArguments(IfwPsn_Vendor_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(')');
 }