Esempio n. 1
0
 /**
  * @param array $stmts
  * @param array $replacements
  * @param array $nodeTypes
  * @param string $nodeProperty
  * @return array
  */
 public function replaceNodeProperty($stmts, $replacements, $nodeTypes = array(), $nodeProperty = 'name')
 {
     if (NULL === $this->traverser) {
         $this->traverser = new \EBT\ExtensionBuilder\Parser\Traverser();
     }
     $this->traverser->resetVisitors();
     $visitor = new \EBT\ExtensionBuilder\Parser\Visitor\ReplaceVisitor();
     $visitor->setNodeTypes($nodeTypes)->setNodeProperty($nodeProperty)->setReplacements($replacements);
     $this->traverser->addVisitor($visitor);
     $stmts = $this->traverser->traverse($stmts);
     $this->traverser->resetVisitors();
     return $stmts;
 }