FluentDOM\Nodes::push PHP Метод

push() публичный Метод

Push new element(s) an the internal element list
public push ( DOMNode | Traversable | array | null $elements, boolean $ignoreTextNodes = FALSE )
$elements DOMNode | Traversable | array | null
$ignoreTextNodes boolean ignore text nodes
    public function push($elements, $ignoreTextNodes = FALSE)
    {
        if (Constraints::isNode($elements, $ignoreTextNodes)) {
            if ($elements->ownerDocument !== $this->_document) {
                throw new \OutOfBoundsException('Node is not a part of this document');
            }
            $this->_nodes[] = $elements;
        } elseif ($nodes = Constraints::isNodeList($elements)) {
            $this->_useDocumentContext = FALSE;
            foreach ($nodes as $index => $node) {
                if ($node->ownerDocument !== $this->_document) {
                    throw new \OutOfBoundsException(sprintf('Node #%d is not a part of this document', $index));
                }
                $this->_nodes[] = $node;
            }
        } elseif (NULL !== $elements) {
            throw new \InvalidArgumentException('Invalid elements variable.');
        }
        return $this;
    }