vendor/symfony/security-bundle/Debug/WrappedLazyListener.php line 49

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Bundle\SecurityBundle\Debug;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpKernel\Event\RequestEvent;
  13. use Symfony\Component\Security\Core\Exception\LazyResponseException;
  14. use Symfony\Component\Security\Http\Firewall\AbstractListener;
  15. use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface;
  16. /**
  17.  * Wraps a lazy security listener.
  18.  *
  19.  * @author Robin Chalas <robin.chalas@gmail.com>
  20.  *
  21.  * @internal
  22.  */
  23. final class WrappedLazyListener extends AbstractListener
  24. {
  25.     use TraceableListenerTrait;
  26.     public function __construct(FirewallListenerInterface $listener)
  27.     {
  28.         $this->listener $listener;
  29.     }
  30.     public function supports(Request $request): ?bool
  31.     {
  32.         return $this->listener->supports($request);
  33.     }
  34.     /**
  35.      * {@inheritdoc}
  36.      */
  37.     public function authenticate(RequestEvent $event)
  38.     {
  39.         $startTime microtime(true);
  40.         try {
  41.             $ret $this->listener->authenticate($event);
  42.         } catch (LazyResponseException $e) {
  43.             $this->response $e->getResponse();
  44.             throw $e;
  45.         } finally {
  46.             $this->time microtime(true) - $startTime;
  47.         }
  48.         $this->response $event->getResponse();
  49.         return $ret;
  50.     }
  51. }