@@ 252-265 (lines=14) @@ | ||
249 | return $this->addChild($child, ...$optionals); |
|
250 | } |
|
251 | ||
252 | public function prependSibling($sibling, ...$optionals) |
|
253 | { |
|
254 | if ($this->document->dom->documentElement === null) { |
|
255 | // If the document doesn't have at least one root node, |
|
256 | // the sibling creation fails. In this case we replace |
|
257 | // the sibling creation with the creation of a generic node. |
|
258 | return $this->addChild($sibling, ...$optionals); |
|
259 | } |
|
260 | ||
261 | $context = $this->context(); |
|
262 | $new_context = $context->prependSibling($sibling, ...$optionals); |
|
263 | ||
264 | return $this->chooseContext($context, $new_context); |
|
265 | } |
|
266 | ||
267 | // Alias of ->prependSibling(). |
|
268 | public function prepend($sibling, ...$optionals) |
|
@@ 273-286 (lines=14) @@ | ||
270 | return $this->prependSibling($sibling, ...$optionals); |
|
271 | } |
|
272 | ||
273 | public function appendSibling($sibling, ...$optionals) |
|
274 | { |
|
275 | if ($this->document->dom->documentElement === null) { |
|
276 | // If the document doesn't have at least one root node, |
|
277 | // the sibling creation fails. In this case we replace |
|
278 | // the sibling creation with the creation of a generic node. |
|
279 | return $this->addChild($sibling, ...$optionals); |
|
280 | } |
|
281 | ||
282 | $context = $this->context(); |
|
283 | $new_context = $context->appendSibling($sibling, ...$optionals); |
|
284 | ||
285 | return $this->chooseContext($context, $new_context); |
|
286 | } |
|
287 | ||
288 | // Alias of ->appendSibling(). |
|
289 | public function append($sibling, ...$optionals) |