public function __construct($msisdn) { if (Msisdn::validate($msisdn) === false) { throw new Exception('The supplied MSISDN is not valid. ' . 'You can use the `Msisdn::validate()` method ' . 'to validate the MSISDN being passed.', 400); } $this->msisdn = Msisdn::clean($msisdn); }
public function __construct($msisdn) { if (Msisdn::validate($msisdn) === false) { $exception = new Exception('The supplied MSISDN is not valid. You can use the Msisdn::validate() method to validate the MSISDN being passed.', 400); throw $exception; } $msisdn = Msisdn::clean($msisdn); $this->msisdn = $msisdn; }
/** * [Required] Mobile number of the user whom you want to send the message to. * You should invoke this method at least once before sending the SMS. * * @param string $mobileNumber * @return bool returns true if the recipient was successfully added as a recipient * false if otherwise */ public function setMobileNumber($mobileNumber) { // We should format the number if it's valid // If it's not a valid mobile number, just let it be and let the API handle it. $this->mobileNumber = $mobileNumber; if (Msisdn::validate($mobileNumber)) { $msisdn = new Msisdn($mobileNumber); $msisdn->setCountryPrefix('63'); $this->mobileNumber = $msisdn->get(true); } }