예제 #1
0
 private function compileArguments(Compiler $compiler)
 {
     $compiler->raw('[');
     $first = true;
     foreach ($this->nodes as $name => $node) {
         if (!$first) {
             $compiler->raw(',');
         }
         if (is_string($name)) {
             $compiler->string($name)->raw(' => ');
         }
         $node->compile($compiler);
         $first = false;
     }
     $compiler->raw(']');
 }
예제 #2
0
 public function compile(Compiler $compiler)
 {
     $compiler->raw('array(');
     $elements = $this->getNode(self::NODE_ELEMENTS);
     $first = true;
     foreach ($elements as $element) {
         if (!$first) {
             $compiler->raw(',');
         }
         list($key, $value) = $element;
         if ($key) {
             if ($key instanceof Constant) {
                 $compiler->subcompile($key);
             } elseif ($key instanceof Name) {
                 $compiler->string($key->getName());
             }
             $compiler->raw(' => ');
         }
         $compiler->subcompile($value);
         $first = false;
     }
     $compiler->raw(')');
 }