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

@ -17,6 +17,11 @@ abstract class Base implements \Rhymix\Framework\Drivers\SMSInterface
*/
protected static $_spec = array();
/**
* Config keys used by this driver are stored here.
*/
protected static $_required_config = array();
/**
* Direct invocation of the constructor is not permitted.
*/
@ -53,7 +58,7 @@ abstract class Base implements \Rhymix\Framework\Drivers\SMSInterface
*/
public static function getRequiredConfig()
{
return array();
return static::$_required_config;
}
/**

View file

@ -15,13 +15,13 @@ class CoolSMS extends Base implements \Rhymix\Framework\Drivers\SMSInterface
'sms_max_length' => 90,
'sms_max_length_in_charset' => 'CP949',
'lms_supported' => true,
'lms_supported_country_codes' => array(0, 82),
'lms_supported_country_codes' => array(82),
'lms_max_length' => 2000,
'lms_max_length_in_charset' => 'CP949',
'lms_subject_supported' => true,
'lms_subject_max_length' => 40,
'mms_supported' => true,
'mms_supported_country_codes' => array(0, 82),
'mms_supported_country_codes' => array(82),
'mms_max_length' => 2000,
'mms_max_length_in_charset' => 'CP949',
'mms_subject_supported' => true,
@ -33,14 +33,9 @@ class CoolSMS extends Base implements \Rhymix\Framework\Drivers\SMSInterface
);
/**
* Get the list of configuration fields required by this mail driver.
*
* @return array
* Config keys used by this driver are stored here.
*/
public static function getRequiredConfig()
{
return array('api_key', 'api_secret', 'sender_key');
}
protected static $_required_config = array('api_key', 'api_secret', 'sender_key');
/**
* Send a message.

View file

@ -0,0 +1,47 @@
<?php
namespace Rhymix\Framework\Drivers\SMS;
/**
* The dummy SMS driver.
*/
class Dummy extends Base implements \Rhymix\Framework\Drivers\SMSInterface
{
/**
* API specifications.
*/
protected static $_spec = array(
'max_recipients' => 100,
'sms_max_length' => 90,
'sms_max_length_in_charset' => 'CP949',
'lms_supported' => true,
'lms_supported_country_codes' => array(82),
'lms_max_length' => 2000,
'lms_max_length_in_charset' => 'CP949',
'lms_subject_supported' => true,
'lms_subject_max_length' => 40,
'mms_supported' => true,
'mms_supported_country_codes' => array(82),
'mms_max_length' => 2000,
'mms_max_length_in_charset' => 'CP949',
'mms_subject_supported' => false,
'mms_subject_max_length' => 40,
'image_allowed_types' => array(),
'image_max_dimensions' => array(1024, 1024),
'image_max_filesize' => 300000,
'delay_supported' => true,
);
/**
* Send a message.
*
* This method returns true on success and false on failure.
*
* @param array $messages
* @return bool
*/
public function send(array $messages)
{
return true;
}
}