Avoid the injection of the toolbar

@param FilterResponseEvent $event
501798
public function onKernelResponse(FilterResponseEvent $event)
	{
		$result = parent::onKernelResponse($event);
		$content = ob_get_contents();

		if ($this->request_stack->getCurrentRequest()->getMethod() === 'POST' && empty($content))
		{
			$event->stopPropagation();
		}

		return $result;
	}
323549
public function onKernelRequest(GetResponseEvent $event)
    {
        $headers = $event->getRequest()->headers;

        if (!$headers->has(self::HEADER_NAME)) {
            return;
        }

        $this->requestId->set($headers->get(self::HEADER_NAME, null, true), true);
    }
795628
public function onKernelResponse(FilterResponseEvent $event)
    {
        $lockName = $event->getRequest()->attributes->get('writeLockOn', null);
        if (!is_null($lockName)) {
            $this->cache->delete($lockName);
            $this->logger->info("LOCK REMOVED = ".$lockName);
        }
    }
1063724
public function onKernelRequest(GetResponseEvent $event): void
    {
        $event->getRequest()->attributes->set(
            'csrf_enabled',
            $this->csrfTokenManager instanceof CsrfTokenManager
        );
    }
239204
public function onKernelResponse(FilterResponseEvent $event)
    {
        if ($this->mustLog) {

            /**
             * Only logs before controller execution if EXEC_POST or EXEC_BOTH.
             */
            if (in_array($this->execute, [AnnotationLog::EXEC_POST, AnnotationLog::EXEC_BOTH])) {
                $this->logMessage(
                    $this->logger,
                    $this->level,
                    $this->value
                );
            }
        }
    }
473547
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();
        if ($response) {
            $date = $response->getDate();
            if (empty($date)) {
                $response->setDate(new \DateTime());
            }
        }
    }
1297325
public function onKernelResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $id = $request->get($this->ajaxId);

        if (!$request->isXmlHttpRequest() || null === $id) {
            return;
        }

        if (!isset($this->ajaxEvents[$id])) {
            $event->setResponse(new Response());

            return;
        }

        $ajaxEvent = $this->ajaxEvents[$id];

        $request->setRequestFormat($ajaxEvent->getFormat());
        $event->setResponse($ajaxEvent->generateResponse());
        $event->stopPropagation();
    }
327205
public function onKernelRequest(GetResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        if (!$this->isPlatformUIRequest($event->getRequest())) {
            return;
        }

        $this->globalVariable->setPageLayoutTemplate($this->pageLayoutTemplate);
    }
980549
public function onKernelRequest(GetResponseEvent $event): void
    {
        if ('sonata_admin_dashboard' === $event->getRequest()->get('_route')) {
            $modelManager = $this->admin->getModelManager();

            $defaultDashboard = $modelManager->findOneBy($this->admin->getClass(), [
                'default' => true,
                'enabled' => true,
            ]);

            if ($defaultDashboard) {
                $url = $this->admin->generateObjectUrl('render', $defaultDashboard, ['default' => true]);
                $event->setResponse(new RedirectResponse($url));
            }
        }
    }
476292
public function onKernelResponse(FilterResponseEvent $event)
    {
        $master = HttpKernelInterface::MASTER_REQUEST === $event->getRequestType();
        if ($this->onlyMasterRequests && !$master) {
            return;
        }

        if ($this->onlyException && null === $this->exception) {
            return;
        }

        $request = $event->getRequest();
        $exception = $this->exception;
        $this->exception = null;

        $dataToSend = $this->collector->collect($master, $request, $event->getResponse(), $exception);

        if (null === $dataToSend || !\is_array($dataToSend) || \count($dataToSend) < 1) {
            return;
        }
        $this->collector->send($dataToSend);
    }
768940
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');
    }
1261887
public function onResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();

        if ($request->isMethodSafe(false)) {
            return;
        }

        // In case we're using 'preview', the `_route` has been set to `contentlink`, because we're
        // viewing a single page, but `_original_route` will be `preview`, which should take
        // precedence, if set. See PR https://github.com/bolt/bolt/pull/7458
        /** @deprecated since 3.4 to be removed in 4.0 */
        $route = $request->attributes->get('_internal_route', $request->attributes->get('_route'));

        if (!in_array($route, $this->routes)) {
            return;
        }

        $response = $event->getResponse();

        if ($response->isRedirection() || $response->isEmpty() || $response->isInformational()) {
            return;
        }

        $response->headers->set('X-XSS-Protection', 0);
    }
