The SmsTransactionId
class is a simple model class that implements the Stringable
interface. It represents a transaction ID used for sending SMS.
To use the SmsTransactionId
class, you first need to instantiate it with a valid integer transaction ID. The constructor will throw an InvalidArgumentException
if the transaction ID is not valid.
use Simpay\Model\Request\SmsTransactionId;
// Instantiate an SmsTransactionId object with a valid integer transaction ID
$transactionId = new SmsTransactionId(123456789);
// Output the transaction ID as a string
echo $transactionId; // "123456789"
Instantiates an SmsTransactionId
object with a valid integer transaction ID.
Parameters:
$value
: int - The integer transaction ID.
Returns the transaction ID as a string.
Returns:
- string - The transaction ID as a string.
The InvalidArgumentException
is thrown if the transaction ID passed to the constructor is not valid.
use Simpay\Model\Request\SmsTransactionId;
try {
// Instantiate an SmsTransactionId object with a valid integer transaction ID
$transactionId = new SmsTransactionId(123456789);
// Output the transaction ID as a string
echo $transactionId; // "123456789"
} catch (\InvalidArgumentException $e) {
// Handle the exception
echo $e->getMessage();
}