@param Node[] $nodes

@return string[]
779575
private function extractModifiedVariableNames(array $nodes)
    {
        $modifiedNames = array();
        foreach ($nodes as $node) {
            if (!$node) {
                continue;
            }

            $variableNameNode = $node;
            if ($node instanceof Node\Arg) {
                $variableNameNode = $node->value;
            }

            if ($node instanceof Node\Expr\ArrayDimFetch) {
                $variableNameNode = $node->var;
            }

            if (!($variableNameNode instanceof Node\Expr\Variable)) {
                continue;
            }

            $variableName = $this->convertVariableNameToString($variableNameNode);
            $modifiedNames[] = $variableName;
        }

        return array_unique($modifiedNames);
    }
73321
public function processNode(Node $node, Scope $scope): array
    {
        if (0 === \count($node->params)) {
            return [];
        }

        $params = \array_filter($node->params, static function (Node\Param $node): bool {
            return $node->type instanceof Node\NullableType;
        });

        if (0 === \count($params)) {
            return [];
        }

        $functionName = $node->namespacedName;

        return \array_map(static function (Node\Param $node) use ($functionName): string {
            /** @var Node\Expr\Variable $variable */
            $variable = $node->var;

            /** @var string $parameterName */
            $parameterName = $variable->name;

            return \sprintf(
                'Function %s() has parameter $%s with a nullable type declaration.',
                $functionName,
                $parameterName
            );
        }, $params);
    }
885902
protected function renderNodes($nodes)
    {
        $lines = [];

        if (!empty($nodes)) {

            $nodesOptions = $this->nodesOptions;
            $tag = ArrayHelper::remove($nodesOptions, 'tag', 'ol');
            $lines[] =  Html::beginTag($tag, $nodesOptions);

            foreach ($nodes as $node) {
                if (isset($node['visible']) && !$node['visible']) {
                    continue;
                }
                $lines[] = $this->renderNode($node);
            }

            $lines[] =  Html::endTag($tag); 
        }

        return implode("\n", $lines);
    }
