/** * @param Node $hierarchyDescription * @return NodeAggregator */ private function buildAggregatorOfNodes(Node $hierarchyDescription) { return new NodeAggregator($hierarchyDescription->getName(), array_map(function (Node $childNode) { return $this->buildAggregatorOfNodes($childNode); }, $hierarchyDescription->getChildren()), $this->nodeAggregatorFactory->buildAggregatorFor($hierarchyDescription)); }