Replace Sylius translation keys.

@param FilterResponseEvent $event
167068
public function replaceKeys(FilterResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        if ($this->controller !== $event->getRequest()->attributes->get('_controller')) {
            return;
        }

        $response = $event->getResponse();
        $content = preg_replace($this->pattern, $this->replacement, $response->getContent());
        $response->setContent($content);
    }
870462
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();
        if (!$event->isMasterRequest() || !$response->isRedirect()) {
            return;
        }

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

        $response->setStatusCode(Response::HTTP_RESET_CONTENT);
        $response->headers->set('PJAX-Location', $response->headers->get('Location'));
        $response->headers->remove('Location');
    }
679349
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $request = $event->getRequest();

        if (!$request->hasSession()) {
            return;
        }

        $this->dispatcher->removeListener(KernelEvents::RESPONSE, [$this, 'onKernelResponse']);
        $this->registered = false;
        $session = $request->getSession();

        if ((null === $token = $this->tokenStorage->getToken()) || $this->trustResolver->isAnonymous($token)) {
            if ($request->hasPreviousSession()) {
                $session->remove($this->sessionKey);
            }
        } else {
            $session->set($this->sessionKey, serialize($token));

            if (null !== $this->logger) {
                $this->logger->debug('Stored the security token in the session.', ['key' => $this->sessionKey]);
            }
        }
    }
442047
public function onKernelResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $routeName = $request->attributes->get('_route');
        if (!$route = $this->app['routes']->get($routeName)) {
            return;
        }

        foreach ((array) $route->getOption('_after_middlewares') as $callback) {
            $response = call_user_func($this->app['callback_resolver']->resolveCallback($callback), $request, $event->getResponse(), $this->app);
            if ($response instanceof Response) {
                $event->setResponse($response);
            } elseif (null !== $response) {
                throw new \RuntimeException(sprintf('An after middleware for route "%s" returned an invalid response value. Must return null or an instance of Response.', $routeName));
            }
        }
    }
1063060
public function onKernelResponse(FilterResponseEvent $event)
    {
        if ($this->handleResponse && $this->http_code !== null) {
            $response = $event->getResponse();
            $response->setStatusCode($this->http_code, $this->http_status);
        }
    }
473547
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();
        if ($response) {
            $date = $response->getDate();
            if (empty($date)) {
                $response->setDate(new \DateTime());
            }
        }
    }
931543
public function onKernelRequestIndex(GetResponseEvent $event)
    {
        $request = $event->getRequest();
        $semanticPathinfo = $request->attributes->get('semanticPathinfo') ?: '/';
        if (
            $event->getRequestType() === HttpKernelInterface::MASTER_REQUEST
            && $semanticPathinfo === '/'
        ) {
            $indexPage = $this->configResolver->getParameter('index_page');
            if ($indexPage !== null) {
                $indexPage = '/' . ltrim($indexPage, '/');
                $request->attributes->set('semanticPathinfo', $indexPage);
                $request->attributes->set('needsForward', true);
            }
        }
    }
391086
public function tagUserContext(FilterResponseEvent $event)
    {
        $response = $event->getResponse();
        if (!$response->isCacheable()) {
            return;
        }

        if ($response->headers->get('Content-Type') !== 'application/vnd.fos.user-context-hash') {
            return;
        }

        if (!$response->getTtl()) {
            return;
        }

        // We need to set tag directly on repsonse here to make sure this does not also get applied to the main request
        // when using Symfony Proxy, as tag handler does not clear tags between requests.
        $response->headers->set($this->tagHeader, $this->repoPrefix . 'ez-user-context-hash');
    }
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
                );
            }
        }
    }
1078820
public function onKernelResponse(FilterResponseEvent $event)
    {
        if ($this->encryptionService->isPerUserEncryptionEnabled()) {
            $request = $event->getRequest();

            // Check if this is one of the security_check routes
            $securityCheckRoutes = $this->settings['security_check_routes'];
            $route = $request->attributes->get('_route');
            if ($route && in_array($route, $securityCheckRoutes)) {
                $user = $this->getUser();

                if ($user) {
                    $password = $request->request->get('_password');
                    $privateKey = $this->keyManager->getUserPrivateKey($user, array('password' => $password));
                    if ($privateKey) {
                        $request->getSession()->set(KeyManager::SESSION_PRIVATE_KEY_PARAM, $privateKey);
                    }
                    else {
                        throw new EncryptionException('Could not load user\'s key');
                    }
                }
            }
        }
    }
