custom/plugins/WeedesignImages2WebP/src/Listener/ResponseListener.php line 23

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Weedesign\Images2WebP\Listener;
  3. use Symfony\Component\HttpKernel\Event\ResponseEvent;
  4. use Shopware\Core\System\SystemConfig\SystemConfigService;
  5. class ResponseListener
  6. {
  7.     
  8.     private SystemConfigService $systemConfigService;
  9.     public function __construct(
  10.         SystemConfigService $systemConfigService
  11.     )
  12.     {
  13.         $this->systemConfigService $systemConfigService;
  14.     }
  15.     /**
  16.      * @param ResponseEvent $event
  17.      */
  18.     public function onKernelResponse(ResponseEvent $event): void
  19.     {
  20.         if ($this->systemConfigService->get('WeedesignImages2WebP.config.webpFrontend')) {
  21.             $this->systemConfigService->set('WeedesignImages2WebP.config.webpCount'0);
  22.         } else {
  23.             $this->systemConfigService->set('WeedesignImages2WebP.config.webpCount'$this->systemConfigService->get('WeedesignImages2WebP.config.webpInt'));
  24.         }
  25.     }
  26. }