vendor/store.shopware.com/swagplatformsecurity/src/Subscriber/AdminSecurityFixesProvider.php line 21

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Swag\Security\Subscriber;
  3. use Swag\Security\Components\State;
  4. use Symfony\Component\HttpFoundation\JsonResponse;
  5. use Symfony\Component\HttpKernel\Event\ResponseEvent;
  6. class AdminSecurityFixesProvider
  7. {
  8.     /**
  9.      * @var State
  10.      */
  11.     private $state;
  12.     public function __construct(State $state)
  13.     {
  14.         $this->state $state;
  15.     }
  16.     public function __invoke(ResponseEvent $event)
  17.     {
  18.         $route $event->getRequest()->attributes->get('_route');
  19.         if ($route !== 'api.info.config') {
  20.             return;
  21.         }
  22.         $context json_decode($event->getResponse()->getContent(), true);
  23.         $context['swagSecurity'] = array_map(function ($state) {
  24.             return $state::getTicket();
  25.         }, $this->state->getActiveFixes());
  26.         $event->setResponse(new JsonResponse($context));
  27.     }
  28. }