1327163
private function getNodes($node)
    {
        $this->logger->info('[Get Nodes] Retrieving nodes...');

        $stripUnlikelyCandidates = $this->configuration->getStripUnlikelyCandidates();

        $elementsToScore = [];

        /*
         * First, node prepping. Trash nodes that look cruddy (like ones with the
         * class name "comment", etc), and turn divs into P tags where they have been
         * used inappropriately (as in, where they contain no other block level elements.)
         */

        while ($node) {
            // Remove DOMComments nodes as we don't need them and mess up children counting
            if ($node->nodeType === XML_COMMENT_NODE) {
                $this->logger->debug(sprintf('[Get Nodes] Found comment node, removing... Node content was: \'%s\'', substr($node->nodeValue, 0, 128)));
                $node = NodeUtility::removeAndGetNext($node);
                continue;
            }

            $matchString = $node->getAttribute('class') . ' ' . $node->getAttribute('id');

            if (!$node->isProbablyVisible()) {
                $this->logger->debug(sprintf('[Get Nodes] Removing hidden node... Match string was: \'%s\'', $matchString));
                $node = NodeUtility::removeAndGetNext($node);
                continue;
            }

            // Check to see if this node is a byline, and remove it if it is.
            if ($this->checkByline($node, $matchString)) {
                $this->logger->debug(sprintf('[Get Nodes] Found byline, removing... Node content was: \'%s\'', substr($node->nodeValue, 0, 128)));
                $node = NodeUtility::removeAndGetNext($node);
                continue;
            }

            // Remove unlikely candidates
            if ($stripUnlikelyCandidates) {
                if (
                    preg_match(NodeUtility::$regexps['unlikelyCandidates'], $matchString) &&
                    !preg_match(NodeUtility::$regexps['okMaybeItsACandidate'], $matchString) &&
                    $node->nodeName !== 'body' &&
                    $node->nodeName !== 'a'
                ) {
                    $this->logger->debug(sprintf('[Get Nodes] Removing unlikely candidate. Node content was: \'%s\'', substr($node->nodeValue, 0, 128)));
                    $node = NodeUtility::removeAndGetNext($node);
                    continue;
                }
            }

            // Remove DIV, SECTION, and HEADER nodes without any content(e.g. text, image, video, or iframe).
            if (($node->nodeName === 'div' || $node->nodeName === 'section' || $node->nodeName === 'header' ||
                    $node->nodeName === 'h1' || $node->nodeName === 'h2' || $node->nodeName === 'h3' ||
                    $node->nodeName === 'h4' || $node->nodeName === 'h5' || $node->nodeName === 'h6' ||
                    $node->nodeName === 'p') &&
                $node->isElementWithoutContent()) {
                $this->logger->debug(sprintf('[Get Nodes] Removing empty \'%s\' node.', $node->nodeName));
                $node = NodeUtility::removeAndGetNext($node);
                continue;
            }

            if (in_array(strtolower($node->nodeName), $this->defaultTagsToScore)) {
                $this->logger->debug(sprintf('[Get Nodes] Adding node to score list, node content is: \'%s\'', substr($node->nodeValue, 0, 128)));
                $elementsToScore[] = $node;
            }

            // Turn all divs that don't have children block level elements into p's
            if ($node->nodeName === 'div') {
                // Put phrasing content into paragraphs.
                $p = null;
                $childNode = $node->firstChild;
                while ($childNode) {
                    $nextSibling = $childNode->nextSibling;
                    if ($childNode->isPhrasingContent()) {
                        if ($p !== null) {
                            $p->appendChild($childNode);
                        } elseif (!$childNode->isWhitespace()) {
                            $p = $this->dom->createElement('p');
                            $node->replaceChild($p, $childNode);
                            $p->appendChild($childNode);
                        }
                    } elseif ($p !== null) {
                        while ($p->lastChild && $p->lastChild->isWhitespace()) {
                            $p->removeChild($p->lastChild);
                        }
                        $p = null;
                    }
                    $childNode = $nextSibling;
                }

                /*
                 * Sites like http://mobile.slate.com encloses each paragraph with a DIV
                 * element. DIVs with only a P element inside and no text content can be
                 * safely converted into plain P elements to avoid confusing the scoring
                 * algorithm with DIVs with are, in practice, paragraphs.
                 */
                if ($node->hasSingleTagInsideElement('p') && $node->getLinkDensity() < 0.25) {
                    $this->logger->debug(sprintf('[Get Nodes] Found DIV with a single P node, removing DIV. Node content is: \'%s\'', substr($node->nodeValue, 0, 128)));
                    $pNode = $node->getChildren(true)[0];
                    $node->parentNode->replaceChild($pNode, $node);
                    $node = $pNode;
                    $elementsToScore[] = $node;
                } elseif (!$node->hasSingleChildBlockElement()) {
                    $this->logger->debug(sprintf('[Get Nodes] Found DIV with a single child block element, converting to a P node. Node content is: \'%s\'', substr($node->nodeValue, 0, 128)));
                    $node = NodeUtility::setNodeTag($node, 'p');
                    $elementsToScore[] = $node;
                }
            }

            $node = NodeUtility::getNextNode($node);
        }

        return $elementsToScore;
    }
1173785
private function createSubCrawler($nodes)
    {
        $crawler = new static($nodes, $this->uri, $this->baseHref);
        $crawler->isHtml = $this->isHtml;
        $crawler->document = $this->document;
        $crawler->namespaces = $this->namespaces;
        $crawler->html5Parser = $this->html5Parser;

        return $crawler;
    }
125442
public function getNodeRepositories($ids)
    {
        $types = $this->getService('repos:base.node')
                ->getQuery()
                ->disableChain()
                ->id($ids);

        $types->distinct = true;
        $repositories = array();
        foreach ($types->fetchValues('type') as $key => $type) {
            $type = explode(',', $type);
            $identifier = end($type);
            $repositories[] = AnDomain::getRepository($identifier);
        }

        return $repositories;
    }
385877
public function leaveNode(Node $node)
    {
        if ($node instanceof Stmt\GroupUse) {
            $nodes = [];
            foreach ($node->uses as $use) {
                $name = Name::concat($node->prefix, $use->name);
                $nodes[] = new Stmt\Use_([new Stmt\UseUse($name)]);
            }
            return $nodes;
        }
    }
989605
public static function getValueByNodes(array $data, array $nodes, $default = null)
    {
        $temp = $data;

        foreach ($nodes as $name) {
            if (isset($temp[$name])) {
                $temp = $temp[$name];
            } else {
                $temp = $default;
                break;
            }
        }

        return $temp;
    }
