Exemplo n.º 1
0
 private function setMessage(MessageInterface $message)
 {
     if (!$message instanceof SMSMessage) {
         throw UnsupportedMessageException::fromMessageSenderAndMessage($this, $message);
     }
     if (!$message->hasSender()) {
         throw new IncompleteMessageException('Message sender is missing');
     }
     $this->message = $message;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function send(MessageInterface $message)
 {
     if (!$message instanceof EmailMessage) {
         throw UnsupportedMessageException::fromMessageSenderAndMessage($this, $message);
     }
     $this->message = $message;
     $sendResult = $this->invokeMailer();
     if (false === $sendResult) {
         throw new RuntimeException('Email has not been accepted for delivery');
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function send(MessageInterface $message)
 {
     if (!$message instanceof PushMessage) {
         throw UnsupportedMessageException::fromMessageSenderAndMessage($this, $message);
     }
     $this->message = $message;
     $payload = $this->buildPayload();
     foreach ($this->message->getRecipients() as $recipient) {
         /* @var $recipient ActorInterface */
         $payload = $this->addPayloadUser($payload, $recipient);
         $response = $this->executeApiRequest($payload);
         $this->validateResponse($response);
     }
 }