public function insertAfter($node, $referenceNode = null)
    {
        if ($referenceNode === null) {
            return $this->insertBefore($node);
        }

        if ($referenceNode instanceof Element) {
            $referenceNode = $referenceNode->getNode();
        }

        if (!$referenceNode instanceof DOMNode) {
            throw new InvalidArgumentException(sprintf('Argument 2 passed to %s must be an instance of %s\Element or DOMNode, %s given', __METHOD__, __NAMESPACE__, (is_object($referenceNode) ? get_class($referenceNode) : gettype($referenceNode))));
        }

        return $this->insertBefore($node, $referenceNode->nextSibling);
    }
public function insertAfter($node, $referenceNode = null)
    {
        if ($referenceNode === null) {
            return $this->insertBefore($node);
        }

        if ($referenceNode instanceof Element) {
            $referenceNode = $referenceNode->getNode();
        }

        if (!$referenceNode instanceof DOMNode) {
            throw new InvalidArgumentException(sprintf('Argument 2 passed to %s must be an instance of %s\Element or DOMNode, %s given', __METHOD__, __NAMESPACE__, (is_object($referenceNode) ? get_class($referenceNode) : gettype($referenceNode))));
        }

        return $this->insertBefore($node, $referenceNode->nextSibling);
    }
public function insertAfter ( $ node , $ referenceNode = null ) { if ( $ referenceNode === null ) { return $ this -> insertBefore ( $ node ) ; } if ( $ referenceNode instanceof Element ) { $ referenceNode = $ referenceNode -> getNode ( ) ; } if ( ! $ referenceNode instanceof DOMNode ) { throw new InvalidArgumentException ( sprintf ( 'Argument 2 passed to %s must be an instance of %s\Element or DOMNode, %s given' , __METHOD__ , __NAMESPACE__ , ( is_object ( $ referenceNode ) ? get_class ( $ referenceNode ) : gettype ( $ referenceNode ) ) ) ) ; } return $ this -> insertBefore ( $ node , $ referenceNode -> nextSibling ) ; }
Adds a new child after a reference node.

@param \DiDom\Element|\DOMNode $node The new node
@param \DiDom\Element|\DOMNode|null $referenceNode The reference node

@return \DiDom\Element

@throws \LogicException if current node has no owner document
@throws \InvalidArgumentException if $node is not an instance of \DOMNode or \DiDom\Element
@throws \InvalidArgumentException if $referenceNode is not an instance of \DOMNode or \DiDom\Element
Adds a new child after a reference node .