vendor/ibexa/http-cache/src/lib/EventSubscriber/HiddenLocationExceptionSubscriber.php line 39

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. namespace Ibexa\HttpCache\EventSubscriber;
  7. use Ibexa\Core\MVC\Exception\HiddenLocationException;
  8. use Ibexa\HttpCache\ResponseTagger\Value\ContentInfoTagger;
  9. use Ibexa\HttpCache\ResponseTagger\Value\LocationTagger;
  10. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  11. use Symfony\Component\HttpKernel\Event\ExceptionEvent;
  12. use Symfony\Component\HttpKernel\KernelEvents;
  13. class HiddenLocationExceptionSubscriber implements EventSubscriberInterface
  14. {
  15.     /**
  16.      * @var \Ibexa\HttpCache\ResponseTagger\Value\LocationTagger;
  17.      */
  18.     private $locationTagger;
  19.     /**
  20.      * @var \Ibexa\HttpCache\ResponseTagger\Value\ContentInfoTagger
  21.      */
  22.     private $contentInfoTagger;
  23.     public function __construct(LocationTagger $locationTaggerContentInfoTagger $contentInfoTagger)
  24.     {
  25.         $this->locationTagger $locationTagger;
  26.         $this->contentInfoTagger $contentInfoTagger;
  27.     }
  28.     public static function getSubscribedEvents()
  29.     {
  30.         return [KernelEvents::EXCEPTION => ['tagHiddenLocationExceptionResponse'10]];
  31.     }
  32.     public function tagHiddenLocationExceptionResponse(ExceptionEvent $event)
  33.     {
  34.         if (!$event->getThrowable() instanceof HiddenLocationException) {
  35.             return;
  36.         }
  37.         /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */
  38.         $location $event->getThrowable()->getLocation();
  39.         $this->locationTagger->tag($location);
  40.         $this->contentInfoTagger->tag($location->getContentInfo());
  41.     }
  42. }
  43. class_alias(HiddenLocationExceptionSubscriber::class, 'EzSystems\PlatformHttpCacheBundle\EventSubscriber\HiddenLocationExceptionSubscriber');