custom/plugins/PickwareGls/vendor/pickware/document-bundle/src/CsrfPlaceholderHandlerDecorator.php line 31

Open in your IDE?
  1. <?php
  2. /*
  3.  * Copyright (c) Pickware GmbH. All rights reserved.
  4.  * This file is part of software that is released under a proprietary license.
  5.  * You must not copy, modify, distribute, make publicly available, or execute
  6.  * its contents or parts thereof without express permission by the copyright
  7.  * holder, unless otherwise permitted by law.
  8.  */
  9. declare(strict_types=1);
  10. namespace Pickware\DocumentBundle;
  11. use Shopware\Storefront\Framework\Csrf\CsrfPlaceholderHandler;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Symfony\Component\HttpFoundation\StreamedResponse;
  15. class CsrfPlaceholderHandlerDecorator extends CsrfPlaceholderHandler
  16. {
  17.     /**
  18.      * @var CsrfPlaceholderHandler
  19.      */
  20.     private $decoratedInstance;
  21.     public function __construct(CsrfPlaceholderHandler $decoratedInstance)
  22.     {
  23.         $this->decoratedInstance $decoratedInstance;
  24.     }
  25.     public function replaceCsrfToken(Response $responseRequest $request): Response
  26.     {
  27.         if ($response instanceof StreamedResponse) {
  28.             return $response;
  29.         }
  30.         return $this->decoratedInstance->replaceCsrfToken($response$request);
  31.     }
  32. }