Example #1
0
 public function addChild(Node $node, $key = null)
 {
     if (!$node instanceof RootNode) {
         throw new \InvalidArgumentException('ClassNode expects only RootNode children');
     }
     return parent::addChild($node, $key);
 }
Example #2
0
 /**
  * @param Node $node
  * @param      $for
  */
 private function addFilterNode(Node $node, $for)
 {
     if (!$this->environment->hasFunction('filter_' . $for)) {
         $for = $this->defaultAutofilterStrategy;
     }
     $node->addChild(new FunctionNode('filter_' . $for, [$node->getChild('expression')]), 'expression');
 }