Get all child nodes.

@param MShop_Catalog_Item_Interface $node
@return MShop_Catalog_Item_Interface[] $nodes List of nodes
558544
protected function _getNodeList( MShop_Catalog_Item_Interface $node )
	{
		$nodes = array( $node );

		foreach( $node->getChildren() as $child ) {
			$nodes = array_merge( $nodes, $this->_getNodeList( $child ) );
		}

		return $nodes;
	}
771819
protected function getChildren(NodeBuilder $node)
    {
        $node = $this->getCredentialsNodes($node);
        $node = $this->getOptionsNodes($node);

        return $node;
    }
1339425
protected function traverseNode(Node $node) : Node
    {
        foreach ($node->getSubNodeNames() as $name) {
            $subNode =& $node->$name;

            if (\is_array($subNode)) {
                $subNode = $this->traverseArray($subNode);
                if ($this->stopTraversal) {
                    break;
                }
            } elseif ($subNode instanceof Node) {
                $traverseChildren = true;
                foreach ($this->visitors as $visitor) {
                    $return = $visitor->enterNode($subNode, $traverseChildren);
                    if (null !== $return) {
                        if ($return instanceof Node) {
                            $subNode = $return;
                        } elseif (self::DONT_TRAVERSE_CHILDREN === $return) {
                            $traverseChildren = false;
                        } elseif (self::STOP_TRAVERSAL === $return) {
                            $this->stopTraversal = true;
                            break 2;
                        } else {
                            throw new \LogicException(
                                'enterNode() returned invalid value of type ' . gettype($return)
                            );
                        }
                    }
                }

                if ($traverseChildren) {
                    $subNode = $this->traverseNode($subNode);
                    if ($this->stopTraversal) {
                        break;
                    }
                }

                foreach ($this->visitors as $visitor) {
                    $return = $visitor->leaveNode($subNode);
                    if (null !== $return) {
                        if ($return instanceof Node) {
                            $subNode = $return;
                        } elseif (self::STOP_TRAVERSAL === $return) {
                            $this->stopTraversal = true;
                            break 2;
                        } elseif (\is_array($return)) {
                            throw new \LogicException(
                                'leaveNode() may only return an array ' .
                                'if the parent structure is an array'
                            );
                        } else {
                            throw new \LogicException(
                                'leaveNode() returned invalid value of type ' . gettype($return)
                            );
                        }
                    }
                }
            }
        }

        return $node;
    }
441434
public function getChild( $index )
	{
		if( isset( $this->_children[$index] ) ) {
			return $this->_children[$index];
		}

		throw new MShop_Catalog_Exception( sprintf( 'Child node with index "%1$d" not available', $index ) );
	}
1008829
public function getSortValuesForNode(NodeInterface $node): array
    {
        $hit = $this->searchHitForNode($node);
        if (is_array($hit) && array_key_exists('sort', $hit)) {
            return $hit['sort'];
        }

        return [];
    }
1066590
private static function extract(NodeInterface $node)
    {
        $attributes = [];
        $nodes = [];

        foreach (self::extractProperties($node) as $name => $value) {
            if (is_array($value)) {
                foreach ($value as $item) {
                    if ($item instanceof NodeInterface) {
                        $nodes[$name][] = $item;
                    } else {
                        $attributes[$name][] = $item;
                    }
                }
            } else {
                if ($value instanceof NodeInterface) {
                    $nodes[$name] = $value;
                } else {
                    $attributes[$name] = $value;
                }
            }
        }

        return [$attributes, $nodes];
    }
1267780
protected function _createNodeArray( MShop_Catalog_Item_Interface $node )
	{
		$result = $node->toArray();

		foreach( $node->getChildren() as $child ) {
			$result['children'][] = $this->_createNodeArray( $child );
		}

		return (object) $result;
	}
986926
public function getChildren()
    {
        $nodes = [];
        try {
            $child = $this->firstChild();
            do {
                $nodes[] = $child;
                $child   = $this->nextChild($child->id());
            } while ( ! is_null($child));
        } catch (ChildNotFoundException $e) {
            // we are done looking for children
        }

        return $nodes;
    }
1229113
protected static function DOMNodeChildCount(DOMNode $node)
    {
        $count = 0;

        if ($node->hasChildNodes()) {
            foreach ($node->childNodes as $child) {
                if ($child->nodeType == XML_ELEMENT_NODE) {
                    $count++;
                }
            }
        }

        return $count;
    }
