$path] = $route; $route['path'] = sprintf('%s%s', self::ROUTES_PREFIX, $path); return $route; }); return $healthRoute !== null ? [...$prefixedRoutes, $healthRoute] : $prefixedRoutes; } private static function buildUnversionedHealthRouteFromExistingRoutes(array $routes): ?array { $healthRoute = first($routes, fn (array $route) => $route['path'] === '/health'); if ($healthRoute === null) { return null; } ['path' => $path] = $healthRoute; $healthRoute['path'] = sprintf('%s%s', self::UNVERSIONED_ROUTES_PREFIX, $path); $healthRoute['name'] = self::UNVERSIONED_HEALTH_ENDPOINT_NAME; return $healthRoute; } }