twig = $twig; } public function getFormat(): string { return RenderOpenApi::HTML; } public function render(OpenApi $spec, array $options = []): string { $options += [ 'server_url' => null, ]; if ($options['server_url']) { $spec->servers = [new Server(['url' => $options['server_url']])]; } return $this->twig->render( '@NelmioApiDoc/SwaggerUi/index.html.twig', ['swagger_data' => ['spec' => json_decode($spec->toJson(), true)]] ); } }