177674
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (
            HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()
            ||
            !$this->routeMatcher->match($event->getRequest(), $this->routes)
        ) {
            return;
        }
        $event->getResponse()->headers->setCookie(new Cookie(
            $this->cookieName,
            $this->angularCsrfTokenManager->getToken()->getValue(),
            0 === $this->cookieExpire ? $this->cookieExpire : time() + $this->cookieExpire,
            $this->cookiePath,
            $this->cookieDomain,
            $this->cookieSecure,
            false
        ));
    }
1016080
public function onKernelResponse(FilterResponseEvent $event)
    {
        if ($this->getParameter('nyroDev_utility.setContentLanguageResponse') && $event->getResponse() && $event->getResponse()->headers && $event->getRequest()->getLocale()) {
            $event->getResponse()->headers->set('Content-Language', $event->getRequest()->getLocale());
        }
    }
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);
    }
1334812
public function addContent(FilterResponseEvent $event)
    {
        if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
            return;
        }

        $response = $event->getResponse();
        $content = $response->getContent();

        if (strpos($content, 'data-apoutchika-media="') !== false) {
            $js = array();

            // Include libs
            $libs = array(
                'jquery', 'jqueryui',
                'underscore', 'backbone', 'backbonejjrelational', 'mustache',
                'dropzone', 'jcrop',
            );

            foreach ($libs as $lib) {
                if ($this->include[$lib] === true) {
                    $js[] = 'bundles/apoutchikamedia/js/libs/'.$lib.'.js';
                }
            }

            // Include apps
            $apps = array(
                'init',
                'models', 'collections',
                'viewAdd', 'viewEditor', 'viewField', 'viewList',
                'router', 'app',
            );

            foreach ($apps as $app) {
                $js[] = 'bundles/apoutchikamedia/js/'.$app.'.js';
            }

            $content_js = '';
            foreach ($js as $n) {
                $content_js .= '<script src="';
                $content_js .= $this->assetsHelper->getUrl($n);
                $content_js .= '" type="text/javascript"></script>';
            }

            $css = array();

            $css[] = ($this->css !== null) ?
                    $this->css : 'bundles/apoutchikamedia/css/main.css';

            if ($this->include['jcrop'] === true) {
                $css[] = 'bundles/apoutchikamedia/css/jcrop.css';
            }

            $content_css = '';
            foreach ($css as $n) {
                $content_css .= '<link rel="stylesheet" type="text/css"  href="';
                $content_css .= $this->assetsHelper->getUrl($n);
                $content_css .= '" />';
            }

            $html = $this->templating->render('ApoutchikaMediaBundle:Media:media.html.twig');

            $content = preg_replace('#</head>#', $content_css.'</head>', $content);
            $content = preg_replace('#</body>#', $html.$content_js.'</body>', $content);

            $response->setContent($content);
            $event->setResponse($response);
        }
    }
1261118
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();

        /**
         * the "W/" prefix is necessary to qualify it as a "weak" Etag.
         * only then a proxy like nginx will leave the tag alone because a strong cannot
         * match if gzip is applied.
         */
        $response->headers->set('ETag', 'W/'.sha1($response->getContent()));
    }
995706
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();
        $request = $event->getRequest();

        $ifNoneMatch = $request->headers->get('if-none-match');
        $etag = $response->headers->get('ETag', 'empty');

        if ($ifNoneMatch === $etag) {
            $response->setStatusCode(304);
            $response->setContent(null);
        }
    }
434208
public function onKernelResponse(FilterResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $blockView = $event->getRequest()->attributes->get('ngbmView');
        if (!$blockView instanceof BlockViewInterface) {
            return;
        }

        $this->tagger->tagBlock($event->getResponse(), $blockView->getBlock());
    }