diff --git a/classes/Request.php b/classes/Request.php index b4509db..03974d5 100644 --- a/classes/Request.php +++ b/classes/Request.php @@ -56,6 +56,10 @@ public function send() $arrParams['udh'] = $this->strUdh; } + if ($this->intCategory) { + $arrParams['smscat'] = $this->intCategory; + } + $this->objLogger->addDebug('Sending the following to txtNation:', $arrParams); $objClient = new Client([ diff --git a/classes/SMSMessage.php b/classes/SMSMessage.php index a60f5df..edc9ef8 100644 --- a/classes/SMSMessage.php +++ b/classes/SMSMessage.php @@ -25,6 +25,7 @@ class SMSMessage extends Request protected $fltValue = null; protected $strCurrency = null; protected $intReply = null; + protected $intCategory = null; protected $strEncoding = null; protected $blBinary = null; protected $strUdh = null; @@ -200,6 +201,21 @@ public function binary($blBinary) return $this; } + public function category($intCategory) + { + if (!(Validator::numeric()->notEmpty()->length(3, 3)->validate($intCategory))) { + $this->objLogger->addError('Category must be a numeric string with a length of 3.'); + + throw new SMSMessageException('Category must be a numeric string with a length of 3.'); + } + + $this->intCategory = $intCategory; + + $this->objLogger->addDebug('Category has been set to ' . $intCategory); + + return $this; + } + protected function validate() { $this->objLogger->addDebug('Validating the request');