Get the node index.
@param $node The node to get the index of
@return Number
161410
private function getIndex($node) {
    $oidStr = $node->getOID()->__toString();
    if (!isset($this->nodeIndexMap[$oidStr])) {
      $this->nodeIndexMap[$oidStr] = $this->getNextIndex();
    }
    return $this->nodeIndexMap[$oidStr];
  }
266683
public function get($node = null)
    {
        if ($node === null) {
            return $this->_data;
        }
        return (isset($this->_data[$node])) ? $this->_data[$node] : false;
    }
177375
public function getNode()
    {
        if (!$this->node) {
            throw new \RuntimeException(sprintf(
                'Trying to retrieve node when no node has been set. An event ' .
                'listener should have set the node when persisting document "%s"',
                DocumentHelper::getDebugTitle($this->document)
            ));
        }

        return $this->node;
    }
1205083
protected function getInner(\DOMNode $node)
    {
        $c14n = $node->C14N();
        $begin = strpos($c14n, '>');
        $end   = strrpos($c14n, '<');

        $content = substr($c14n, $begin + 1, $end - $begin - 1);

        return $content;
    }
72602
protected function &getNode(&$node, $key)
    {
        if (is_array($node) && isset($node[$key])) {
            return $node[$key];
        }

        if (!is_object($node) || !isset($node->$key)) {
            $result = null;
            return $result;
        }

        // Special check for __isset and __get
        if (property_exists($node, $key)) {
            return $node->$key;
        }

        if (method_exists($node, '__get')) {
            $value = $node->__get($key);
            return $value;
        }

        $result = null;
        return $result;
    }
1196167
protected static function getPreviousElement(\DOMNode $node)
    {
        while ($node && ($node = $node->previousSibling)) {
            if ($node instanceof \DOMElement) {
                break;
            }
        }

        return $node;
    }
401171
private function _countWords(?Node $node): int {
        $result = 0;
        if (null === $node) return $result;
        if ($node->isEndOfWordNode()) $result++;
        for ($i = 0; $i < self::ALPHABET_SIZE; $i++) {
            if ($node->hasChild($i)) {
                $child = $node->getChildNode($i);
                $result += $this->_countWords($child);
            }
        }
        return $result;
    }
661729
function indexOfNode (host, node) {
  const chs = host.childNodes;
  const chsLen = chs.length;
  for (let a = 0; a < chsLen; a++) {
    if (chs[a] === node) {
      return a;
    }
  }
  return -1;
}
88468
public function getNode($index)
    {
        if (is_string($index) and in_array($index, $this->nodesEntities)) {
            if (false !== ($key = array_search($index, $this->nodesEntities))) {
                if ($this->offsetExists($key)) {
                    return $this->offsetGet($index);
                }
            }
        }

        return false;
    }
1096032
protected function getNodePosition(ReadNodeInterface $node, $tree)
    {
        $position = $node->getOrder();
        while (array_key_exists($position, $tree)) {
            $position++;
        }

        return $position;
    }
756175
static function staticNodeData( $node )
    {
        $nodeType = $node[0];
        if ( $nodeType == eZTemplate::NODE_TEXT )
        {
            return $node[2];
        }
        else if ( $nodeType == eZTemplate::NODE_VARIABLE )
        {
            $data = $node[2];
            if ( is_array( $data ) and
                 count( $data ) > 0 )
            {
                $dataType = $data[0][0];
                if ( $dataType == eZTemplate::TYPE_STRING or
                     $dataType == eZTemplate::TYPE_NUMERIC or
                     $dataType == eZTemplate::TYPE_IDENTIFIER or
                     $dataType == eZTemplate::TYPE_ARRAY or
                     $dataType == eZTemplate::TYPE_BOOLEAN )
                {
                    return $data[0][1];
                }
            }
        }
        return null;
    }
1339425
protected function traverseNode(Node $node) : Node
    {
        foreach ($node->getSubNodeNames() as $name) {
            $subNode =& $node->$name;

            if (\is_array($subNode)) {
                $subNode = $this->traverseArray($subNode);
                if ($this->stopTraversal) {
                    break;
                }
            } elseif ($subNode instanceof Node) {
                $traverseChildren = true;
                foreach ($this->visitors as $visitor) {
                    $return = $visitor->enterNode($subNode, $traverseChildren);
                    if (null !== $return) {
                        if ($return instanceof Node) {
                            $subNode = $return;
                        } elseif (self::DONT_TRAVERSE_CHILDREN === $return) {
                            $traverseChildren = false;
                        } elseif (self::STOP_TRAVERSAL === $return) {
                            $this->stopTraversal = true;
                            break 2;
                        } else {
                            throw new \LogicException(
                                'enterNode() returned invalid value of type ' . gettype($return)
                            );
                        }
                    }
                }

                if ($traverseChildren) {
                    $subNode = $this->traverseNode($subNode);
                    if ($this->stopTraversal) {
                        break;
                    }
                }

                foreach ($this->visitors as $visitor) {
                    $return = $visitor->leaveNode($subNode);
                    if (null !== $return) {
                        if ($return instanceof Node) {
                            $subNode = $return;
                        } elseif (self::STOP_TRAVERSAL === $return) {
                            $this->stopTraversal = true;
                            break 2;
                        } elseif (\is_array($return)) {
                            throw new \LogicException(
                                'leaveNode() may only return an array ' .
                                'if the parent structure is an array'
                            );
                        } else {
                            throw new \LogicException(
                                'leaveNode() returned invalid value of type ' . gettype($return)
                            );
                        }
                    }
                }
            }
        }

        return $node;
    }
602781
private function getOuterMostArrayNode(Node $node): Node
    {
        $outerMostArrayParent = $node;

        do {
            if ($node instanceof Node\Expr\Array_) {
                $outerMostArrayParent = $node;
            }
        } while ($node = $node->getAttribute(ParentConnectorVisitor::PARENT_KEY));

        return $outerMostArrayParent;
    }
124951
public function getFlattenChildren(Node $node)
    {
        $flatten = array();
        foreach ($node->getNodes() as $subNode) {
            if (count($subNode->getNodes()) > 1 || isset($subNode->getTrace()['query_source']) || !empty($subNode->getValues())) {
                $flatten[] = $subNode;
            } else {
                $flatten = array_merge($flatten, $this->getFlattenChildren($subNode));
            }
        }

        return $flatten;
    }
738303
public function getIndex() : ?int 
    {
        if ( ! $this->hasIndex()) {
            $this->setIndex($this->getDefaultIndex());
        }
        return $this->index;
    }
31895
public function Item( $index )
	{
		if ( $this->getCount() <= $index && ! $this->_done )
		{
			$count = $this->getCount();
			while ( ! $this->_done && ( $count <= $index))
			{
				if ( $this->_iter->MoveNext() )
				{
					/**
					 * @var XmlNode $node
					 */
					$node = $this->GetNode( $this->_iter->getCurrent() );
					if ( ! is_null( $node ) )
					{
						$this->_list[] = $node;
						$count++;
					}
				}
				else
					$this->_done = true;
			}
		}
		if ( $index >= 0 && count( $this->_list ) > $index )
			return $this->_list[ $index ];
		return null;
	}
230028
private function getKey(\DOMElement $node)
    {
        if ($node->hasAttribute('key')) {
            return (int) $node->getAttribute('key');
        }

        $name = $node->nodeName;
        if (0 === strpos($name, 'meta-')) {
            $name = '_'.substr($name, 5);
        }

        return $name;
    }