214318
public function onKernelResponse(FilterResponseEvent $event)
    {
        $locale = $this->localeProvider->determinePreferredLocale();

        // Unable to determine preferred locale? No need to hand out a cookie then.
        if (empty($locale)) {
            return;
        }

        // Did the request already contain the proper cookie value? No need to hand out a cookie then.
        $requestCookie = $this->cookieHelper->read($event->getRequest());
        if ($requestCookie && $requestCookie->getValue() === $locale) {
            $this->logger->debug(sprintf(
                'Locale cookie already set to "%s", nothing to do here',
                $locale
            ));
            return;
        }

        $this->cookieHelper->write($event->getResponse(), $locale);
        $this->logger->notice(sprintf("Set locale cookie to %s", $locale));
    }
984793
public function onKernelResponse(FilterResponseEvent $event)
    {
        /**
         * @var Response $response
         */
        $response = $event->getResponse();

        // exit if not master request, uninteresting method or an error occurred
        if (!$event->isMasterRequest() || $this->isNotConcerningRequest() || !$response->isSuccessful()) {
            return;
        }

        // we can always safely call this, it doesn't need much resources.
        // only if we have subscribers, it will create more load as it persists an EventStatus
        $queueEvent = $this->createQueueEventObject();

        if (!empty($queueEvent->getStatusurl()) && !empty($queueEvent->getEvent())) {
            $linkHeader = LinkHeader::fromResponse($response);
            $linkHeader->add(
                new LinkHeaderItem(
                    $queueEvent->getStatusurl(),
                    array('rel' => 'eventStatus')
                )
            );

            $response->headers->set(
                'Link',
                (string) $linkHeader
            );
        }

        // let's send it to the queue(s) if appropriate
        if (!empty($queueEvent->getEvent())) {
            $queuesForEvent = $this->getSubscribedWorkerIds($queueEvent);

            // if needed and activated, change urls relative to workers
            if (!empty($queuesForEvent) && $this->workerRelativeUrl instanceof Uri) {
                $queueEvent = $this->getWorkerQueueEvent($queueEvent);
            }

            foreach ($queuesForEvent as $queueForEvent) {
                // declare the Queue for the Event if its not there already declared
                $this->rabbitMqProducer->getChannel()->queue_declare($queueForEvent, false, true, false, false);
                $this->rabbitMqProducer->publish(json_encode($queueEvent), $queueForEvent);
            }
        }
    }
175466
public function onKernelRequest(GetResponseEvent $event): void
    {
        $request = $event->getRequest();
        if (!$attributes = RequestAttributesExtractor::extractAttributes($request)) {
            return;
        }

        $resourceMetadata = $this->resourceMetadataFactory->create($attributes['resource_class']);

        $isGranted = $resourceMetadata->getOperationAttribute($attributes, 'access_control', null, true);

        if (null === $isGranted) {
            return;
        }

        $extraVariables = $request->attributes->all();
        $extraVariables['object'] = $request->attributes->get('data');
        $extraVariables['request'] = $request;

        if (!$this->resourceAccessChecker->isGranted($attributes['resource_class'], $isGranted, $extraVariables)) {
            throw new AccessDeniedException($resourceMetadata->getOperationAttribute($attributes, 'access_control_message', 'Access Denied.', true));
        }
    }
1017428
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (!$this->allowRender($event)) {
            return false;
        }

        $response = $event->getResponse();

        // Render the GTM Twig template for after <head>
        $templateHead = $this->extension->renderHead($this->environment);

        // render the GTM Twig template for after <body>
        $templateBody = $this->extension->renderBody($this->environment);

        // render pushes before </body>
        $templateBeforeBodyEnd = $this->extension->renderBodyEnd($this->environment);

        // Insert container immediately after opening <head> or <body>
        $content = preg_replace(array(
            '/<head\b[^>]*>/',
            '/<body\b[^>]*>/',
            '/<\/body\b[^>]*>/',
        ), array(
            "$0" . $templateHead,
            "$0" . $templateBody,
            $templateBeforeBodyEnd . "$0",
        ), $response->getContent(), 1);

        // update the response
        $response->setContent($content);

        return true;
    }
658764
public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $attributes = $event->getRequest()->attributes;
        if ($attributes->get(SetIsApiRequestListener::API_FLAG_NAME) !== true) {
            return;
        }

        if (!$attributes->has('itemType')) {
            return;
        }

        $backend = $this->backendRegistry->getBackend($attributes->get('itemType'));
        $this->container->set('netgen_content_browser.current_backend', $backend);
    }