vendor/symfony/notifier/DataCollector/NotificationDataCollector.php line 32

  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\Component\Notifier\DataCollector;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\HttpKernel\DataCollector\DataCollector;
  14. use Symfony\Component\Notifier\Event\NotificationEvents;
  15. use Symfony\Component\Notifier\EventListener\NotificationLoggerListener;
  16. /**
  17.  * @author Fabien Potencier <fabien@symfony.com>
  18.  */
  19. final class NotificationDataCollector extends DataCollector
  20. {
  21.     private NotificationLoggerListener $logger;
  22.     public function __construct(NotificationLoggerListener $logger)
  23.     {
  24.         $this->logger $logger;
  25.     }
  26.     public function collect(Request $requestResponse $response\Throwable $exception null)
  27.     {
  28.         $this->data['events'] = $this->logger->getEvents();
  29.     }
  30.     public function getEvents(): NotificationEvents
  31.     {
  32.         return $this->data['events'];
  33.     }
  34.     public function reset()
  35.     {
  36.         $this->data = [];
  37.     }
  38.     public function getName(): string
  39.     {
  40.         return 'notifier';
  41.     }
  42. }