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

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

    $args = array(
      $this->getContainerIdent(),
      $this->getContainerClass(),
      $this->getContainerSummary(),
      $this->getRowClass(),
      $this->getPrefixClass(),
      $this->getPrefix(),
      $this->getCorpusClass(),
      $this->getCorpusTitle(),
      $this->getCorpusIcon(),
      $this->getCorpusName(),
      $this->getSuffixClass(),
      $this->getSuffixIcon(),
      $this->getSuffixFlag(),
    );

    return TeamSpeak3_Helper_String::factory($this->pattern)->arg($args);
  }
1338290
protected function getTS3Connection()
  {
    $serverqry = TeamSpeak3_Helper_Uri::getSessParam("_serverqry");

    if(!$serverqry)
    {
      throw new Exception("TeamSpeak3_Node_Abstract object does not exist in your current session");
    }

    $this->ts3 = unserialize($serverqry);
  }
1002011
protected function calculateNode(AbstractNode $node)
    {
        if (is_a($node, SymbolNode::class)) {
            /** @var SymbolNode $node */

            return $this->calculateSymbolNode($node);
        } elseif (is_a($node, FunctionNode::class)) {
            /** @var FunctionNode $node */

            return $this->calculateFunctionNode($node);
        } elseif (is_a($node, ContainerNode::class)) {
            /** @var ContainerNode $node */

            return $this->calculateContainerNode($node);
        } else {
            throw new \InvalidArgumentException('Error: Cannot calculate node of unknown type "'.get_class($node).'"');
        }
    }
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)));
    }
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;
    }
1367423
private function block($nodes)
    {
        $code = $this->walk($nodes, 0);
        $key = ucfirst(md5($code));

        if (!isset($this->blocks[$key])) {
            $this->blocks[$key] = sprintf($this->prepare(self::BLOCK_FUNCTION, 0), $key, $code);
        }

        return $key;
    }
274764
private function prepareNodesTree(
        $nodes,
        $webspaceKey,
        $languageCode,
        $complete = true,
        $excludeGhosts = false,
        $maxDepth = 1,
        $currentDepth = 0
    ) {
        ++$currentDepth;

        $results = [];
        foreach ($nodes as $node) {
            $result = $this->prepareNode($node, $webspaceKey, $languageCode, 1, $complete, $excludeGhosts);
            if (null !== $maxDepth &&
                $currentDepth < $maxDepth &&
                $node->getHasChildren() &&
                null != $node->getChildren()
            ) {
                $result['_embedded']['nodes'] = $this->prepareNodesTree(
                    $node->getChildren(),
                    $webspaceKey,
                    $languageCode,
                    $complete,
                    $excludeGhosts,
                    $maxDepth,
                    $currentDepth
                );
            }
            $results[] = $result;
        }

        return $results;
    }
436331
public function apply(AbstractNode $node)
    {
        if (preg_match('(\\\\[^\\\\]+Controller$)', $node->getFullQualifiedName()) === 0) {
            return;
        }
        if ($node->getName() === 'AbstractController') {
            return;
        }

        /** @var \PHPMD\Node\ClassNode $node */
        foreach ($node->getMethods() as $method) {
            $this->applyPublicMethodsHaveActionSuffix($method);
        }
    }
766056
protected function addViolationMessage(AbstractNode $node): void
    {
        $message = sprintf(
            'The DependencyProvider method %s() violates rule "%s"',
            $node->getName(),
            static::RULE
        );

        $this->addViolation($node, [$message]);
    }
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;
    }
68476
public function render(HierarchyInterface $node = null, $criteria = null, $options = [], $includeNode = null)
    {
        return $this->getMapper()->childrenHierarchy(
            $node, // if node is null starting from root nodes
            null === $criteria ? $this->direct() : $criteria, // true: load all children, false: only direct, array: criteria
            array_replace_recursive($this->getOptions(), $options),
            null === $includeNode ? $this->includeNode() : $includeNode
        );
    }
1266985
private function arrayDeference(Node $node) {
    while ($this->currentType === '[') {
      $n = $node;
      $node = new ArrayLookupNode();
      $node->addChild($n, 'array');
      $this->dimOffset($node);
    }
    return $node;
  }
357588
static protected function get_cell_list(\DOMNode $node)
    {
        $xpath = new \DOMXpath($node->ownerDocument);

        switch ($node->nodeName) {
            default:
            case "table":
                $query = "tr/td | thead/tr/td | tbody/tr/td | tfoot/tr/td | tr/th | thead/tr/th | tbody/tr/th | tfoot/tr/th";
                break;

            case "tbody":
            case "tfoot":
            case "thead":
                $query = "tr/td | tr/th";
                break;

            case "tr":
                $query = "td | th";
                break;
        }

        return $xpath->query($query, $node);
    }
1046148
public function getNodeCanonical(NodeInterface $node) : ?string
    {
        if ($this->isNodeBlacklisted($node)) {
            return null;
        }

        $site = null;
        $alias = null;

        if ($this->shareCanonicalAcrossSites) {
            $storage = $this->siteManager->getStorage();

            // Very fist site is the right one for canonical URL
            if ($node->site_id) {
                $site = $storage->findOne($node->site_id);
                if ($site->getState() !== SiteState::ON) {
                    $site = null;
                }
            }
        }

        // If no site, fetch on the current site
        if (!$site) {
            if ($this->siteManager->hasContext()) {
                $site = $this->siteManager->getContext();
            }
        }

        if ($site) {
            $alias = $this->aliasManager->getPathAlias($node->id(), $site->getId());
        }

        if (!$alias) {
            // No alias at all means that the canonical is the node URL in the
            // current site, I am sorry I can't provide more any magic here...
            return url('node/' . $node->id(), ['absolute' => true]);
        }

        return $this->siteManager->getUrlGenerator()->generateUrl($site, $alias, ['absolute' => true], true);
    }
147003
public static function get_next_textnode( \DOMNode $node = null ) {
		return self::get_adjacent_textnode(
			function( &$another_node = null ) {
				$another_node = $another_node->nextSibling;
				return self::get_first_textnode( $another_node );
			},
			[ __CLASS__, __FUNCTION__ ],
			$node
		);
	}
242157
protected function getQueryNodes(AbstractNode $node): array
    {
        $methodPostfix = $node->findChildrenOfType('MethodPostfix');
        $classOrInterfaceReference = $node->findChildrenOfType('ClassOrInterfaceReference');

        return array_merge($methodPostfix, $classOrInterfaceReference);
    }
1108944
private static function _getNodePath($node)
    {
        $ret = array();
        $doc = $node->ownerDocument;
        $parentNode = $node->parentNode;

        while ($parentNode !== null && !$doc->isSameNode($parentNode)) {
            // gets the sibling position
            $pos = 0;
            foreach ($parentNode->childNodes as $i => $childNode) {
                if ($childNode->isSameNode($node)) {
                    $pos = $i;
                    break;
                }
            }

            array_unshift($ret, $pos);
            $node = $parentNode;
            $parentNode = $node->parentNode;
        }

        return $ret;
    }