@param ReadNodeInterface $node
@param array             $list

@return array
422852
protected function getChildren(ReadNodeInterface $node, $list)
    {
        $children = array();

        if (!empty($list[$node->getNodeId()]) && is_array($list[$node->getNodeId()])) {
            foreach ($list[$node->getNodeId()] as $child) {
                $position = $this->getNodePosition($child, $children);
                $children[$position] = $this->createTree($child, $list);
            }
        }

        $children = $this->sortArray($children);

        return $children;
    }
1000021
public function run(string $file, Node $node): array
    {
        $hints = [];
        $keys = [];

        foreach ($node->children as $elem) {
            if (is_null($elem)) {
                continue;
            }

            $key = $elem->children['key'];
            // If the array does not have key, ignores this element.
            if (!is_null($key)) {
                foreach ($keys as $other_key) {
                    if ($this->isEqualsWithoutLineno($key, $other_key)) {
                        $hints[] = new Hint(
                            self::HINT_TYPE,
                            self::HINT_MESSAGE,
                            $file,
                            $elem->lineno,
                            self::HINT_LINK
                        );
                    }
                }
                $keys[] = $key;
            }
        }

        return $hints;
    }
724136
public function createFromNode(NodeInterface $node)
    {
        $item = $this->createItem($node->getName(), $node->getOptions());
        /* @var $childNode NodeInterface */
        foreach ($node->getChildren() as $childNode) {
            $item->addChild($this->createFromNode($childNode));
        }

        return $item;
    }
1098127
protected function generateRoutesForNode(NodeInterface $node, ReadSiteInterface $site, array $routePattern)
    {
        $routes = array();

        if (!$node instanceof NodeInterface) {
            return $routes;
        }

        $routeDocumentClass = $this->routeDocumentClass;

        /** @var SiteAliasInterface $alias */
        foreach ($site->getAliases() as $key => $alias) {
            if ($alias->getLanguage() == $node->getLanguage()) {
                /** @var RouteDocumentInterface $route */
                $route = new $routeDocumentClass();
                $route->setName($key . '_' . $node->getId());
                $route->setHost($alias->getDomain());
                $scheme = $node->getScheme();
                if (is_null($scheme) || SchemeableInterface::SCHEME_DEFAULT == $scheme) {
                    $scheme = $alias->getScheme();
                }
                $route->setSchemes($scheme);
                $route->setLanguage($node->getLanguage());
                $route->setNodeId($node->getNodeId());
                $route->setSiteId($site->getSiteId());
                $route->setAliasId($key);
                $pattern = $this->completeRoutePattern($node->getParentId(), $node->getRoutePattern(), $node->getLanguage(), $site->getSiteId(), $routePattern);
                if ($alias->getPrefix()) {
                    $pattern = $this->suppressDoubleSlashes('/' . $alias->getPrefix() . '/' . $pattern);
                }
                $route->setPattern($pattern);
                $routes[] = $route;
            }
        }

        return $routes;
    }
1171741
public function traverse(Twig_NodeInterface $node)
    {
        ksort($this->visitors);
        foreach ($this->visitors as $visitors) {
            foreach ($visitors as $visitor) {
                $node = $this->traverseForVisitor($visitor, $node);
            }
        }

        return $node;
    }
254016
private function staticArrayPairList(ArrayNode $node, $terminator) {
    $elements = new CommaListNode();
    do {
      if ($this->currentType === $terminator) {
        break;
      }
      $this->matchHidden($elements);
      $value = $this->staticScalar();
      if ($this->currentType === T_DOUBLE_ARROW) {
        $pair = new ArrayPairNode();
        $pair->addChild($value, 'key');
        $this->mustMatch(T_DOUBLE_ARROW, $pair);
        $pair->addChild($this->staticScalar(), 'value');
        $elements->addChild($pair);
      }
      else {
        $elements->addChild($value);
      }
    } while ($this->tryMatch(',', $elements, NULL, TRUE));
    $node->addChild($elements, 'elements');
  }
460986
public function copyNode(NodeInterface $node)
    {
        $this->nodeContextPath = $node->getContextPath();
        $this->mode = self::MODE_COPY;
    }
452687
public function discardNode(NodeInterface $node)
    {
        $nodes = [$node];
        $nodeType = $node->getNodeType();

        if ($nodeType->isOfType('Neos.Neos:Document') || $nodeType->hasConfiguration('childNodes')) {
            $nodes = array_filter(
                array_merge($nodes, $this->collectAllContentChildNodes($node)),
                function ($possiblyPublishableNode) use ($node) {
                    return $possiblyPublishableNode->getWorkspace()->getName() === $node->getWorkspace()->getName();
                }
            );
        }

        $this->discardNodes($nodes);
    }
