mapTree($root); list($offset, $limit) = $this->getOffsetAndLimit(); return $this->getPaginatedContentResponse( array_slice($studyAreas, $offset, $limit), count($studyAreas) ); } private function mapTree(\StudipStudyArea $node) { $level = []; $child_nodes = $node->getChildNodes(); foreach ($child_nodes as $child_node) { $level[] = $child_node; $level = array_merge($level, $this->mapTree($child_node)); } return $level; } }