Check if path is matching for the requested element

@param xml\SimpleXmlElement $node
@param string $name
@return bool
183984
protected function isPathMatching(SimpleXmlElement $node, $name)
    {
        $pathPattern = $this->getPathRegex();
        $childPath = $node->getPath() . '/' . $name;

        if (!$pathPattern) {
            return false;
        }

        return (bool)preg_match($pathPattern, $childPath);
    }
932786
private function needsNode(Node $node, string $namespace): bool
    {
        $fullyQualifiedName = ($node instanceof Function_ || $node instanceof ClassLike)
            ? '\\' . ltrim("{$namespace}\\{$node->name}", '\\')
            : '';

        if ($node instanceof Function_) {
            return $this->needsFunctions
                && $this->count('functions', $fullyQualifiedName)
                && !function_exists($fullyQualifiedName);
        }

        if ($node instanceof Class_) {
            return $this->needsClasses
                && $this->count('classes', $fullyQualifiedName)
                && !class_exists($fullyQualifiedName);
        }

        if ($node instanceof Interface_) {
            return $this->needsInterfaces
                && $this->count('interfaces', $fullyQualifiedName)
                && !interface_exists($fullyQualifiedName);
        }

        if ($node instanceof Trait_) {
            return $this->needsTraits
                && $this->count('traits', $fullyQualifiedName)
                && !trait_exists($fullyQualifiedName);
        }

        if (($this->needsDocumentedGlobals || $this->needsUndocumentedGlobals)
            && !$this->isInIf // Don't keep conditionally declared globals.
            && $node instanceof Assign
            && $node->var instanceof Variable
            && is_string($node->var->name)
        ) {
            $this->count('globals', $node->var->name);
            // We'll keep regular global variable declarations, depending on
            // whether or not they are documented.
            if ($node->getDocComment()) {
                return $this->needsDocumentedGlobals;
            } else {
                return $this->needsUndocumentedGlobals;
            }
        }

        return false;
    }
503184
public function allowsElement($name)
    {
        if (!empty($this->currentNesting)) {
            $parent_token = array_pop($this->currentNesting);
            $this->currentNesting[] = $parent_token;
            $parent = $this->htmlDefinition->info[$parent_token->name];
        } else {
            $parent = $this->htmlDefinition->info_parent_def;
        }
        if (!isset($parent->child->elements[$name]) || isset($parent->excludes[$name])) {
            return false;
        }
        // check for exclusion
        for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
            $node = $this->currentNesting[$i];
            $def  = $this->htmlDefinition->info[$node->name];
            if (isset($def->excludes[$name])) {
                return false;
            }
        }
        return true;
    }
164725
public function getAttribute($node, $name)
    {
        if (is_string($node)) {
            $node = $this->getNode($node);
        }

        if ($node) {
            return $node->hasAttribute($name) ?
                $node->getAttribute($name) :
                null;
        } else {
            return null;
        }
    }
380083
public function findStatementForNode(?Name $namespaceName, Name $node): ?Name
    {
        $name = strtolower($node->getFirst());

        $parentNode = ParentNodeAppender::findParent($node);

        if ($parentNode instanceof ClassLike
            && $node instanceof NamedIdentifier
            && $node->getOriginalNode() === $parentNode->name
        ) {
            // The current node can either be the class like name or one of its elements, e.g. extends or implements.
            // In the first case, the node was original an Identifier.

            return null;
        }

        $useStatements = $this->nodes[(string) $namespaceName] ?? [];

        foreach ($useStatements as $use_) {
            foreach ($use_->uses as $useStatement) {
                if (!($useStatement instanceof UseUse)) {
                    continue;
                }

                if ($name === $useStatement->getAlias()->toLowerString()) {
                    if ($this->isFunctionName($node, $parentNode)) {
                        if (Use_::TYPE_FUNCTION === $use_->type) {
                            return $useStatement->name;
                        }

                        continue;
                    }

                    if ($parentNode instanceof ConstFetch && 1 === count($node->parts)) {
                        if (Use_::TYPE_CONSTANT === $use_->type) {
                            return $useStatement->name;
                        }

                        continue;
                    }

                    // Match the alias
                    return $useStatement->name;
                }

                if (null !== $useStatement->alias) {
                    continue;
                }
            }
        }

        return null;
    }
1204690
public function routeExists($name)
    {
        return (null === $this->router->getRouteCollection()->get($name)) ? false : true;
    }
977907
public function contains($name){
		foreach($this->segments as $segment){
			if($segment->getName() == $name) return true;
		}
		return false;
	}
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);
    }
1355014
public function hasRoutes(string $name): bool{
        return (isset($this->routes[$name]) && !empty($this->routes[$name]));
    }
534076
public function issetAttribute($name)
    {
        try {
            if (parent::__get($name) !== null) {
                return true;
            }
        } catch (Exception $ignore) {
        }

        $path = explode('.', $name);
        $ref = &$this->_dynamicAttributes;

        foreach ($path as $key) {
            if (!isset($ref[$key])) {
                return false;
            }
            $ref = &$ref[$key];
        }

        return true;
    }
819249
protected function IsNode( $node )
	{
		if ( ! $node instanceof XPathNavigator )
		{
			throw XPath2Exception::withErrorCodeAndParam( "XPTY0019", Resources::XPTY0019, $node->getValue() );
		}
	}
1092050
private function getChildren(\DOMNode $node, $name)
    {
        $children = [];
        foreach ($node->childNodes as $child) {
            if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) {
                $children[] = $child;
            }
        }

        return $children;
    }
77149
protected function findByNameOrId($name, $element = '*')
    {
        $name = str_replace('#', '', $name);

        try {
            return $this->session->element('css selector', "#{$name}, *[name={$name}]");
        } catch (NoSuchElement $e) {
            throw new InvalidArgumentException(
                "Couldn't find an element, '{$element}', with a name or class attribute of '{$name}'."
            );
        }
    }
233723
public function hasText(string $name) : bool
    {
        return $this->textContentAreas->any(function (TextContentArea $contentArea) use ($name) {
            return $contentArea->name === $name;
        });
    }
576869
private function getChildrenValues(\DOMNode $node, $name)
    {
        $children = array();
        foreach ($node->childNodes as $child) {
            if ($child instanceof \DOMElement && $child->localName === $name) {
                $children[] = $child->nodeValue;
            }
        }

        return $children;
    }
160224
public function getChild(
        SimpleXMLElement $element,
        $name,
        array $attributes = []
    ) {
        $xpath = $name . $this->getAttributesXpath($attributes);

        $result = $element->xpath($xpath);
        if (empty($result)) {
            $node = $element->addChild($name);
            $this->setAttributes($node, $attributes);
        } else {
            $node = reset($result);
        }

        return $node;
    }
523233
public function has($name)
    {
        $found = false;
        $this->elements->rewind();

        /** @var ElementInterface $element*/
        foreach ($this->elements as $element) {
            if ($element->getName() == $name) {
                $found = true;
                break;
            }
        }
        return $found;
    }