FluidXml\FluidXml::prependSibling PHP Method

prependSibling() public method

public prependSibling ( $sibling, $optionals )
    public function prependSibling($sibling, ...$optionals)
    {
        return $this->chooseContext(function ($cx) use($sibling, &$optionals) {
            return $cx->prependSibling($sibling, ...$optionals);
        });
    }

Usage Example

Beispiel #1
0
         $xml = new FluidXml();
         $xml->prependSibling('sibling1', true)->prependSibling(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $alias = new FluidXml();
         $alias->prepend('sibling1', true)->prepend(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $actual = $xml->xml();
         $expected = $alias->xml();
         \assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.insertSiblingBefore', function () {
     it('should be fluid', function () {
         assert_is_fluid('insertSiblingBefore', 'a');
     });
     it('should behave like .prependSibling', function () {
         $xml = new FluidXml();
         $xml->prependSibling('sibling1', true)->prependSibling(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $alias = new FluidXml();
         $alias->insertSiblingBefore('sibling1', true)->insertSiblingBefore(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $actual = $xml->xml();
         $expected = $alias->xml();
         \assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.append', function () {
     it('should be fluid', function () {
         assert_is_fluid('append', 'a');
     });
     it('should behave like .appendSibling', function () {
         $xml = new FluidXml();
         $xml->appendSibling('sibling1', true)->appendSibling(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $alias = new FluidXml();