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