831004
public function createChildNodes(NodeInterface $node)
    {
        $nodeType = $node->getNodeType();
        foreach ($nodeType->getAutoCreatedChildNodes() as $childNodeName => $childNodeType) {
            try {
                $node->createNode($childNodeName, $childNodeType);
            } catch (NodeExistsException $exception) {
                // If you have a node that has been marked as removed, but is needed again
                // the old node is recovered
                $childNodePath = NodePaths::addNodePathSegment($node->getPath(), $childNodeName);
                $contextProperties = $node->getContext()->getProperties();
                $contextProperties['removedContentShown'] = true;
                $context = $this->contextFactory->create($contextProperties);
                $childNode = $context->getNode($childNodePath);
                if ($childNode->isRemoved()) {
                    $childNode->setRemoved(false);
                }
            }
        }
    }
1166634
public function getLanguagesForNode(NodeInterface $node)
    {
        $languages = [];
        foreach ($node->getProperties() as $property) {
            /* @var PropertyInterface $property */
            preg_match('/^' . $this->languageNamespace . ':([a-zA-Z_]*?)-changer/', $property->getName(), $matches);

            if ($matches) {
                $languages[$matches[1]] = $matches[1];
            }
        }

        return array_values($languages);
    }
480061
private static function extractProperties(NodeInterface $node)
    {
        $class = new \ReflectionClass($node);

        foreach ($class->getProperties() as $property) {
            if (!$property->isPublic()) {
                $property->setAccessible(true);
            }

            $name = $property->getName();
            $value = $property->getValue($node);

            yield $name => $value;

            if (!$property->isPublic()) {
                $property->setAccessible(false);
            }
        }
    }
512427
protected function parseNode(NodeInterface $node)
    {
        return (object)[
            'type'       => $this->parseNodeType($node),
            'id'         => $node->getId() ?: null,
            'properties' => $this->parseNodeProperties($node),
        ];
    }
922797
private function arrayPairList(ArrayNode $node, $terminator) {
    $elements = new CommaListNode();
    do {
      if ($this->currentType === $terminator) {
        break;
      }
      $this->matchHidden($elements);
      $elements->addChild($this->arrayPair());
    } while ($this->tryMatch(',', $elements, NULL, TRUE));
    $node->addChild($elements, 'elements');
  }
522314
protected function processConfigurationNode(NodeInterface $node)
    {

        // load the object manager instance
        /** @var \AppserverIo\Psr\Di\ObjectManagerInterface $objectManager */
        $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

        // iterate over all configured descriptors and try to load object description
        /** \AppserverIo\Appserver\Core\Api\Node\DescriptorNode $descriptor */
        foreach ($this->getDescriptors() as $descriptor) {
            try {
                // load the descriptor class
                $descriptorClass = $descriptor->getNodeValue()->getValue();

                // load the object descriptor, initialize the servlet mappings and add it to the object manager
                /** \AppserverIo\Psr\Deployment\DescriptorInterface $objectDescriptor */
                if ($objectDescriptor = $descriptorClass::newDescriptorInstance()->fromConfiguration($node)) {
                    $objectManager->addObjectDescriptor($objectDescriptor, true);
                }

                // proceed with the next descriptor
                continue;

                // if class can not be reflected continue with next class
            } catch (\Exception $e) {
                // log an error message
                $this->getApplication()->getInitialContext()->getSystemLogger()->error($e->__toString());

                // proceed with the next descriptor
                continue;
            }
        }
    }
219365
public static function fromList(array $list)
    {
        if (count($list) !== count($list, COUNT_RECURSIVE)) {
            throw new NodeException('List is not a one-dimensional array.');
        }

        array_walk($list, function (&$item) {
            $item = array($item);
        });
        return new self($list);
    }
979662
private function getChildren(NodeInterface $node)
    {
        $result = [];
        foreach ($node->getNodes() as $child) {
            $result[$child->getIdentifier()] = $child;
        }

        return $result;
    }
460355
public function parse(\Twig_NodeInterface $node)
    {
        foreach ($node as $subNode) {

            if (! $subNode instanceof \Twig_NodeInterface) {
                continue;
            }

            $nodeClass = get_class($subNode);

            switch ($nodeClass) {
                case 'Twig_Node_Set':
                    $this->context[] = $this->env->getCompiler()->compile($subNode)->getSource();
                    break;
                
                default:
                    $this->parse($subNode);
                    break;
            }
        }

        return $this;
    }