Lines Matching refs:node
14 /** @var Node the root node */
22 $node = new Node('doc');
23 $this->doc = $node;
24 $this->top($node);
36 * Get the current node (the one at the top of the stack)
46 * Get the document (top most level) node
56 * Make the given node the current one
58 * @param Node $node
60 protected function top(Node $node)
62 $this->stack[] = $node;
67 * Add a new child node to the current node and make it the new current node
69 * @param Node $node
71 public function addTop(Node $node)
73 $this->add($node);
74 $this->top($node);
78 * Pop the current node off the stack
80 * @param string $type The type of node that is expected. A RuntimeException is thrown if the current nod does not
87 /** @var Node $node */
88 $node = array_pop($this->stack);
90 if ($node->getType() != $type) {
91 throw new \RuntimeException("Expected the current node to be of type $type found " . $node->getType() . " instead.");
93 return $node;
97 * Add a new child node to the current node
99 * @param Node $node
101 public function add(Node $node)
103 $this->current()->addChild($node);