vendor/symfony/notifier/Message/ChatMessage.php line 26

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\Message;
  11. use Symfony\Component\Notifier\Notification\Notification;
  12. /**
  13.  * @author Fabien Potencier <fabien@symfony.com>
  14.  */
  15. class ChatMessage implements MessageInterface
  16. {
  17.     private ?string $transport null;
  18.     private string $subject;
  19.     private ?MessageOptionsInterface $options;
  20.     private ?Notification $notification null;
  21.     public function __construct(string $subjectMessageOptionsInterface $options null)
  22.     {
  23.         $this->subject $subject;
  24.         $this->options $options;
  25.     }
  26.     public static function fromNotification(Notification $notification): self
  27.     {
  28.         $message = new self($notification->getSubject());
  29.         $message->notification $notification;
  30.         return $message;
  31.     }
  32.     /**
  33.      * @return $this
  34.      */
  35.     public function subject(string $subject): static
  36.     {
  37.         $this->subject $subject;
  38.         return $this;
  39.     }
  40.     public function getSubject(): string
  41.     {
  42.         return $this->subject;
  43.     }
  44.     public function getRecipientId(): ?string
  45.     {
  46.         return $this->options?->getRecipientId();
  47.     }
  48.     /**
  49.      * @return $this
  50.      */
  51.     public function options(MessageOptionsInterface $options): static
  52.     {
  53.         $this->options $options;
  54.         return $this;
  55.     }
  56.     public function getOptions(): ?MessageOptionsInterface
  57.     {
  58.         return $this->options;
  59.     }
  60.     /**
  61.      * @return $this
  62.      */
  63.     public function transport(?string $transport): static
  64.     {
  65.         $this->transport $transport;
  66.         return $this;
  67.     }
  68.     public function getTransport(): ?string
  69.     {
  70.         return $this->transport;
  71.     }
  72.     public function getNotification(): ?Notification
  73.     {
  74.         return $this->notification;
  75.     }
  76. }