Make checks for mobile number format #394

This commit is contained in:
Kendrick Chan 2020-05-04 11:30:43 +08:00
parent cb95705848
commit 82baef50ee

View file

@ -45,7 +45,26 @@ class WarrantySMSCommand extends Command
foreach ($warrs as $w)
{
error_log($w->getID());
error_log($w->getID() . ' - ' . $w->getMobileNumber());
// check valid number
$num = trim($w->getMobileNumber());
// should start with '9'
if ($num[0] != '9')
continue;
// should be 10 digits
if (strlen($num) != 10)
continue;
// should be numeric
if (!is_numeric($num))
continue;
error_log('valid!');
// add 63 prefix
$num = '63' . $num;
}
/*