Skip to content

Commit 3d3e00d

Browse files
authored
Merge pull request #3 from EthanBray/master
Add the ability to select a category code for a message
2 parents e746306 + 964d063 commit 3d3e00d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

classes/Request.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public function send()
5656
$arrParams['udh'] = $this->strUdh;
5757
}
5858

59+
if ($this->intCategory) {
60+
$arrParams['smscat'] = $this->intCategory;
61+
}
62+
5963
$this->objLogger->addDebug('Sending the following to txtNation:', $arrParams);
6064

6165
$objClient = new Client([

classes/SMSMessage.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class SMSMessage extends Request
2525
protected $fltValue = null;
2626
protected $strCurrency = null;
2727
protected $intReply = null;
28+
protected $intCategory = null;
2829
protected $strEncoding = null;
2930
protected $blBinary = null;
3031
protected $strUdh = null;
@@ -200,6 +201,21 @@ public function binary($blBinary)
200201
return $this;
201202
}
202203

204+
public function category($intCategory)
205+
{
206+
if (!(Validator::numeric()->notEmpty()->length(3, 3)->validate($intCategory))) {
207+
$this->objLogger->addError('Category must be a numeric string with a length of 3.');
208+
209+
throw new SMSMessageException('Category must be a numeric string with a length of 3.');
210+
}
211+
212+
$this->intCategory = $intCategory;
213+
214+
$this->objLogger->addDebug('Category has been set to ' . $intCategory);
215+
216+
return $this;
217+
}
218+
203219
protected function validate()
204220
{
205221
$this->objLogger->addDebug('Validating the request');

0 commit comments

Comments
 (0)