protected function doSend(MessageInterface
$message): SentMessage
{ if (!
$message instanceof SmsMessage
) { throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::
class,
$message);
} $from =
$message->
getFrom() ?:
$this->from;
if (!
preg_match('/^[+]+[1-9][0-9]{9,14}$/',
$from)) { if ('' ===
$from) { throw new IncompleteDsnException('This phone number is invalid.'
);
} elseif ('' !==
$from && null ===
$this->messagingProfileId
) { throw new IncompleteDsnException('The sending messaging profile must be specified.'
);
} if (!
preg_match('/^[a-zA-Z0-9 ]+$/',
$from)) { throw new IncompleteDsnException('The Sender ID is invalid.'
);
} } $endpoint =
sprintf('https://%s/v2/messages',
$this->
getEndpoint());
$response =
$this->client->
request('POST',
$endpoint,
[