FluidXml\FluidXml::appendSibling PHP 메소드

appendSibling() 공개 메소드

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

Usage Example

예제 #1
0
         $xml = new FluidXml();
         $xml->appendSibling('sibling1', true)->appendSibling(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $alias = new FluidXml();
         $alias->append('sibling1', true)->append(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $actual = $xml->xml();
         $expected = $alias->xml();
         \assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.insertSiblingAfter', function () {
     it('should be fluid', function () {
         assert_is_fluid('insertSiblingAfter', 'a');
     });
     it('should behave like .appendSibling', function () {
         $xml = new FluidXml();
         $xml->appendSibling('sibling1', true)->appendSibling(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $alias = new FluidXml();
         $alias->insertSiblingAfter('sibling1', true)->insertSiblingAfter(['sibling2', 'sibling3'], ['class' => 'sibling']);
         $actual = $xml->xml();
         $expected = $alias->xml();
         \assert($actual === $expected, __($actual, $expected));
     });
 });
 describe('.attr', function () {
     it('should be fluid', function () {
         assert_is_fluid('attr', 'a', 'b');
     });
     it('should behave like .setAttribute', function () {
         $xml = new FluidXml();
         $xml->setAttribute('attr1', 'Attr1 Value')->setAttribute(['attr2' => 'Attr2 Value', 'attr3' => 'Attr3 Value'])->appendChild('child', true)->setAttribute('attr4', 'Attr4 Value')->setAttribute(['attr5' => 'Attr5 Value', 'attr6' => 'Attr6 Value']);
         $alias = new FluidXml();