@param Node $node

@return string
329953
private function getNodeTextContent(Node $node)
    {
        if ($node instanceof Text) {
            return $node->getContent();
        }

        if ($node instanceof AbstractInlineContainer) {
            $text = '';
            foreach ($node->children() as $child) {
                $text .= $this->getNodeTextContent($child);
            }

            return $text;
        }

        return '';
    }
676688
private function getNodeIndex( $node )
	{
		for( $i=0; $i<$this->count(); $i++ )
			if( $this->nodes[$i] == $node )
				return $i;
		return NULL;
	}
1074890
public function getNode( $node )
	{
		for( $i=0; $i<$this->count(); $i++ )
			if( $this->nodes[$i]->getNodeName() == $node )
				return $this->nodes[$i];
		return NULL;
	}
317315
protected function formatCurrencyCellValue($node)
    {
        $value = $node->getAttribute(self::XML_ATTRIBUTE_VALUE);
        $currency = $node->getAttribute(self::XML_ATTRIBUTE_CURRENCY);

        return "$value $currency";
    }
718666
public function leaveNode(Node $node)
    {
        // Collect arguments as variables
        if ($node instanceof Expr\FuncCall
            || $node instanceof Expr\MethodCall
            || $node instanceof Expr\StaticCall
        ) {
            $variables = $this->getSplatCallVars($node->args);
            if (is_null($variables)) {
                return;
            }
        }

        // Call to call_user_func_array
        if ($node instanceof Expr\FuncCall) {
            $callee = new Scalar\String_($node->name);
            return $this->splatToCallUserFuncArray($callee, $variables);
        } elseif ($node instanceof Expr\MethodCall) {
            if ($node->var instanceof Expr\New_) {
                $var = $node->var;
            } elseif ($node->var instanceof Expr\Variable) {
                $var = new Expr\Variable($node->var->name);
            } else {
                return;
            }
            $callee = new Expr\Array_([$var,new Scalar\String_($node->name)]);
            return $this->splatToCallUserFuncArray($callee, $variables);
        } elseif ($node instanceof Expr\StaticCall) {
            $var = new Expr\ClassConstFetch($node->class, 'class');
            if ($this->useStringifiedStaticCalls) {
                $var = $this->classConstToStrVisitor->leaveNode($var);
            }
            $callee = new Expr\Array_([$var, new Scalar\String_($node->name)]);
            return $this->splatToCallUserFuncArray($callee, $variables);
        }
    }
659604
protected function formatInlineStringCellValue($node)
    {
        // inline strings are formatted this way:
        // <c r="A1" t="inlineStr"><is><t>[INLINE_STRING]</t></is></c>
        $tNode = $node->getElementsByTagName(self::XML_NODE_INLINE_STRING_VALUE)->item(0);
        $cellValue = $this->escaper->unescape($tNode->nodeValue);
        return $cellValue;
    }
398501
public function getDeclarationLineFromNode($node): string
    {
        // If node is part of a declaration list, build a declaration line that discludes other elements in the list
        //  - [PropertyDeclaration] // public $a, [$b = 3], $c; => public $b = 3;
        //  - [ConstDeclaration|ClassConstDeclaration] // "const A = 3, [B = 4];" => "const B = 4;"
        if (
            ($declaration = ParserHelpers\tryGetPropertyDeclaration($node)) && ($elements = $declaration->propertyElements) ||
            ($declaration = ParserHelpers\tryGetConstOrClassConstDeclaration($node)) && ($elements = $declaration->constElements)
        ) {
            $defLine = $declaration->getText();
            $defLineStart = $declaration->getStart();

            $defLine = \substr_replace(
                $defLine,
                $node->getFullText(),
                $elements->getFullStart() - $defLineStart,
                $elements->getFullWidth()
            );
        } else {
            $defLine = $node->getText();
        }

        // Trim string to only include first line
        $defLine = \rtrim(\strtok($defLine, "\n"), "\r");

        // TODO - pretty print rather than getting text

        return $defLine;
    }
