本文整理匯總了PHP中libphonenumber\PhoneNumberUtil::isMobileNumberPortableRegion方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhoneNumberUtil::isMobileNumberPortableRegion方法的具體用法?PHP PhoneNumberUtil::isMobileNumberPortableRegion怎麽用?PHP PhoneNumberUtil::isMobileNumberPortableRegion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類libphonenumber\PhoneNumberUtil
的用法示例。
在下文中一共展示了PhoneNumberUtil::isMobileNumberPortableRegion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testIsMobileNumberPortableRegion
public function testIsMobileNumberPortableRegion()
{
$this->assertTrue($this->phoneUtil->isMobileNumberPortableRegion(RegionCode::US));
$this->assertTrue($this->phoneUtil->isMobileNumberPortableRegion(RegionCode::GB));
$this->assertFalse($this->phoneUtil->isMobileNumberPortableRegion(RegionCode::AE));
$this->assertFalse($this->phoneUtil->isMobileNumberPortableRegion(RegionCode::BS));
}
示例2: getSafeDisplayName
/**
* Gets the name of the carrier for the given phone number only when it is 'safe' to display to
* users. A carrier name is considered safe if the number is valid and for a region that doesn't
* support
* {@linkplain http://en.wikipedia.org/wiki/Mobile_number_portability mobile number portability}.
*
* @param $number PhoneNumber the phone number for which we want to get a carrier name
* @param $languageCode String the language code in which the name should be written
* @return string a carrier name that is safe to display to users, or the empty string
*/
public function getSafeDisplayName(PhoneNumber $number, $languageCode)
{
if ($this->phoneUtil->isMobileNumberPortableRegion($this->phoneUtil->getRegionCodeForNumber($number))) {
return "";
}
return $this->getNameForNumber($number, $languageCode);
}