PHP 클래스 libphonenumber\geocoding\PhoneNumberOfflineGeocoder

파일 보기 프로젝트 열기: giggsey/libphonenumber-for-php 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$instance PhoneNumberOfflineGeocoder
$phoneUtil libphonenumber\PhoneNumberUtil
$prefixFileReader libphonenumber\prefixmapper\PrefixFileReader

공개 메소드들

메소드 설명
getDescriptionForNumber ( PhoneNumber $number, string $locale, string $userRegion = null ) : string As per getDescriptionForValidNumber, but explicitly checks the validity of the number passed in.
getDescriptionForValidNumber ( PhoneNumber $number, string $locale, string $userRegion = null ) : string Returns a text description for the given phone number, in the language provided. The description might consist of the name of the country where the phone number is from, or the name of the geographical area the phone number is from if more detailed information is available.
getInstance ( string $mappingDir = self::MAPPING_DATA_DIRECTORY ) : PhoneNumberOfflineGeocoder Gets a PhoneNumberOfflineGeocoder instance to carry out international phone number geocoding.
resetInstance ( )

보호된 메소드들

메소드 설명
__construct ( string $phonePrefixDataDirectory ) PhoneNumberOfflineGeocoder constructor.
getCountryNameForNumber ( PhoneNumber $number, string $locale ) : string Returns the customary display name in the given language for the given territory the phone number is from. If it could be from many territories, nothing is returned.
getRegionDisplayName ( $regionCode, $locale ) : string Returns the customary display name in the given language for the given region.

메소드 상세

__construct() 보호된 메소드

PhoneNumberOfflineGeocoder constructor.
protected __construct ( string $phonePrefixDataDirectory )
$phonePrefixDataDirectory string

getCountryNameForNumber() 보호된 메소드

Returns the customary display name in the given language for the given territory the phone number is from. If it could be from many territories, nothing is returned.
protected getCountryNameForNumber ( PhoneNumber $number, string $locale ) : string
$number libphonenumber\PhoneNumber
$locale string
리턴 string

getDescriptionForNumber() 공개 메소드

As per getDescriptionForValidNumber, but explicitly checks the validity of the number passed in.
또한 보기: getDescriptionForValidNumber
public getDescriptionForNumber ( PhoneNumber $number, string $locale, string $userRegion = null ) : string
$number libphonenumber\PhoneNumber a valid phone number for which we want to get a text description
$locale string the language code for which the description should be written
$userRegion string 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.
리턴 string a text description for the given language code for the given phone number, or empty string if the number passed in is invalid

getDescriptionForValidNumber() 공개 메소드

This method assumes the validity of the number passed in has already been checked, and that the number is suitable for geocoding. We consider fixed-line and mobile numbers possible candidates for geocoding.

If $userRegion is set, we also consider the region of the user. If the phone number is from the same region as the user, only a lower-level description will be returned, if one exists. Otherwise, the phone number's region will be returned, with optionally some more detailed information.

For example, for a user from the region "US" (United States), we would show "Mountain View, CA" for a particular number, omitting the United States from the description. For a user from the United Kingdom (region "GB"), for the same number we may show "Mountain View, CA, United States" or even just "United States".

public getDescriptionForValidNumber ( PhoneNumber $number, string $locale, string $userRegion = null ) : string
$number libphonenumber\PhoneNumber a valid phone number for which we want to get a text description
$locale string the language code for which the description should be written
$userRegion string 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.
리턴 string a text description for the given language code for the given phone number

getInstance() 공개 정적인 메소드

The PhoneNumberOfflineGeocoder is implemented as a singleton. Therefore, calling this method multiple times will only result in one instance being created.

public static getInstance ( string $mappingDir = self::MAPPING_DATA_DIRECTORY ) : PhoneNumberOfflineGeocoder
$mappingDir string (Optional) Mapping Data Directory
리턴 PhoneNumberOfflineGeocoder

getRegionDisplayName() 보호된 메소드

Returns the customary display name in the given language for the given region.
protected getRegionDisplayName ( $regionCode, $locale ) : string
$regionCode
$locale
리턴 string

resetInstance() 공개 정적인 메소드

public static resetInstance ( )

프로퍼티 상세

$instance 보호되어 있는 정적으로 프로퍼티

protected static PhoneNumberOfflineGeocoder,libphonenumber\geocoding $instance
리턴 PhoneNumberOfflineGeocoder

$phoneUtil 보호되어 있는 프로퍼티

protected PhoneNumberUtil,libphonenumber $phoneUtil
리턴 libphonenumber\PhoneNumberUtil

$prefixFileReader 보호되어 있는 프로퍼티

protected PrefixFileReader,libphonenumber\prefixmapper $prefixFileReader
리턴 libphonenumber\prefixmapper\PrefixFileReader