Indicates if two nodes are the same node.

@param \DiDom\Element|\DOMNode $node

@return bool

@throws \InvalidArgumentException if the provided argument is not an instance of \DOMNode
176942
public function is($node)
    {
        if ($node instanceof Element) {
            $node = $node->getNode();
        }

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

        return $this->node->isSameNode($node);
    }
585589
private function _isContainSelector($node)
    {
        if ($node->hasAttribute($this->_attrName)) {
            $attr = $node->getAttribute($this->_attrName);
            $len = strlen($this->_value);
            if ($len > 0) {
                $pos = strpos($attr, $this->_value);
                return $pos !== false;
            }
        }

        return false;
    }
259641
private function isWritten($node) {
    $oidStr = $node->getOID()->__toString();
    return (isset($this->writtenNodes[$oidStr]));
  }
794375
static public function hasClass(DOMElement $node, $class)
    {
        if (is_array($class) === false) {
            $class = array($class);
        }

        $attr = explode("\x20", $node->getAttribute('class'));

        foreach ($class as $c) {
            if (in_array($c, $attr) === false) {
                return false;
            }
        }

        return true;
    }
369532
protected function isDeclaration(ParentNode $node) {
    return $node instanceof FunctionDeclarationNode ||
      $node instanceof SingleInheritanceNode ||
      $node instanceof InterfaceNode ||
      $node instanceof ClassMethodNode ||
      $node instanceof InterfaceMethodNode;
  }
551360
protected function checkContext(DOMNode $node)
	{
		// Test whether we know in what context this node is used. An <xsl:for-each/> ancestor would // change this node's context
		$xpath     = new DOMXPath($node->ownerDocument);
		$ancestors = $xpath->query('ancestor::xsl:for-each', $node);

		if ($ancestors->length)
		{
			throw new UnsafeTemplateException("Cannot assess context due to '" . $ancestors->item(0)->nodeName . "'", $node);
		}
	}
120447
private function isPrimitive(Node $node) {
		return $node instanceof String_
			|| $node instanceof LNumber
			|| $node instanceof DNumber
			|| $this->isBool($node)
			|| $this->isNull($node);
	}
303344
public function matches(NodeData $node)
    {
        if ($node->hasProperty($this->propertyName)) {
            $propertyValue = $node->getProperty($this->propertyName);
            return !empty($propertyValue);
        }
        return false;
    }
1129518
protected function getNodeDepth(DomNode $node)
    {
        // initial depth for top level elements (to avoid "ifs")
        $depth = -2;

        while ($node) {
            ++$depth;
            $node = $node->parentNode;
        }

        return $depth;
    }
481147
public function addChild(NodeInterface $node)
    {
        $name = $node->getName();
        if (!\strlen($name)) {
            throw new \InvalidArgumentException('Child nodes must be named.');
        }
        if (isset($this->children[$name])) {
            throw new \InvalidArgumentException(sprintf('A child node named "%s" already exists.', $name));
        }

        $this->children[$name] = $node;
    }
675280
public function nodeGranted($node)
    {
        if ($this->tokenStorage->getToken() === null) {
            return false;
        }

        /* @var $nodes TreeNodeInterface[] */

        if ($node instanceof ContentTreeContext) {
            $nodes = array($node->getNode());
        } elseif (is_array($node)) {
            $nodes = $node;
        } elseif (!$node instanceof TreeNodeInterface) {
            return false;
        } else {
            $nodes = array($node);
        }

        foreach ($nodes as $node) {
            if ($node instanceof ContentTreeContext) {
                $node = $node->getNode();
            }

            if ($this->authorizationChecker->isGranted(new Expression($node->getSecurityExpression()))) {
                return true;
            }
        }

        return false;
    }
892957
private function isIncludeExceptionNode(Node $node): bool
    {
        foreach ($node->children['class']->children as $class) {
            if ($class->children['name'] === 'Exception') {
                return true;
            }
        }

        return false;
    }
97183
private function validElements( $node )
	{
		// The node must be an array
		if ( ! isset( $node ) ) return false;

		// The node may represent a tuple
		if ( XBRL::isTuple( $node['taxonomy_element'] ) ) return true;

		// There must be an element called 'elements'
		if ( ! isset( $node['elements'] ) ) return false;
		// The elements must have some members
		if ( count( $node['elements'] ) === 0 ) return false;

		foreach ( $node['elements'] as $elementKey => $element )
			if ( ! empty( $element['value'] ) /* || is_numeric( $element['value'] ) */ ) return true;
		return false;
	}
903775
private function shouldCheckOption($node): Bool
    {
        if (!$node instanceof Node) {
            return true;
        }
        if ($node->kind === \ast\AST_CONST) {
            return true;
        }
        if ($node->kind === \ast\AST_BINARY_OP && $node->flags === \ast\flags\BINARY_BITWISE_OR) {
            return true;
        }

        return false;
    }
1089681
protected function isDynamic(DOMElement $node)
	{
		if ($node->getElementsByTagNameNS(self::XMLNS_XSL, '*')->length)
		{
			return true;
		}

		// Look for any attributes containing "{" in this element or its descendants
		$xpath = new DOMXPath($node->ownerDocument);
		$query = './/@*[contains(., "{")]';

		foreach ($xpath->query($query, $node) as $attribute)
		{
			// Test whether the value contains an odd number of {
			if (preg_match('/(?<!\\{)\\{(?:\\{\\{)*(?!\\{)/', $attribute->value))
			{
				return true;
			}
		}

		return false;
	}
1001561
public function except(NodeInterface $node)
    {
        return $this->filter(function (NodeInterface $eachNode) use ($node) {
            return !$eachNode->is($node);
        });
    }
106421
public function isAction(Node $node): bool
    {
        if (! $node instanceof ClassMethod) {
            return false;
        }

        $parentClassName = (string) $node->getAttribute(AttributeKey::PARENT_CLASS_NAME);
        if (Strings::endsWith($parentClassName, 'Controller')) {
            return true;
        }

        if (Strings::endsWith((string) $node->name, 'Action')) {
            return true;
        }

        return $node->isPublic();
    }