vendor/sulu/sulu/src/Sulu/Bundle/WebsiteBundle/EventSubscriber/GeneratorEventSubscriber.php line 43

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\WebsiteBundle\EventSubscriber;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. use Symfony\Component\HttpKernel\Event\ResponseEvent;
  13. use Symfony\Component\HttpKernel\KernelEvents;
  14. /**
  15.  * Adds the X-Generator header.
  16.  */
  17. class GeneratorEventSubscriber implements EventSubscriberInterface
  18. {
  19.     /**
  20.      * @var string
  21.      */
  22.     private $version;
  23.     /**
  24.      * @param $version
  25.      */
  26.     public function __construct($version)
  27.     {
  28.         $this->version $version;
  29.     }
  30.     public static function getSubscribedEvents()
  31.     {
  32.         return [
  33.             KernelEvents::RESPONSE => 'onResponse',
  34.         ];
  35.     }
  36.     public function onResponse(ResponseEvent $event)
  37.     {
  38.         $event->getResponse()->headers->set('X-Generator''Sulu/' $this->version);
  39.     }
  40. }