當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhoneNumberUtil::isNumberGeographical方法代碼示例

本文整理匯總了PHP中libphonenumber\PhoneNumberUtil::isNumberGeographical方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhoneNumberUtil::isNumberGeographical方法的具體用法?PHP PhoneNumberUtil::isNumberGeographical怎麽用?PHP PhoneNumberUtil::isNumberGeographical使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在libphonenumber\PhoneNumberUtil的用法示例。


在下文中一共展示了PhoneNumberUtil::isNumberGeographical方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDescriptionForNumber

 /**
  * As per getDescriptionForValidNumber, but explicitly checks the validity of the number
  * passed in.
  *
  *
  * @see getDescriptionForValidNumber
  * @param PhoneNumber $number a valid phone number for which we want to get a text description
  * @param string $locale the language code for which the description should be written
  * @param string $userRegion the region code for a given user. This region will be omitted from the
  *     description if the phone number comes from this region. It is a two-letter uppercase ISO
  *     country code as defined by ISO 3166-1.
  * @return string a text description for the given language code for the given phone number, or empty
  *     string if the number passed in is invalid
  */
 public function getDescriptionForNumber(PhoneNumber $number, $locale, $userRegion = null)
 {
     $numberType = $this->phoneUtil->getNumberType($number);
     if ($numberType === PhoneNumberType::UNKNOWN) {
         return "";
     } elseif (!$this->phoneUtil->isNumberGeographical($numberType, $number->getCountryCode())) {
         return $this->getCountryNameForNumber($number, $locale);
     }
     return $this->getDescriptionForValidNumber($number, $locale, $userRegion);
 }
開發者ID:giggsey,項目名稱:libphonenumber-for-php,代碼行數:24,代碼來源:PhoneNumberOfflineGeocoder.php

示例2: testIsNumberGeographical

 public function testIsNumberGeographical()
 {
     $this->assertFalse($this->phoneUtil->isNumberGeographical(self::$bsMobile));
     // Bahamas, mobile phone number.
     $this->assertTrue($this->phoneUtil->isNumberGeographical(self::$auNumber));
     // Australian fixed line number.
     $this->assertFalse($this->phoneUtil->isNumberGeographical(self::$internationalTollFree));
     // International toll
     // free number
 }
開發者ID:wasabiNorman,項目名稱:libphonenumber-for-php,代碼行數:10,代碼來源:PhoneNumberUtilTest.php


注:本文中的libphonenumber\PhoneNumberUtil::isNumberGeographical方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。