Lines Matching defs:node
13 /** @var Node the root node */
21 $node = new Node('doc');
22 $this->doc = $node;
23 $this->top($node);
35 * Get the current node (the one at the top of the stack)
45 * Get the document (top most level) node
55 * Make the given node the current one
57 * @param Node $node
59 protected function top(Node $node)
61 $this->stack[] = $node;
66 * Add a new child node to the current node and make it the new current node
68 * @param Node $node
70 public function addTop(Node $node)
72 $this->add($node);
73 $this->top($node);
77 * Pop the current node off the stack
79 * @param string $type The type of node that is expected. A RuntimeException is thrown if the current nod does not
86 /** @var Node $node */
87 $node = array_pop($this->stack);
89 if ($node->getType() != $type) {
91 "Expected the current node to be of type $type found " . $node->getType() . " instead."
94 return $node;
98 * Add a new child node to the current node
100 * @param Node $node
102 public function add(Node $node)
104 $this->current()->addChild($node);