Add dummy SMS driver and use it as the default

This commit is contained in:
Kijin Sung 2016-11-04 20:34:50 +09:00
parent 582374295d
commit 50e3dc4574
4 changed files with 63 additions and 12 deletions

View file

@ -57,6 +57,10 @@ class SMS
$default_driver_config = config('sms.' . $default_driver) ?: array();
self::$default_driver = $default_driver_class::getInstance($default_driver_config);
}
else
{
self::$default_driver = Drivers\SMS\Dummy::getInstance(array());
}
}
return self::$default_driver;
}
@ -595,11 +599,11 @@ class SMS
}
// Check the country code.
if ($item->type === 'MMS' && is_array($spec['mms_supported_country_codes']) && !in_array($country_code, $spec['mms_supported_country_codes']))
if ($item->type === 'MMS' && $country_code && is_array($spec['mms_supported_country_codes']) && !in_array($country_code, $spec['mms_supported_country_codes']))
{
$item->type = 'LMS';
}
if ($item->type === 'LMS' && is_array($spec['lms_supported_country_codes']) && !in_array($country_code, $spec['lms_supported_country_codes']))
if ($item->type === 'LMS' && $country_code && is_array($spec['lms_supported_country_codes']) && !in_array($country_code, $spec['lms_supported_country_codes']))
{
$item->type = 'SMS';
}