Property | Type | Description | |
---|---|---|---|
$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". |
Method | Description | |
---|---|---|
__toString ( ) : string | Returns a string representation of this phone number. | |
clear ( ) : |
Clears this phone number. | |
clearCountryCode ( ) : |
Clears the country code of this phone number. | |
clearCountryCodeSource ( ) : |
Clears the country code source of this phone number. | |
clearExtension ( ) : |
Clears the extension of this phone number. | |
clearItalianLeadingZero ( ) : |
Clears the italian leading zero information of this phone number. | |
clearNationalNumber ( ) : |
Clears the national number of this phone number. | |
clearNumberOfLeadingZeros ( ) : |
Clears the number of leading zeros of this phone number. | |
clearPreferredDomesticCarrierCode ( ) : |
Clears the preferred domestic carrier code of this phone number. | |
clearRawInput ( ) : |
Clears the raw input of this phone number. | |
equals ( |
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 ( |
Merges the information from another phone number into this phone number. | |
serialize ( ) | ||
setCountryCode ( integer $value ) : |
Sets the country code of this phone number. | |
setCountryCodeSource ( integer $value ) : |
Sets the country code source of this phone number. | |
setExtension ( string $value ) : |
Sets the extension of this phone number. | |
setItalianLeadingZero ( boolean $value ) : |
Sets whether this phone number uses an italian leading zero. | |
setNationalNumber ( string $value ) : |
Sets the national number of this phone number. | |
setNumberOfLeadingZeros ( integer $value ) : |
Sets the number of leading zeros of this phone number. | |
setPreferredDomesticCarrierCode ( string $value ) : |
Sets the preferred domestic carrier code of this phone number. | |
setRawInput ( string $value ) : |
Sets the raw input of this phone number. | |
unserialize ( $serialized ) |
public __toString ( ) : string | ||
return | string |
public clear ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearCountryCode ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearCountryCodeSource ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearExtension ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearItalianLeadingZero ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearNationalNumber ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearNumberOfLeadingZeros ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearPreferredDomesticCarrierCode ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public clearRawInput ( ) : |
||
return | This PhoneNumber instance, for chaining method calls. |
public getCountryCode ( ) : integer | null | ||
return | integer | null | The country code, or null if not set. |
public getCountryCodeSource ( ) : integer | null | ||
return | integer | null | A CountryCodeSource constant, or null if not set. |
public getExtension ( ) : string | null | ||
return | string | null | The extension, or null if not set. |
public getNationalNumber ( ) : string | null | ||
return | string | null | The national number, or null if not set. |
public getNumberOfLeadingZeros ( ) : integer | ||
return | integer | The number of leading zeros. |
public getPreferredDomesticCarrierCode ( ) : string | null | ||
return | string | null | The preferred domestic carrier code, or null if not set. |
public getRawInput ( ) : string | null | ||
return | string | null | The raw input, or null if not set. |
public hasCountryCode ( ) : boolean | ||
return | boolean | True if a country code is set, false otherwise. |
public hasCountryCodeSource ( ) : boolean | ||
return | boolean | True if a country code source is set, false otherwise. |
public hasExtension ( ) : boolean | ||
return | boolean | True if an extension is set, false otherwise. |
public hasItalianLeadingZero ( ) : boolean | ||
return | boolean |
public hasNationalNumber ( ) : boolean | ||
return | boolean | True if a national number is set, false otherwise. |
public hasNumberOfLeadingZeros ( ) : boolean | ||
return | boolean | True if a number of leading zeros is set, false otherwise. |
public hasPreferredDomesticCarrierCode ( ) : boolean | ||
return | boolean | True if a preferred domestic carrier code is set, false otherwise. |
public hasRawInput ( ) : boolean | ||
return | boolean | True if a raw input is set, false otherwise. |
public isItalianLeadingZero ( ) : boolean | null | ||
return | boolean | null | True if it uses an italian leading zero, false it it does not, null if not set. |
public mergeFrom ( |
||
$other | The phone number to copy. | |
return | This PhoneNumber instance, for chaining method calls. |
public setCountryCode ( integer $value ) : |
||
$value | integer | The country code. |
return | This PhoneNumber instance, for chaining method calls. |
public setCountryCodeSource ( integer $value ) : |
||
$value | integer | A CountryCodeSource constant. |
return | This PhoneNumber instance, for chaining method calls. |
public setExtension ( string $value ) : |
||
$value | string | The extension. |
return | This PhoneNumber instance, for chaining method calls. |
public setItalianLeadingZero ( boolean $value ) : |
||
$value | boolean | True to use italian leading zero, false otherwise. |
return | This PhoneNumber instance, for chaining method calls. |
public setNationalNumber ( string $value ) : |
||
$value | string | The national number. |
return | This PhoneNumber instance, for chaining method calls. |
public setNumberOfLeadingZeros ( integer $value ) : |
||
$value | integer | The number of leading zeros. |
return | This PhoneNumber instance, for chaining method calls. |
public setPreferredDomesticCarrierCode ( string $value ) : |
||
$value | string | The preferred domestic carrier code. |
return | This PhoneNumber instance, for chaining method calls. |
public setRawInput ( string $value ) : |
||
$value | string | The raw input. |
return | This PhoneNumber instance, for chaining method calls. |
protected bool $hasNumberOfLeadingZeros | ||
return | boolean |
protected int $numberOfLeadingZeros | ||
return | integer |