PHP 클래스 libphonenumber\PhoneNumber

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

보호된 프로퍼티들

프로퍼티 타입 설명
$countryCode integer | null The country calling code for this number, as defined by the International Telecommunication Union (ITU). For example, this would be 1 for NANPA countries, and 33 for France.
$countryCodeSource integer | null The source from which the country_code is derived. This is not set in the general parsing method, but in the method that parses and keeps raw_input. New fields could be added upon request.
$extension string | null Extension is not standardized in ITU recommendations, except for being defined as a series of numbers with a maximum length of 40 digits. It is defined as a string here to accommodate for the possible use of a leading zero in the extension (organizations have complete freedom to do so, as there is no standard defined). However, only ASCII digits should be stored here.
$hasNumberOfLeadingZeros boolean Whether this phone number has a number of leading zeros set.
$italianLeadingZero boolean | null There have been plans to migrate fixed-line numbers to start with the digit two since December 2000, but it has not happened yet. See http://en.wikipedia.org/wiki/%2B39 for more details. These fields can be safely ignored (there is no need to set them) for most countries. Some limited number of countries behave like Italy - for these cases, if the leading zero(s) of a number would be retained even when dialling internationally, set this flag to true, and also set the number of leading zeros. Clients who use the parsing functionality of the i18n phone number libraries will have these fields set if necessary automatically.
$nationalNumber string | null Note that the National (significant) Number does not contain the National(trunk) prefix.
$numberOfLeadingZeros integer The number of leading zeros of this phone number.
$preferredDomesticCarrierCode string | null Note this is the "preferred" code, which means other codes may work as well.
$rawInput string | null This field is used to store the raw input string containing phone numbers before it was canonicalized by the library. For example, it could be used to store alphanumerical numbers such as "1-800-GOOG-411".

공개 메소드들

메소드 설명
__toString ( ) : string Returns a string representation of this phone number.
clear ( ) : PhoneNumber Clears this phone number.
clearCountryCode ( ) : PhoneNumber Clears the country code of this phone number.
clearCountryCodeSource ( ) : PhoneNumber Clears the country code source of this phone number.
clearExtension ( ) : PhoneNumber Clears the extension of this phone number.
clearItalianLeadingZero ( ) : PhoneNumber Clears the italian leading zero information of this phone number.
clearNationalNumber ( ) : PhoneNumber Clears the national number of this phone number.
clearNumberOfLeadingZeros ( ) : PhoneNumber Clears the number of leading zeros of this phone number.
clearPreferredDomesticCarrierCode ( ) : PhoneNumber Clears the preferred domestic carrier code of this phone number.
clearRawInput ( ) : PhoneNumber Clears the raw input of this phone number.
equals ( PhoneNumber $other ) : boolean Returns whether this phone number is equal to another.
getCountryCode ( ) : integer | null Returns the country code of this phone number.
getCountryCodeSource ( ) : integer | null Returns the country code source of this phone number.
getExtension ( ) : string | null Returns the extension of this phone number.
getNationalNumber ( ) : string | null Returns the country code of this phone number.
getNumberOfLeadingZeros ( ) : integer Returns the number of leading zeros of this phone number.
getPreferredDomesticCarrierCode ( ) : string | null Returns the preferred domestic carrier code of this phone number.
getRawInput ( ) : string | null Returns the raw input of this phone number.
hasCountryCode ( ) : boolean Returns whether this phone number has a country code set.
hasCountryCodeSource ( ) : boolean Returns whether this phone number has a country code source.
hasExtension ( ) : boolean Returns whether this phone number has an extension set.
hasItalianLeadingZero ( ) : boolean Returns whether this phone number has the italian leading zero information set.
hasNationalNumber ( ) : boolean Returns whether this phone number has a national number set.
hasNumberOfLeadingZeros ( ) : boolean Returns whether this phone number has a number of leading zeros set.
hasPreferredDomesticCarrierCode ( ) : boolean Returns whether this phone number has a preferred domestic carrier code.
hasRawInput ( ) : boolean Returns whether this phone number has a raw input.
isItalianLeadingZero ( ) : boolean | null Returns whether this phone number uses an italian leading zero.
mergeFrom ( PhoneNumber $other ) : PhoneNumber Merges the information from another phone number into this phone number.
serialize ( )
setCountryCode ( integer $value ) : PhoneNumber Sets the country code of this phone number.
setCountryCodeSource ( integer $value ) : PhoneNumber Sets the country code source of this phone number.
setExtension ( string $value ) : PhoneNumber Sets the extension of this phone number.
setItalianLeadingZero ( boolean $value ) : PhoneNumber Sets whether this phone number uses an italian leading zero.
setNationalNumber ( string $value ) : PhoneNumber Sets the national number of this phone number.
setNumberOfLeadingZeros ( integer $value ) : PhoneNumber Sets the number of leading zeros of this phone number.
setPreferredDomesticCarrierCode ( string $value ) : PhoneNumber Sets the preferred domestic carrier code of this phone number.
setRawInput ( string $value ) : PhoneNumber Sets the raw input of this phone number.
unserialize ( $serialized )

