vendor/store.shopware.com/leopardsearchextension/src/Subscriber/KernelResponseSubscriber.php line 26

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * LeopardSearchExtension
  5.  * Copyright (c) Die Leoparden GmbH
  6.  */
  7. namespace LeopardSearchExtension\Subscriber;
  8. use LeopardSearchExtension\LeopardSearchExtension;
  9. use Symfony\Component\HttpKernel\Event\ResponseEvent;
  10. use Symfony\Component\HttpKernel\KernelEvents;
  11. /**
  12.  * Class ProductSuggestCriteriaSubscriber
  13.  */
  14. class KernelResponseSubscriber extends AbstractSubscriber
  15. {
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             KernelEvents::RESPONSE => 'onKernelResponse',
  20.         ];
  21.     }
  22.     public function onKernelResponse(ResponseEvent $event): void
  23.     {
  24.         if ($event->getRequest()->attributes->has(LeopardSearchExtension::KERNEL_RESPONSE_ATTRIBUTE)) {
  25.             $event
  26.                 ->getResponse()
  27.                 ->headers
  28.                 ->add(['Cache-Control' => 'no-store, private']);
  29.         }
  30.     }
  31. }