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;
}