You are here

public function MobileNumberUtil::getMobileNumber in Mobile Number 2.0.x

Same name and namespace in other branches
  1. 8 src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::getMobileNumber()

Get mobile number object.

Parameters

string $number: Number.

null|string $country: Country.

array $types: Mobile number types to verify as defined in \libphonenumber\PhoneNumberType.

Return value

\libphonenumber\PhoneNumber|null Phone Number object if successful.

Overrides MobileNumberUtilInterface::getMobileNumber

File

src/MobileNumberUtil.php, line 108

Class

MobileNumberUtil
Turns a render array into a HTML string.

Namespace

Drupal\mobile_number

Code

public function getMobileNumber($number, $country = NULL, $types = [
  1 => 1,
  2 => 2,
]) {
  try {
    return $this
      ->testMobileNumber($number, $country, $types);
  } catch (MobileNumberException $e) {
    return NULL;
  }
}