Deprecated: Constant E_STRICT is deprecated in /home/pastorz/old-espace-client/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /home/pastorz/old-espace-client/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

vendor/symfony/notifier/Texter.php line 32

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\Component\Notifier;
  11. use Symfony\Component\EventDispatcher\Event;
  12. use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
  13. use Symfony\Component\Messenger\MessageBusInterface;
  14. use Symfony\Component\Notifier\Event\MessageEvent;
  15. use Symfony\Component\Notifier\Message\MessageInterface;
  16. use Symfony\Component\Notifier\Message\SentMessage;
  17. use Symfony\Component\Notifier\Transport\TransportInterface;
  18. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  19. /**
  20.  * @author Fabien Potencier <fabien@symfony.com>
  21.  */
  22. final class Texter implements TexterInterface
  23. {
  24.     private $transport;
  25.     private $bus;
  26.     private $dispatcher;
  27.     public function __construct(TransportInterface $transportMessageBusInterface $bus nullEventDispatcherInterface $dispatcher null)
  28.     {
  29.         $this->transport $transport;
  30.         $this->bus $bus;
  31.         $this->dispatcher class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
  32.     }
  33.     public function __toString(): string
  34.     {
  35.         return 'texter';
  36.     }
  37.     public function supports(MessageInterface $message): bool
  38.     {
  39.         return $this->transport->supports($message);
  40.     }
  41.     public function send(MessageInterface $message): ?SentMessage
  42.     {
  43.         if (null === $this->bus) {
  44.             return $this->transport->send($message);
  45.         }
  46.         if (null !== $this->dispatcher) {
  47.             $this->dispatcher->dispatch(new MessageEvent($messagetrue));
  48.         }
  49.         $this->bus->dispatch($message);
  50.         return null;
  51.     }
  52. }