메소드 상세

__toString() 공개 메소드

Returns a string representation of this phone number.
public __toString ( ) : string
리턴 string

clear() 공개 메소드

This effectively resets this phone number to the state of a new instance.
public clear ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearCountryCode() 공개 메소드

Clears the country code of this phone number.
public clearCountryCode ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearCountryCodeSource() 공개 메소드

Clears the country code source of this phone number.
public clearCountryCodeSource ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearExtension() 공개 메소드

Clears the extension of this phone number.
public clearExtension ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearItalianLeadingZero() 공개 메소드

Clears the italian leading zero information of this phone number.
public clearItalianLeadingZero ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearNationalNumber() 공개 메소드

Clears the national number of this phone number.
public clearNationalNumber ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearNumberOfLeadingZeros() 공개 메소드

Clears the number of leading zeros of this phone number.
public clearNumberOfLeadingZeros ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearPreferredDomesticCarrierCode() 공개 메소드

Clears the preferred domestic carrier code of this phone number.
public clearPreferredDomesticCarrierCode ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

clearRawInput() 공개 메소드

Clears the raw input of this phone number.
public clearRawInput ( ) : PhoneNumber
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

equals() 공개 메소드

Returns whether this phone number is equal to another.
public equals ( PhoneNumber $other ) : boolean
$other PhoneNumber The phone number to compare.
리턴 boolean True if the phone numbers are equal, false otherwise.

getCountryCode() 공개 메소드

Returns the country code of this phone number.
public getCountryCode ( ) : integer | null
리턴 integer | null The country code, or null if not set.

getCountryCodeSource() 공개 메소드

Returns the country code source of this phone number.
public getCountryCodeSource ( ) : integer | null
리턴 integer | null A CountryCodeSource constant, or null if not set.

getExtension() 공개 메소드

Returns the extension of this phone number.
public getExtension ( ) : string | null
리턴 string | null The extension, or null if not set.

getNationalNumber() 공개 메소드

Returns the country code of this phone number.
public getNationalNumber ( ) : string | null
리턴 string | null The national number, or null if not set.

getNumberOfLeadingZeros() 공개 메소드

Returns the number of leading zeros of this phone number.
public getNumberOfLeadingZeros ( ) : integer
리턴 integer The number of leading zeros.

getPreferredDomesticCarrierCode() 공개 메소드

Returns the preferred domestic carrier code of this phone number.
public getPreferredDomesticCarrierCode ( ) : string | null
리턴 string | null The preferred domestic carrier code, or null if not set.

getRawInput() 공개 메소드

Returns the raw input of this phone number.
public getRawInput ( ) : string | null
리턴 string | null The raw input, or null if not set.

hasCountryCode() 공개 메소드

Returns whether this phone number has a country code set.
public hasCountryCode ( ) : boolean
리턴 boolean True if a country code is set, false otherwise.

hasCountryCodeSource() 공개 메소드

Returns whether this phone number has a country code source.
public hasCountryCodeSource ( ) : boolean
리턴 boolean True if a country code source is set, false otherwise.

hasExtension() 공개 메소드

Returns whether this phone number has an extension set.
public hasExtension ( ) : boolean
리턴 boolean True if an extension is set, false otherwise.

hasItalianLeadingZero() 공개 메소드

Returns whether this phone number has the italian leading zero information set.
public hasItalianLeadingZero ( ) : boolean
리턴 boolean

hasNationalNumber() 공개 메소드

Returns whether this phone number has a national number set.
public hasNationalNumber ( ) : boolean
리턴 boolean True if a national number is set, false otherwise.

hasNumberOfLeadingZeros() 공개 메소드

Returns whether this phone number has a number of leading zeros set.
public hasNumberOfLeadingZeros ( ) : boolean
리턴 boolean True if a number of leading zeros is set, false otherwise.

hasPreferredDomesticCarrierCode() 공개 메소드