1035428
protected function getNodeList( \Aimeos\MShop\Catalog\Item\Iface $node )
	{
		$nodes = array( $node );

		foreach( $node->getChildren() as $child ) {
			$nodes = array_merge( $nodes, $this->getNodeList( $child ) );
		}

		return $nodes;
	}
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;
        }
    }
964105
private function getReplacementNodes(Element $node): NodeList {
        $nodesToReturn = $node->newNodeList();
        $nodesToRemove = $node->newNodeList();
        $replacementNodes = $node->newNodeList();

        $fnCompareSiblingNodes = function($node) {
            if ($node->is(':not(a)') || $node->nodeType == XML_TEXT_NODE) {
                return true;
            }
        };

        foreach ($node->contents() as $child) {
            if ($child->is('p') && $replacementNodes->count()) {
                $nodesToReturn[] = $this->getFlushedBuffer($replacementNodes);
                $replacementNodes->fromArray([]);
                $nodesToReturn[] = $child;
            } else if ($child->nodeType == XML_TEXT_NODE) {
                $replaceText = $child->text();

                if (!empty($replaceText)) {
                    // Get all previous sibling <a> nodes, the current text node, and all next sibling <a> nodes.
                    $siblings = $child
                        ->precedingUntil($fnCompareSiblingNodes, 'a')
                        ->merge([$child])
                        ->merge($child->followingUntil($fnCompareSiblingNodes, 'a'));

                    foreach ($siblings as $sibling) {
                        // Place current nodes textual contents in-between previous and next nodes.
                        if ($sibling->isSameNode($child)) {
                            $replacementNodes[] = new Text($replaceText);

                        // Grab the contents of any unprocessed <a> siblings and flag them for removal.
                        } else if ($sibling->getAttribute('grv-usedalready') != 'yes') {
                            $sibling->setAttribute('grv-usedalready', 'yes');

                            $replacementNodes[] = $sibling->cloneNode(true);
                            $nodesToRemove[] = $sibling;
                        }

                    }
                }

                $nodesToRemove[] = $child;
            } else {
                if ($replacementNodes->count()) {
                    $nodesToReturn[] = $this->getFlushedBuffer($replacementNodes);
                    $replacementNodes->fromArray([]);
                }

                $nodesToReturn[] = $child;
            }
        }

        // Flush any remaining replacementNodes left over from text nodes.
        if ($replacementNodes->count()) {
            $nodesToReturn[] = $this->getFlushedBuffer($replacementNodes);
        }

        // Remove potential duplicate <a> tags.
        foreach ($nodesToReturn as $key => $return) {
            if ($nodesToRemove->exists($return)) {
                unset($nodesToReturn[$key]);
            }
        }

        $nodesToRemove->remove();

        return $nodesToReturn;
    }
1246706
public function getChildren( $nodeName = NULL )
	{
		if( !$nodeName )
			return $this->children;
		$list	= array();
		for( $i=0; $i<count( $this->children ); $i++ )
			if( $this->children[$i]->getNodeName() == $nodeName )
				$list[]	= $this->children[$i];
		return $list;
	}
602781
private function getOuterMostArrayNode(Node $node): Node
    {
        $outerMostArrayParent = $node;

        do {
            if ($node instanceof Node\Expr\Array_) {
                $outerMostArrayParent = $node;
            }
        } while ($node = $node->getAttribute(ParentConnectorVisitor::PARENT_KEY));

        return $outerMostArrayParent;
    }
1222429
protected function optimizeNodes(ChildrenNodeCollection $nodes)
    {
        $optimizedNodes = [];

        foreach ($nodes->getChildren() as $key => $node) {
            $optimizedNodes[$key] = $this->optimizeNode($node);
        }

        $optimizedNodes = new ChildrenNodeCollection($optimizedNodes);

        $optimizedNodes = $this->moveCommonMatchersToParentNode($optimizedNodes);

        return $optimizedNodes;
    }
1149393
private function getCampNodeCampMenu(NodeInterface $node) {
    if ($node->bundle() != 'camp') {
      return [];
    }

    $links = [];
    foreach ($node->field_camp_menu_links->getValue() as $link) {
      $links[] = $link;
    }

    return $links;
  }
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 [ [], [], [] ];
    }