src/Bridge/Symfony/Bundle/EventListener/SwaggerUiListener.php
public function onKernelRequest(GetResponseEvent $event): void
    {
        $request = $event->getRequest();
        if (
            'html' !== $request->getRequestFormat('') ||
            !($request->attributes->has('_api_resource_class') || $request->attributes->getBoolean('_api_respond', false))
        ) {
            return;
        }

        $request->attributes->set('_controller', 'api_platform.swagger.action.ui');
    }
public function onKernelRequest(GetResponseEvent $event): void
    {
        $request = $event->getRequest();
        if (
            'html' !== $request->getRequestFormat('') ||
            !($request->attributes->has('_api_resource_class') || $request->attributes->getBoolean('_api_respond', false))
        ) {
            return;
        }

        $request->attributes->set('_controller', 'api_platform.swagger.action.ui');
    }
public function onKernelRequest ( GetResponseEvent $ event ) : void { $ request = $ event -> getRequest ( ) ; if ( 'html' !== $ request -> getRequestFormat ( '' ) || ! ( $ request -> attributes -> has ( '_api_resource_class' ) || $ request -> attributes -> getBoolean ( '_api_respond' , false ) ) ) { return ; } $ request -> attributes -> set ( '_controller' , 'api_platform.swagger.action.ui' ) ; }
Sets SwaggerUiAction as controller if the requested format is HTML.
Sets SwaggerUiAction as controller if the requested format is HTML .