Returns whether this phone number has a preferred domestic carrier code.
public hasPreferredDomesticCarrierCode ( ) : boolean
리턴 boolean True if a preferred domestic carrier code is set, false otherwise.

hasRawInput() 공개 메소드

Returns whether this phone number has a raw input.
public hasRawInput ( ) : boolean
리턴 boolean True if a raw input is set, false otherwise.

isItalianLeadingZero() 공개 메소드

Returns whether this phone number uses an italian leading zero.
public isItalianLeadingZero ( ) : boolean | null
리턴 boolean | null True if it uses an italian leading zero, false it it does not, null if not set.

mergeFrom() 공개 메소드

Merges the information from another phone number into this phone number.
public mergeFrom ( PhoneNumber $other ) : PhoneNumber
$other PhoneNumber The phone number to copy.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

serialize() 공개 메소드

public serialize ( )

setCountryCode() 공개 메소드

Sets the country code of this phone number.
public setCountryCode ( integer $value ) : PhoneNumber
$value integer The country code.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

setCountryCodeSource() 공개 메소드

Sets the country code source of this phone number.
public setCountryCodeSource ( integer $value ) : PhoneNumber
$value integer A CountryCodeSource constant.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

setExtension() 공개 메소드

Sets the extension of this phone number.
public setExtension ( string $value ) : PhoneNumber
$value string The extension.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

setItalianLeadingZero() 공개 메소드

Sets whether this phone number uses an italian leading zero.
public setItalianLeadingZero ( boolean $value ) : PhoneNumber
$value boolean True to use italian leading zero, false otherwise.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

setNationalNumber() 공개 메소드

Sets the national number of this phone number.
public setNationalNumber ( string $value ) : PhoneNumber
$value string The national number.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

setNumberOfLeadingZeros() 공개 메소드

Sets the number of leading zeros of this phone number.
public setNumberOfLeadingZeros ( integer $value ) : PhoneNumber
$value integer The number of leading zeros.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

setPreferredDomesticCarrierCode() 공개 메소드

Sets the preferred domestic carrier code of this phone number.
public setPreferredDomesticCarrierCode ( string $value ) : PhoneNumber
$value string The preferred domestic carrier code.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

setRawInput() 공개 메소드

Sets the raw input of this phone number.
public setRawInput ( string $value ) : PhoneNumber
$value string The raw input.
리턴 PhoneNumber This PhoneNumber instance, for chaining method calls.

unserialize() 공개 메소드

public unserialize ( $serialized )

프로퍼티 상세

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

The country calling code for this number, as defined by the International Telecommunication Union (ITU). For example, this would be 1 for NANPA countries, and 33 for France.
protected int|null $countryCode
리턴 integer | null

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

The source from which the country_code is derived. This is not set in the general parsing method, but in the method that parses and keeps raw_input. New fields could be added upon request.
또한 보기: CountryCodeSource This must be one of the CountryCodeSource constants.
protected int|null $countryCodeSource
리턴 integer | null

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

Extension is not standardized in ITU recommendations, except for being defined as a series of numbers with a maximum length of 40 digits. It is defined as a string here to accommodate for the possible use of a leading zero in the extension (organizations have complete freedom to do so, as there is no standard defined). However, only ASCII digits should be stored here.
protected string|null $extension
리턴 string | null

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

Whether this phone number has a number of leading zeros set.
protected bool $hasNumberOfLeadingZeros
리턴 boolean

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

There have been plans to migrate fixed-line numbers to start with the digit two since December 2000, but it has not happened yet. See http://en.wikipedia.org/wiki/%2B39 for more details. These fields can be safely ignored (there is no need to set them) for most countries. Some limited number of countries behave like Italy - for these cases, if the leading zero(s) of a number would be retained even when dialling internationally, set this flag to true, and also set the number of leading zeros. Clients who use the parsing functionality of the i18n phone number libraries will have these fields set if necessary automatically.
protected bool|null $italianLeadingZero
리턴 boolean | null

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

Note that the National (significant) Number does not contain the National(trunk) prefix.
protected string|null $nationalNumber
리턴 string | null

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

The number of leading zeros of this phone number.
protected int $numberOfLeadingZeros
리턴 integer

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

Note this is the "preferred" code, which means other codes may work as well.
protected string|null $preferredDomesticCarrierCode
리턴 string | null

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

This field is used to store the raw input string containing phone numbers before it was canonicalized by the library. For example, it could be used to store alphanumerical numbers such as "1-800-GOOG-411".
protected string|null $rawInput
리턴 string | null