1 | <?php |
||
7 | abstract class Node |
||
8 | { |
||
9 | /** |
||
10 | * @var int |
||
11 | */ |
||
12 | protected $depth = 0; |
||
13 | |||
14 | /** |
||
15 | * @var Node|null |
||
16 | */ |
||
17 | protected $parent; |
||
18 | |||
19 | /** |
||
20 | * @var Node|null |
||
21 | */ |
||
22 | protected $previous; |
||
23 | |||
24 | /** |
||
25 | * @var Node|null |
||
26 | */ |
||
27 | protected $next; |
||
28 | |||
29 | /** |
||
30 | * @var Node|null |
||
31 | */ |
||
32 | protected $firstChild; |
||
33 | |||
34 | /** |
||
35 | * @var Node|null |
||
36 | */ |
||
37 | protected $lastChild; |
||
38 | |||
39 | /** |
||
40 | * @return Node|null |
||
41 | */ |
||
42 | public function previous() |
||
46 | |||
47 | /** |
||
48 | * @return Node|null |
||
49 | */ |
||
50 | 1935 | public function next() |
|
54 | |||
55 | /** |
||
56 | * @return Node|null |
||
57 | */ |
||
58 | 1950 | public function parent() |
|
62 | |||
63 | /** |
||
64 | * @param Node|null $node |
||
65 | */ |
||
66 | 1968 | protected function setParent(Node $node = null) |
|
71 | |||
72 | /** |
||
73 | * @param Node $sibling |
||
74 | */ |
||
75 | 1494 | public function insertAfter(Node $sibling) |
|
92 | |||
93 | /** |
||
94 | * @param Node $sibling |
||
95 | */ |
||
96 | public function insertBefore(Node $sibling) |
||
113 | |||
114 | 384 | public function replaceWith(Node $replacement) |
|
120 | |||
121 | 1968 | public function detach() |
|
140 | |||
141 | /** |
||
142 | * @return bool |
||
143 | */ |
||
144 | abstract public function isContainer(); |
||
145 | |||
146 | /** |
||
147 | * @return Node|null |
||
148 | */ |
||
149 | 1941 | public function firstChild() |
|
153 | |||
154 | /** |
||
155 | * @return Node|null |
||
156 | */ |
||
157 | 1806 | public function lastChild() |
|
161 | |||
162 | /** |
||
163 | * @return Node[] |
||
164 | */ |
||
165 | 2031 | public function children() |
|
174 | |||
175 | /** |
||
176 | * @param Node $child |
||
177 | */ |
||
178 | 1968 | public function appendChild(Node $child) |
|
188 | |||
189 | /** |
||
190 | * @param Node $child |
||
191 | */ |
||
192 | public function prependChild(Node $child) |
||
202 | |||
203 | /** |
||
204 | * Detaches all child nodes of given node |
||
205 | */ |
||
206 | public function detachChildren() |
||
213 | |||
214 | /** |
||
215 | * Replace all children of given node with collection of another |
||
216 | * |
||
217 | * @param array $children |
||
218 | * |
||
219 | * @return $this |
||
220 | */ |
||
221 | public function replaceChildren(array $children) |
||
234 | |||
235 | /** |
||
236 | * @return int |
||
237 | */ |
||
238 | 396 | public function getDepth() |
|
242 | |||
243 | /** |
||
244 | * @return NodeWalker |
||
245 | */ |
||
246 | 1941 | public function walker() |
|
250 | } |
||
251 |