$params */ public function handle(Request $request, array $params): Response { $manifestPath = $this->scenariosDir . '/manifest.json'; $manifest = []; if (is_file($manifestPath)) { $decoded = json_decode((string) file_get_contents($manifestPath), true); if (is_array($decoded)) { $manifest = $decoded; } } $entries = []; foreach (scandir($this->scenariosDir) ?: [] as $file) { if (!preg_match(self::FILENAME_PATTERN, $file)) { continue; } $id = substr($file, 0, -5); $entry = $manifest[$id] ?? null; if (!is_array($entry) || !isset($entry['name'], $entry['summary'])) { continue; } $entries[] = [ 'id' => $id, 'name' => (string) $entry['name'], 'summary' => (string) $entry['summary'], ]; } usort($entries, static fn (array $a, array $b): int => strcmp($a['id'], $b['id'])); return Response::json(200, $entries); } }