Moodle PHP Documentation 5.0
Moodle 5.0.1+ (Build: 20250711) (61af040cd5f)
|
Public Member Functions | |
__serialize () | |
__toString () | |
Returns a string representation of this phone number. | |
__unserialize (array $data) | |
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 (PhoneNumber $other) | |
Returns whether this phone number is equal to another. | |
getCountryCode () | |
getCountryCodeSource () | |
Returns the country code source of this phone number. | |
getExtension () | |
Returns the extension of this phone number. | |
getNationalNumber () | |
Returns the national number of this phone number. | |
getNumberOfLeadingZeros () | |
Returns the number of leading zeros of this phone number. | |
getPreferredDomesticCarrierCode () | |
Returns the preferred domestic carrier code of this phone number. | |
getRawInput () | |
Returns the raw input of this phone number. | |
hasCountryCode () | |
Returns whether this phone number has a country code set. | |
hasCountryCodeSource () | |
Returns whether this phone number has a country code source. | |
hasExtension () | |
Returns whether this phone number has an extension set. | |
hasItalianLeadingZero () | |
Returns whether this phone number has the italian leading zero information set. | |
hasNationalNumber () | |
Returns whether this phone number has a national number set. | |
hasNumberOfLeadingZeros () | |
Returns whether this phone number has a number of leading zeros set. | |
hasPreferredDomesticCarrierCode () | |
Returns whether this phone number has a preferred domestic carrier code. | |
hasRawInput () | |
Returns whether this phone number has a raw input. | |
isItalianLeadingZero () | |
Returns whether this phone number uses an italian leading zero. | |
mergeFrom (PhoneNumber $other) | |
Merges the information from another phone number into this phone number. | |
serialize () | |
setCountryCode (int $value) | |
Sets the country code of this phone number. | |
setCountryCodeSource (int $value) | |
Sets the country code source of this phone number. | |
setExtension (string $value) | |
Sets the extension of this phone number. | |
setItalianLeadingZero (bool $value) | |
Sets whether this phone number uses an italian leading zero. | |
setNationalNumber (string $value) | |
Sets the national number of this phone number. | |
setNumberOfLeadingZeros (int $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 ($data) | |
Protected Attributes | |
int | $countryCode = 0 |
int | $countryCodeSource = CountryCodeSource::UNSPECIFIED |
The source from which the country_code is derived. | |
string | $extension = null |
Extension is not standardized in ITU recommendations, except for being defined as a series of numbers with a maximum length of 40 digits. | |
bool | $hasNumberOfLeadingZeros = false |
Whether this phone number has a number of leading zeros set. | |
bool | $italianLeadingZero = null |
In some countries, the national (significant) number starts with one or more "0"s without this being a national prefix or trunk code of some kind. | |
string | $nationalNumber = null |
National (significant) Number is defined in International Telecommunication Union (ITU) Recommendation E.164. | |
int | $numberOfLeadingZeros = 1 |
The number of leading zeros of this phone number. | |
string | $preferredDomesticCarrierCode = null |
The carrier selection code that is preferred when calling this phone number domestically. | |
string | $rawInput = null |
This field is used to store the raw input string containing phone numbers before it was canonicalized by the library. | |
libphonenumber\PhoneNumber::__serialize | ( | ) |
array{?int,?string,?string,?bool,int,?string,int,?string} |
libphonenumber\PhoneNumber::__unserialize | ( | array | $data | ) |
array{int,?string,?string,?bool,int,?string,int,?string} | $data |
libphonenumber\PhoneNumber::clear | ( | ) |
Clears this phone number.
This effectively resets this phone number to the state of a new instance.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearCountryCode | ( | ) |
Clears the country code of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearCountryCodeSource | ( | ) |
Clears the country code source of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearExtension | ( | ) |
Clears the extension of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearItalianLeadingZero | ( | ) |
Clears the italian leading zero information of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearNationalNumber | ( | ) |
Clears the national number of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearNumberOfLeadingZeros | ( | ) |
Clears the number of leading zeros of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearPreferredDomesticCarrierCode | ( | ) |
Clears the preferred domestic carrier code of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::clearRawInput | ( | ) |
Clears the raw input of this phone number.
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::equals | ( | PhoneNumber | $other | ) |
Returns whether this phone number is equal to another.
PhoneNumber | $other | The phone number to compare. |
bool | True if the phone numbers are equal, false otherwise. |
libphonenumber\PhoneNumber::getCountryCodeSource | ( | ) |
Returns the country code source of this phone number.
int|null | A CountryCodeSource constant, or null if not set. |
libphonenumber\PhoneNumber::getExtension | ( | ) |
Returns the extension of this phone number.
string|null | The extension, or null if not set. |
libphonenumber\PhoneNumber::getNationalNumber | ( | ) |
Returns the national number of this phone number.
string|null | The national number, or null if not set. |
libphonenumber\PhoneNumber::getNumberOfLeadingZeros | ( | ) |
Returns the number of leading zeros of this phone number.
int | The number of leading zeros. |
libphonenumber\PhoneNumber::getPreferredDomesticCarrierCode | ( | ) |
Returns the preferred domestic carrier code of this phone number.
string|null | The preferred domestic carrier code, or null if not set. |
libphonenumber\PhoneNumber::getRawInput | ( | ) |
Returns the raw input of this phone number.
string|null | The raw input, or null if not set. |
libphonenumber\PhoneNumber::hasCountryCode | ( | ) |
Returns whether this phone number has a country code set.
bool | True if a country code is set, false otherwise. |
libphonenumber\PhoneNumber::hasCountryCodeSource | ( | ) |
Returns whether this phone number has a country code source.
bool | True if a country code source is set, false otherwise. |
libphonenumber\PhoneNumber::hasExtension | ( | ) |
Returns whether this phone number has an extension set.
bool | True if an extension is set, false otherwise. |
libphonenumber\PhoneNumber::hasNationalNumber | ( | ) |
Returns whether this phone number has a national number set.
bool | True if a national number is set, false otherwise. |
libphonenumber\PhoneNumber::hasNumberOfLeadingZeros | ( | ) |
Returns whether this phone number has a number of leading zeros set.
bool | True if a number of leading zeros is set, false otherwise. |
libphonenumber\PhoneNumber::hasPreferredDomesticCarrierCode | ( | ) |
Returns whether this phone number has a preferred domestic carrier code.
bool | True if a preferred domestic carrier code is set, false otherwise. |
libphonenumber\PhoneNumber::hasRawInput | ( | ) |
Returns whether this phone number has a raw input.
bool | True if a raw input is set, false otherwise. |
libphonenumber\PhoneNumber::isItalianLeadingZero | ( | ) |
Returns whether this phone number uses an italian leading zero.
bool|null | True if it uses an italian leading zero, false if it does not, null if not set. |
libphonenumber\PhoneNumber::mergeFrom | ( | PhoneNumber | $other | ) |
Merges the information from another phone number into this phone number.
PhoneNumber | $other | The phone number to copy. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setCountryCode | ( | int | $value | ) |
Sets the country code of this phone number.
int | $value | The country code. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setCountryCodeSource | ( | int | $value | ) |
Sets the country code source of this phone number.
int | $value | A CountryCodeSource constant. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setExtension | ( | string | $value | ) |
Sets the extension of this phone number.
string | $value | The extension. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setItalianLeadingZero | ( | bool | $value | ) |
Sets whether this phone number uses an italian leading zero.
bool | $value | True to use italian leading zero, false otherwise. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setNationalNumber | ( | string | $value | ) |
Sets the national number of this phone number.
string | $value | The national number. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setNumberOfLeadingZeros | ( | int | $value | ) |
Sets the number of leading zeros of this phone number.
int | $value | The number of leading zeros. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setPreferredDomesticCarrierCode | ( | string | $value | ) |
Sets the preferred domestic carrier code of this phone number.
string | $value | The preferred domestic carrier code. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
libphonenumber\PhoneNumber::setRawInput | ( | string | $value | ) |
Sets the raw input of this phone number.
string | $value | The raw input. |
PhoneNumber | This PhoneNumber instance, for chaining method calls. |
|
protected |
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.
This must be one of the CountryCodeSource constants.
|
protected |
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 |
In some countries, the national (significant) number starts with one or more "0"s without this being a national prefix or trunk code of some kind.
For example, the leading zero in the national (significant) number of an Italian phone number indicates the number is a fixed-line number. 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 |
National (significant) Number is defined in International Telecommunication Union (ITU) Recommendation E.164.
It is a language/country-neutral representation of a phone number at a country level. For countries which have the concept of an "area code" or "national destination code", this is included in the National (significant) Number. Although the ITU says the maximum length should be 15, we have found longer numbers in some countries e.g. Germany.
Note that the National (significant) Number does not contain the National(trunk) prefix.
|
protected |
The carrier selection code that is preferred when calling this phone number domestically.
This also includes codes that need to be dialed in some countries when calling from landlines to mobiles or vice versa. For example, in Columbia, a "3" needs to be dialed before the phone number itself when calling from a mobile phone to a domestic landline phone and vice versa.
Note this is the "preferred" code, which means other codes may work as well.
|
protected |
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".