You are here

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

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

Get national number.

Parameters

\libphonenumber\PhoneNumber $mobile_number: Phone number object.

Return value

string National number.

Overrides MobileNumberUtilInterface::getLocalNumber

File

src/MobileNumberUtil.php, line 165

Class

MobileNumberUtil
Turns a render array into a HTML string.

Namespace

Drupal\mobile_number

Code

public function getLocalNumber(PhoneNumber $mobile_number) {
  if (!$mobile_number) {
    return NULL;
  }
  $region_code = $this->libUtil
    ->getRegionCodeForNumber($mobile_number);
  $prefix = $this->libUtil
    ->getNddPrefixForRegion($region_code, TRUE);
  $national_number = $mobile_number
    ->getNationalNumber();
  return $prefix . $national_number;
}