vendor/symfony/security-bundle/Debug/WrappedListener.php line 40

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\HttpKernel\Event\RequestEvent;
  12. use Symfony\Component\Security\Http\Firewall\AbstractListener;
  13. use Symfony\Component\Security\Http\Firewall\ListenerInterface;
  14. /**
  15.  * Wraps a security listener for calls record.
  16.  *
  17.  * @author Robin Chalas <robin.chalas@gmail.com>
  18.  *
  19.  * @internal since Symfony 4.3
  20.  */
  21. final class WrappedListener implements ListenerInterface
  22. {
  23.     use TraceableListenerTrait;
  24.     /**
  25.      * @param callable $listener
  26.      */
  27.     public function __construct($listener)
  28.     {
  29.         $this->listener $listener;
  30.     }
  31.     /**
  32.      * {@inheritdoc}
  33.      */
  34.     public function __invoke(RequestEvent $event)
  35.     {
  36.         $startTime microtime(true);
  37.         if (\is_callable($this->listener)) {
  38.             ($this->listener)($event);
  39.         } else {
  40.             @trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($this->listener), AbstractListener::class), \E_USER_DEPRECATED);
  41.             $this->listener->handle($event);
  42.         }
  43.         $this->time microtime(true) - $startTime;
  44.         $this->response $event->getResponse();
  45.     }
  46. }