Returns the code needed to display a node in a TeamSpeak 3 viewer.

@param  Node $node
@param  array $siblings
@return string
348700
public function fetchObject(Node $node, array $siblings = array())
  {
    $this->currObj = $node;
    $this->currSib = $siblings;

    $args = array(
      $this->getPrefix(),
      $this->getCorpusIcon(),
      $this->getCorpusName(),
    );

    return Str::factory($this->pattern)->arg($args);
  }
525709
protected function compileCode(Node $node)
    {

        if (!$node->block) {

            return $this->createCode($node->value)
                  .$this->newLine()
                  .$this->compileChildren($node->children, true, true);
        }

        return $this->createCode(trim($this->compileChildren($node->children, true, true)));
    }
320723
protected function _getNodeMap( MW_Tree_Node_Interface $node )
	{
		$map = array();

		$map[ (string) $node->getId() ] = $node;

		foreach( $node->getChildren() as $child ) {
			$map += $this->_getNodeMap( $child );
		}

		return $map;
	}
388124
public function getChildrenNodes(Node $node)
    {
        $result = $this->search($node->getDn(), null, false);

        $nodes = array();
        foreach ($result as $node) {
            $nodes[] = $node;
        }

        return $nodes;
    }
732937
public function saveHTML(\DOMNode $node = null): string
    {
        if (!$this->loaded) {
            return '<!DOCTYPE html>';
        }

        $nodeMode = $node !== null;
        if ($nodeMode && $node instanceof \DOMDocument) {
            $nodeMode = false;
        }

        if ($nodeMode) {
            if (!isset(self::$newObjectsCache['html5domdocument'])) {
                self::$newObjectsCache['html5domdocument'] = new HTML5DOMDocument();
            }
            $tempDomDocument = clone(self::$newObjectsCache['html5domdocument']);
            if ($node->nodeName === 'html') {
                $tempDomDocument->loadHTML('<!DOCTYPE html>');
                $tempDomDocument->appendChild($tempDomDocument->importNode(clone($node), true));
                $html = $tempDomDocument->saveHTML();
                $html = substr($html, 16); // remove the DOCTYPE + the new line after
            } elseif ($node->nodeName === 'head' || $node->nodeName === 'body') {
                $tempDomDocument->loadHTML("<!DOCTYPE html>\n<html></html>");
                $tempDomDocument->childNodes[1]->appendChild($tempDomDocument->importNode(clone($node), true));
                $html = $tempDomDocument->saveHTML();
                $html = substr($html, 22, -7); // remove the DOCTYPE + the new line after + html tag
            } else {
                $isInHead = false;
                $parentNode = $node;
                for ($i = 0; $i < 1000; $i++) {
                    $parentNode = $parentNode->parentNode;
                    if ($parentNode === null) {
                        break;
                    }
                    if ($parentNode->nodeName === 'body') {
                        break;
                    } elseif ($parentNode->nodeName === 'head') {
                        $isInHead = true;
                        break;
                    }
                }
                $tempDomDocument->loadHTML("<!DOCTYPE html>\n<html>" . ($isInHead ? '<head></head>' : '<body></body>') . '</html>');
                $tempDomDocument->childNodes[1]->childNodes[0]->appendChild($tempDomDocument->importNode(clone($node), true));
                $html = $tempDomDocument->saveHTML();
                $html = substr($html, 28, -14); // remove the DOCTYPE + the new line + html + body or head tags
            }
            $html = trim($html);
        } else {
            $removeHtmlElement = false;
            $removeHeadElement = false;
            $headElement = $this->getElementsByTagName('head')->item(0);
            if ($headElement === null) {
                if ($this->addHtmlElementIfMissing()) {
                    $removeHtmlElement = true;
                }
                if ($this->addHeadElementIfMissing()) {
                    $removeHeadElement = true;
                }
                $headElement = $this->getElementsByTagName('head')->item(0);
            }
            $meta = $this->createElement('meta');
            $meta->setAttribute('data-html5-dom-document-internal-attribute', 'charset-meta');
            $meta->setAttribute('http-equiv', 'content-type');
            $meta->setAttribute('content', 'text/html; charset=utf-8');
            if ($headElement->firstChild !== null) {
                $headElement->insertBefore($meta, $headElement->firstChild);
            } else {
                $headElement->appendChild($meta);
            }
            $html = parent::saveHTML();
            $html = rtrim($html, "\n");

            if ($removeHeadElement) {
                $headElement->parentNode->removeChild($headElement);
            } else {
                $meta->parentNode->removeChild($meta);
            }

            if (strpos($html, 'html5-dom-document-internal-entity') !== false) {
                $html = preg_replace('/html5-dom-document-internal-entity1-(.*?)-end/', '&$1;', $html);
                $html = preg_replace('/html5-dom-document-internal-entity2-(.*?)-end/', '&#$1;', $html);
            }

            $codeToRemove = [
                'html5-dom-document-internal-content',
                '<meta data-html5-dom-document-internal-attribute="charset-meta" http-equiv="content-type" content="text/html; charset=utf-8">',
                '</area>', '</base>', '</br>', '</col>', '</command>', '</embed>', '</hr>', '</img>', '</input>', '</keygen>', '</link>', '</meta>', '</param>', '</source>', '</track>', '</wbr>'
            ];
            if ($removeHeadElement) {
                $codeToRemove[] = '<head></head>';
            }
            if ($removeHtmlElement) {
                $codeToRemove[] = '<html></html>';
            }

            $html = str_replace($codeToRemove, '', $html);
        }
        return $html;
    }
