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