130834
protected function buildSelectOptions(array $nodes = [], $parentId = 0, $prefix = '')
    {
        $prefix = $prefix ?: str_repeat('&nbsp;', 6);

        $options = [];

        if (empty($nodes)) {
            $nodes = $this->allNodes();
        }

        foreach ($nodes as $node) {
            $node[$this->titleColumn] = $prefix.'&nbsp;'.$node[$this->titleColumn];
            if ($node[$this->parentColumn] == $parentId) {
                $children = $this->buildSelectOptions($nodes, $node[$this->getKeyName()], $prefix.$prefix);

                $options[$node[$this->getKeyName()]] = $node[$this->titleColumn];

                if ($children) {
                    $options += $children;
                }
            }
        }

        return $options;
    }
907191
private function getChildren($childNodes)
    {
        $uow = $this->dm->getUnitOfWork();
        $locale = $this->locale ?: $uow->getCurrentLocale($this->document);
        $uow->getPrefetchHelper()->prefetch($this->dm, $childNodes, $locale);

        $childDocuments = [];
        foreach ($childNodes as $childNode) {
            $childDocuments[$childNode->getName()] = $uow->getOrCreateProxyFromNode($childNode, $locale);
        }

        return $childDocuments;
    }
369236
protected function _processMethods($nodes)
    {
        foreach ($nodes as $child) {
            if (!$child->processable) {
                continue;
            }
            if ($child->type !== 'function' || !$child->isMethod || isset($child->visibility['abstract'])) {
                continue;
            }
            $namespace = $child->namespace ? $child->namespace->name . '\\' : '';
            $class = $namespace . $child->parent->name;

            if (!$this->processable($class, $child->name)) {
                continue;
            }
            $params = $child->argsToParams();
            $args = $params ? "[{$params}] + " : '';
            $before = new NodeDef("return \\Lead\Filter\\Filters::run(isset(\$this) ? \$this : get_called_class(), __FUNCTION__, " . $args . "func_get_args(), ", 'code');
            $before->parent = $child;
            $before->processable = false;
            $before->namespace = $child->namespace;

            $comma = count($child->args) ? ', ' : '';

            $closure = new FunctionDef("function (\$next{$comma}" . $params . ") {");
            $closure->parent = $child;
            $closure->namespace = $child->namespace;
            $closure->isClosure = true;
            $closure->tree = $child->tree;
            foreach($closure->tree as $item) {
                $item->parent = $closure;
            }
            $closure->close = '});';

            $child->tree = [];
            $child->tree[] = $before;
            $child->tree[] = $closure;
        }
    }
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;
    }
1032829
private function resolveImportTable(Node $node): array
    {
        try {
            return $node->getImportTablesForCurrentScope();
        } catch (Exception $e) {
        }

        foreach ($node->getDescendantNodes() as $node) {
            try {
                $imports = $node->getImportTablesForCurrentScope();
                if (empty($imports[0])) {
                    continue;
                }
                return $imports;
            } catch (Exception $e) {
            }
        }

        return [ [], [], [] ];
    }
649012
public function getAdditionalNodeMetadataAction(array $nodes)
    {
        $result = [];
        /** @var NodeInterface $node */
        foreach ($nodes as $node) {
            $otherNodeVariants = array_values(array_filter(array_map(function ($node) {
                return $this->getCurrentDimensionPresetIdentifiersForNode($node);
            }, $node->getOtherNodeVariants())));
            $result[$node->getContextPath()] = [
                'policy' => $this->nodePolicyService->getNodePolicyInformation($node),
                'dimensions' => $this->getCurrentDimensionPresetIdentifiersForNode($node),
                'otherNodeVariants' => $otherNodeVariants
            ];
        }

        $this->view->assign('value', $result);
    }
40267
public function replaceWith($nodes) {
    $first = TRUE;
    foreach ($this->nodes as $node) {
      if (!$first) {
        if (is_array($nodes)) {
          $nodes = new NodeCollection($nodes, FALSE);
        }
        $nodes = clone $nodes;
      }
      $node->replaceWith($nodes);
      $first = FALSE;
    }
    return $this;
  }
1041254
public function setNodes(ArrayCollection $nodes)
    {
        $finalNodes = array();

        foreach ($nodes as $node) {
            if ($this->checkChildNode($node)) {
                $node->setParent($this);
                $finalNodes[] = $node;
            }
        }

        $this->nodes = $finalNodes;

        return $this;
    }
337807
private function mapNodes(\DOMNodeList $elements)
    {
        $nodes = [];

        foreach ($elements as $element) {
            $node = $this->mapNode($element);
            $nodes[$node->getId()] = $node;
        }

        return $nodes;
    }