PHP 클래스 libphonenumber\PhoneNumberToCarrierMapper

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

보호된 프로퍼티들

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

공개 메소드들

메소드 설명
getInstance ( string $mappingDir = self::MAPPING_DATA_DIRECTORY ) : PhoneNumberToCarrierMapper Gets a {@link PhoneNumberToCarrierMapper} instance to carry out international carrier lookup.
getNameForNumber ( PhoneNumber $number, string $languageCode ) : string Gets the name of the carrier for the given phone number, in the language provided. As per {@link #getNameForValidNumber(PhoneNumber, Locale)} but explicitly checks the validity of the number passed in.
getNameForValidNumber ( PhoneNumber $number, string $languageCode ) : string Returns a carrier name for the given phone number, in the language provided. The carrier name is the one the number was originally allocated to, however if the country supports mobile number portability the number might not belong to the returned carrier anymore. If no mapping is found an empty string is returned.
getSafeDisplayName ( PhoneNumber $number, $languageCode ) : string 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}.

보호된 메소드들

메소드 설명
__construct ( $phonePrefixDataDirectory )
isMobile ( integer $numberType ) : boolean Checks if the supplied number type supports carrier lookup.

메소드 상세

__construct() 보호된 메소드

protected __construct ( $phonePrefixDataDirectory )

getInstance() 공개 정적인 메소드

The {@link PhoneNumberToCarrierMapper} 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 ) : PhoneNumberToCarrierMapper
$mappingDir string
리턴 PhoneNumberToCarrierMapper

getNameForNumber() 공개 메소드

Gets the name of the carrier for the given phone number, in the language provided. As per {@link #getNameForValidNumber(PhoneNumber, Locale)} but explicitly checks the validity of the number passed in.
public getNameForNumber ( PhoneNumber $number, string $languageCode ) : string
$number PhoneNumber The phone number for which we want to get a carrier name
$languageCode string Language code for which the description should be written
리턴 string a carrier name for the given phone number, or empty string if the number passed in is invalid

getNameForValidNumber() 공개 메소드

This method assumes the validity of the number passed in has already been checked, and that the number is suitable for carrier lookup. We consider mobile and pager numbers possible candidates for carrier lookup.

public getNameForValidNumber ( PhoneNumber $number, string $languageCode ) : string
$number PhoneNumber a valid phone number for which we want to get a carrier name
$languageCode string the language code in which the name should be written
리턴 string a carrier name for the given phone number

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}.
public getSafeDisplayName ( PhoneNumber $number, $languageCode ) : string
$number PhoneNumber PhoneNumber the phone number for which we want to get a carrier name
$languageCode String the language code in which the name should be written
리턴 string a carrier name that is safe to display to users, or the empty string

isMobile() 보호된 메소드

Checks if the supplied number type supports carrier lookup.
protected isMobile ( integer $numberType ) : boolean
$numberType integer A PhoneNumberType int
리턴 boolean

프로퍼티 상세

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

protected static PhoneNumberToCarrierMapper[],libphonenumber $instance
리턴 PhoneNumberToCarrierMapper[]

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

protected PhoneNumberUtil,libphonenumber $phoneUtil
리턴 PhoneNumberUtil

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

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