* type cast. On success lightsms return error code like string. On error return integer.
This commit is contained in:
parent
9a832ef595
commit
0d7488b10a
@ -121,16 +121,16 @@ final class LightSmsTransport extends AbstractTransport
|
|||||||
|
|
||||||
// it happens if the host without www
|
// it happens if the host without www
|
||||||
if (isset($content['']['error'])) {
|
if (isset($content['']['error'])) {
|
||||||
throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg($content['']['error']), $response);
|
throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg((int)$content['']['error']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($content['error'])) {
|
if (isset($content['error'])) {
|
||||||
throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg($content['error']), $response);
|
throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg((int)$content['error']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
$phone = $this->escapePhoneNumber($message->getPhone());
|
$phone = $this->escapePhoneNumber($message->getPhone());
|
||||||
if (32 === $content[$phone]['error']) {
|
if (32 === $content[$phone]['error']) {
|
||||||
throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg($content[$phone]['error']), $response);
|
throw new TransportException('Unable to send the SMS: '.$this->getErrorMsg((int)$content[$phone]['error']), $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == $content[$phone]['error']) {
|
if (0 == $content[$phone]['error']) {
|
||||||
@ -164,7 +164,7 @@ final class LightSmsTransport extends AbstractTransport
|
|||||||
return str_replace('+', '00', $phoneNumber);
|
return str_replace('+', '00', $phoneNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getErrorMsg(string $errorCode): string
|
private function getErrorMsg(int $errorCode): string
|
||||||
{
|
{
|
||||||
return isset(self::ERROR_CODES[$errorCode]) ? self::ERROR_CODES[$errorCode] : self::ERROR_CODES[999];
|
return isset(self::ERROR_CODES[$errorCode]) ? self::ERROR_CODES[$errorCode] : self::ERROR_CODES[999];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user