vendor/symfony/notifier/Message/PushMessage.php line 27

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 Tomas Norkūnas <norkunas.tom@gmail.com>
  14.  */
  15. class PushMessage implements MessageInterface
  16. {
  17.     private $transport;
  18.     private $subject;
  19.     private $content;
  20.     private $options;
  21.     private $notification;
  22.     public function __construct(string $subjectstring $contentMessageOptionsInterface $options null)
  23.     {
  24.         $this->subject $subject;
  25.         $this->content $content;
  26.         $this->options $options;
  27.     }
  28.     public static function fromNotification(Notification $notification): self
  29.     {
  30.         $message = new self($notification->getSubject(), $notification->getContent());
  31.         $message->notification $notification;
  32.         return $message;
  33.     }
  34.     public function getRecipientId(): ?string
  35.     {
  36.         return $this->options?->getRecipientId();
  37.     }
  38.     public function subject(string $subject): self
  39.     {
  40.         $this->subject $subject;
  41.         return $this;
  42.     }
  43.     public function getSubject(): string
  44.     {
  45.         return $this->subject;
  46.     }
  47.     public function content(string $content): self
  48.     {
  49.         $this->content $content;
  50.         return $this;
  51.     }
  52.     public function getContent(): string
  53.     {
  54.         return $this->content;
  55.     }
  56.     public function options(MessageOptionsInterface $options): self
  57.     {
  58.         $this->options $options;
  59.         return $this;
  60.     }
  61.     public function getOptions(): ?MessageOptionsInterface
  62.     {
  63.         return $this->options;
  64.     }
  65.     public function transport(?string $transport): self
  66.     {
  67.         $this->transport $transport;
  68.         return $this;
  69.     }
  70.     public function getTransport(): ?string
  71.     {
  72.         return $this->transport;
  73.     }
  74.     public function getNotification(): ?Notification
  75.     {
  76.         return $this->notification;
  77.     }
  78. }