28762
public static function getNodePath($node)
    {
        $result = '';
        if ($node instanceof static) {
            $result = $node->slug;
            if (!empty($node->parent_id)) {
                $parent = static::node($node->parent_id);
                if (!empty($parent)) {
                    $result = static::getNodePath($parent) . '/' . $result;
                }
            }
        }
        return $result;
    }
784206
protected function getCustomTagContent(DOMNode $node)
    {
        $xmlString = '';

        /** @var \DOMNode $child */
        foreach ($node->childNodes as $child) {
            $xmlString .= $node->ownerDocument->saveXML($child);
        }

        return $xmlString;
    }
466917
protected static function getInnerHTML($node) {
		if(!$node)
			return null;
		$innerHTML= ''; 
		$children = $node->childNodes; 
		foreach ($children as $child)
			$innerHTML .= $child->ownerDocument->saveHTML($child);
		return $innerHTML; 
	}
1367902
public static function dom2str($node)
    {
        $doc = $node instanceof DOMDocument? $node : $node->ownerDocument;
        return $doc->saveXML($node);
    }
808533
private function extractText(DOMNode $node)
    {
        $text = '';

        if ($node->childNodes) {
            foreach ($node->childNodes as $child) {
                $text .= $this->extractText($child);
            }
        } else {
            $text .= $node->nodeValue . ' ';
        }

        return $text;
    }
37589
protected function nextTagName($node)
    {
        $nextNode = $node->nextSibling;
        while ($nextNode != null) {
            if ($nextNode instanceof DOMElement) {
                break;
            }
            $nextNode = $nextNode->nextSibling;
        }
        $nextTag = '';
        if ($nextNode instanceof DOMElement && $nextNode != null) {
            $nextTag = strtolower($nextNode->nodeName);
        }

        return $nextTag;
    }
93130
protected function getVNodeValue($node)
    {
        // for cell types having a "v" tag containing the value.
        // if not, the returned value should be empty string.
        $vNode = $node->getElementsByTagName(self::XML_NODE_VALUE)->item(0);
        return ($vNode !== null) ? $vNode->nodeValue : '';
    }
911071
protected function transpileSanitizedTagNode(Node $node) : string
    {
        $code = '';

        foreach ($node->getChildren() as $childNode) {
            $code .= '<?php echo $__opulenceFortuneTranspiler->sanitize(' . $childNode->getValue() . '); ?>';
        }

        return $code;
    }
27615
private function getSearchTerm(SearchNode $node)
    {
        $fullTerm = $node->getSearchQuery();

        foreach ($this->fullTermPatterns as $pattern) {
            if (preg_match($pattern, $fullTerm, $matches) === 1) {
                return '"'.$fullTerm.'"';
            }
        }

        if ($this->andifyTerms) {
            $glue = 'AND';
        } else {
            $glue = '';
        }


        $i = 0;
        $hasPreviousOperator = false;
        $fullSearchElements = [];

        foreach (explode(' ', $node->getSearchQuery()) as $term) {
            $i++;

            // is this an operator?
            if (array_search($term, $this->queryOperators) !== false) {
                $fullSearchElements[] = $term;
                $hasPreviousOperator = true;
                continue;
            }

            $singleTerm = $this->getSingleTerm($term);

            if ($i > 1 && $hasPreviousOperator == false && !empty($glue)) {
                $fullSearchElements[] = $glue;
            } else {
                $hasPreviousOperator = false;
            }

            $fullSearchElements[] = $singleTerm;
        }

        return implode(' ', $fullSearchElements);
    }
1270203
public function transform($node)
    {
        $blocksData = $this->transformBlock($node);
        $documentData = array(
            'id' => $node->getNodeId() . '-' . $node->getLanguage(). '-' . $node->getSiteId(),
            'elementId' => $node->getId(),
            'nodeId' => $node->getNodeId(),
            'siteId' => $node->getSiteId(),
            'language' => $node->getLanguage(),
            'name' => $node->getName(),
            'blocks' => $blocksData
        );

        if (!is_null($node->getUpdatedAt())) {
            $documentData['updatedAt'] = $node->getUpdatedAt()->getTimestamp();
        }

        $document = new Document($documentData['id'], $documentData);

        return $document;
    }