329424
function ($node, relation) {
      var $target = {};
      var relation = relation || 'self';
      if (relation === 'parent') {
        $target = $node.closest('.nodes').siblings(':first');
        if ($target.length) {
          if ($target.is('.hidden') || (!$target.is('.hidden') && $target.closest('.nodes').is('.hidden'))) {
            return { 'exist': true, 'visible': false };
          }
          return { 'exist': true, 'visible': true };
        }
      } else if (relation === 'children') {
        $target = $node.closest('tr').siblings(':last');
        if ($target.length) {
          if (!$target.is('.hidden')) {
            return { 'exist': true, 'visible': true };
          }
          return { 'exist': true, 'visible': false };
        }
      } else if (relation === 'siblings') {
        $target = $node.closest('table').parent().siblings();
        if ($target.length) {
          if (!$target.is('.hidden') && !$target.parent().is('.hidden')) {
            return { 'exist': true, 'visible': true };
          }
          return { 'exist': true, 'visible': false };
        }
      } else {
        $target = $node;
        if ($target.length) {
          if (!(($target.closest('.nodes').length && $target.closest('.nodes').is('.hidden')) ||
            ($target.closest('table').parent().length && $target.closest('table').parent().is('.hidden')) ||
            ($target.parent().is('li') && ($target.closest('ul').is('.hidden') || $target.closest('verticalNodes').is('.hidden')))
          )) {
            return { 'exist': true, 'visible': true };
          }
          return { 'exist': true, 'visible': false };
        }
      }
      return { 'exist': false, 'visible': false };
    }
1309769
public function getClassName(AbstractNode $node): string
    {
        $fullQualifiedName = $node->getFullQualifiedName();
        $fullQualifiedName = explode('::', $fullQualifiedName);

        return array_shift($fullQualifiedName);
    }
371641
public function pStmt_Switch(Stmt\Switch_ $node)
    {
        return sprintf(
            "%s (%s) %s%s\n%s",
            $this->color('switch', SyntaxHighlighterConfig::TYPE_KEYWORD),
            $this->p($node->cond),
            $this->color('{', SyntaxHighlighterConfig::TYPE_BRACE),
            $this->pStmts($node->cases),
            $this->color('}', SyntaxHighlighterConfig::TYPE_BRACE)
        );
    }
1214896
protected function getClassName(AbstractNode $node): string
    {
        if ($node instanceof MethodNode) {
            $node = $this->getNodeFromMethodNode($node);
            $parent = $node->getParent();

            return $parent->getNamespacedName();
        }

        return $node->getFullQualifiedName();
    }
683044
protected function sibling($node, $siblingDir = 'nextSibling')
    {
        $nodes = array();

        do {
            if ($node !== $this->getNode(0) && 1 === $node->nodeType) {
                $nodes[] = $node;
            }
        } while ($node = $node->$siblingDir);

        return $nodes;
    }
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; 
	}
726970
private function getEqualNodes(DOMElement $node, $prefix = null)
    {
        $name = $this->prefixKey($node->nodeName, $prefix);

        return $node->xpath(
            sprintf(".|following-sibling::*[name() = '%s']|preceding-sibling::*[name() = '%s']", $name, $name)
        );
    }
673957
protected function generateNodeMarkup(Node $node) : string
    {
        if ($node instanceof TagNode) {
            // Find tad definition.
            $tag = $node->getTag();
            $tagName = $tag->getTagName();
            $tagDef = $this->tagDefs->get($tagName);

            // Recursive generate markup for the inner content.
            $children = $node->getChildren();
            $content = $this->generateMarkup($children);

            // Generate markup for this tag.
            $attribute = $tag->getAttribute();
            return $tagDef->generateMarkup($attribute, $content);
        } else {
            /** @var TextNode $node */
            return $node->getText();
        }
    }
610217
protected function getFirstExternalNode($node)
    {
        $nodes = func_get_args();
        foreach ($nodes as $node) {
            /** @var Node $node */
            if ($node->isLocalhost() === false) {
                return $node;
            }
        }

        return null;
    }
1012033
public function getNextPossibleIdInContext(Node $node)
    {
        if (!isset($this->idList[$node->id])) {
            return $node->id;
        }

        $newId = false;
        $id    = $node->id;
        for ($i = 0; $newId == false; $i++) {
            $newId = rtrim($id, $node->keyDelimiter) . Node::MULTIPLE_ID_ENTRY_DELIMITER . "$i{$node->keyDelimiter}";

            if ($id > 100) {
                throw new \Exception('Are you crazy? 1000 child elements with the same ID ?');
            }
        }

        return $newId;
    }
604517
private function getSiblingNode(NodeInterface $node, $previous = false)
    {
        $parentNode = $node->getParent();
        $children = $parentNode->getNodes();
        $previousNode = null;

        while ($child = current($children)) {
            if ($child->getPath() === $node->getPath()) {
                return $previous ? $previousNode : next($children);
            }

            $previousNode = $child;
            next($children);
        }

        throw new \RuntimeException(
            sprintf(
                'Could not find node with path "%s" as a child of "%s". This should not happen',
                $node->getPath(),
                $parentNode->getPath()
            )
        );
    }
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;
    }