public function MobileNumberUtil::getLocalNumber in Mobile Number 8
Same name and namespace in other branches
- 2.0.x 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_numberCode
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;
}