findMinLevel($headings); return $this->buildRecursive($headings, 0, $min_level); } private function findMinLevel(array $headings): int { $levels = array_column($headings, 'level'); return !empty($levels) ? min($levels) : 1; } private function buildRecursive(array $headings, int $index, int $current_level): string { $html = ''; return $html; } }