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; }
/** * {@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'); } }
/** * {@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); } }