assertValidSubject example

public function supports(MessageInterface $message): bool
    {
        return $message instanceof SmsMessage;
    }

    protected function doSend(MessageInterface $message): SentMessage
    {
        if (!$message instanceof SmsMessage) {
            throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class$message);
        }

        $this->assertValidSubject($message->getSubject());

        $fromMessage = $message->getFrom();

        if ($fromMessage) {
            $this->assertValidFrom($fromMessage);
            $from = $fromMessage;
        } else {
            $from = $this->from;
        }

        $endpoint = sprintf('https://%s/message/send.json', $this->getEndpoint());
        
Home | Imprint | This part of the site doesn't use cookies.