@@ 294-307 (lines=14) @@ | ||
291 | return $this->appendChild($child, ...$optionals); |
|
292 | } |
|
293 | ||
294 | public function prependSibling($sibling, ...$optionals) |
|
295 | { |
|
296 | if ($this->document->dom->documentElement === null) { |
|
297 | // If the document doesn't have at least one root node, |
|
298 | // the sibling creation fails. In this case we replace |
|
299 | // the sibling creation with the creation of a generic node. |
|
300 | return $this->appendChild($sibling, ...$optionals); |
|
301 | } |
|
302 | ||
303 | $context = $this->context(); |
|
304 | $new_context = $context->prependSibling($sibling, ...$optionals); |
|
305 | ||
306 | return $this->chooseContext($context, $new_context); |
|
307 | } |
|
308 | ||
309 | // Alias of prependSibling(). |
|
310 | public function prepend($sibling, ...$optionals) |
|
@@ 321-334 (lines=14) @@ | ||
318 | return $this->prependSibling($sibling, ...$optionals); |
|
319 | } |
|
320 | ||
321 | public function appendSibling($sibling, ...$optionals) |
|
322 | { |
|
323 | if ($this->document->dom->documentElement === null) { |
|
324 | // If the document doesn't have at least one root node, |
|
325 | // the sibling creation fails. In this case we replace |
|
326 | // the sibling creation with the creation of a generic node. |
|
327 | return $this->appendChild($sibling, ...$optionals); |
|
328 | } |
|
329 | ||
330 | $context = $this->context(); |
|
331 | $new_context = $context->appendSibling($sibling, ...$optionals); |
|
332 | ||
333 | return $this->chooseContext($context, $new_context); |
|
334 | } |
|
335 | ||
336 | // Alias of appendSibling(). |
|
337 | public function append($sibling, ...$optionals) |