/**
* Indicates if two documents are the same document.
*
* @param Document|\DOMDocument $document The compared document
*
* @return bool
*
* @throws \InvalidArgumentException if the provided argument is not an instance of \DOMDocument or \DiDom\Document
*/
public function is($document)
{
if ($document instanceof self) {
$element = $document->getElement();
} else {
if (!$document instanceof DOMDocument) {
throw new InvalidArgumentException(sprintf('Argument 1 passed to %s must be an instance of %s or DOMDocument, %s given', __METHOD__, __CLASS__, is_object($document) ? get_class($document) : gettype($document)));
}
$element = $document->documentElement;
}
if ($element === null) {
return false;
}
return $this->getElement()->isSameNode($element);
}