htmlResponseAttachmentsProcessor = $html_response_attachments_processor; } /** * Processes attachments for HtmlResponse responses. * * @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event * The event to process. */ public function onRespond(ResponseEvent $event) { $response = $event->getResponse(); if (!$response instanceof HtmlResponse) { return; } $event->setResponse($this->htmlResponseAttachmentsProcessor->processAttachments($response)); } /** * {@inheritdoc} */ public static function getSubscribedEvents(): array { $events[KernelEvents::RESPONSE][] = ['onRespond']; return $events; } }