[ Index ]

PHP Cross Reference of phpBB-3.3.9-deutsch

title

Body

[close]

/vendor/symfony/http-kernel/EventListener/ -> ValidateRequestListener.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\HttpKernel\EventListener;
  13  
  14  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  15  use Symfony\Component\HttpKernel\Event\GetResponseEvent;
  16  use Symfony\Component\HttpKernel\KernelEvents;
  17  
  18  /**
  19   * Validates Requests.
  20   *
  21   * @author Magnus Nordlander <magnus@fervo.se>
  22   */
  23  class ValidateRequestListener implements EventSubscriberInterface
  24  {
  25      /**
  26       * Performs the validation.
  27       */
  28      public function onKernelRequest(GetResponseEvent $event)
  29      {
  30          if (!$event->isMasterRequest()) {
  31              return;
  32          }
  33          $request = $event->getRequest();
  34  
  35          if ($request::getTrustedProxies()) {
  36              $request->getClientIps();
  37          }
  38  
  39          $request->getHost();
  40      }
  41  
  42      /**
  43       * {@inheritdoc}
  44       */
  45      public static function getSubscribedEvents()
  46      {
  47          return [
  48              KernelEvents::REQUEST => [
  49                  ['onKernelRequest', 256],
  50              ],
  51          ];
  52      }
  53  }


Generated: Wed Dec 7 15:09:22 2022 Cross-referenced by PHPXref 0.7.1