Allow adding arbitrary extra vars to SMS

This commit is contained in:
Kijin Sung 2016-12-03 16:41:02 +09:00
parent 98b32a2572
commit f4c4ec5ec6
3 changed files with 63 additions and 0 deletions

View file

@ -17,6 +17,7 @@ class SMS
protected $subject = '';
protected $content = '';
protected $attachments = array();
protected $extra_vars = array();
protected $delay_timestamp = 0;
protected $force_sms = false;
protected $allow_split_sms = true;
@ -323,6 +324,51 @@ class SMS
return $this->attachments;
}
/**
* Set an extra variable.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function setExtraVar($key, $value)
{
$this->extra_vars[$key] = $value;
}
/**
* Get an extra variable.
*
* @param string $key
* @return mixed
*/
public function getExtraVar($key)
{
return isset($this->extra_vars[$key]) ? $this->extra_vars[$key] : null;
}
/**
* Get all extra variables.
*
* @param string $key
* @return mixed
*/
public function getExtraVars()
{
return $this->extra_vars;
}
/**
* Set all extra variables.
*
* @param array $vars
* @return void
*/
public function setExtraVars(array $vars)
{
$this->extra_vars = $vars;
}
/**
* Delay sending the message.
*