[phonenumber validation] allow to validate against landline and mobile

phonenumbers
This commit is contained in:
2020-02-10 13:03:57 +01:00
parent d46ee72fb1
commit e348616d00
5 changed files with 30 additions and 3 deletions

View File

@@ -122,6 +122,24 @@ class PhonenumberHelper
return \in_array($validation, [ 'landline', 'voip' ]);
}
/**
* Return true if the phonenumber is a landline or voip phone. Return always false
* if the validation is not configured.
*
* @param string $phonenumber
* @return bool
*/
public function isValidPhonenumberAny($phonenumber) : bool
{
$validation = $this->performTwilioLookup($phonenumber);
if (NULL === $validation) {
return false;
}
return \in_array($validation, [ 'landline', 'voip', 'mobile' ]);
}
public function format($phonenumber)
{
return $this->performTwilioFormat($phonenumber);