PHP Class libphonenumber\PhoneNumberToTimeZonesMapper

Exibir arquivo Open project: giggsey/libphonenumber-for-php Class Usage Examples

Protected Properties

Property Type Description
$instance PhoneNumberToTimeZonesMapper
$phoneUtil PhoneNumberUtil
$prefixTimeZonesMap
$unknownTimeZoneList

Public Methods

Method Description
getInstance ( $mappingDir = self::MAPPING_DATA_DIRECTORY ) : PhoneNumberToTimeZonesMapper Gets a {@link PhoneNumberToTimeZonesMapper} instance.
getTimeZonesForGeographicalNumber ( PhoneNumber $number ) : array Returns a list of time zones to which a phone number belongs.
getTimeZonesForNumber ( PhoneNumber $number ) : array As per {@link #getTimeZonesForGeographicalNumber(PhoneNumber)} but explicitly checks the validity of the number passed in.
getUnknownTimeZone ( ) : string Returns a String with the ICU unknown time zone.

Protected Methods

Method Description
__construct ( $phonePrefixDataDirectory )
getCountryLevelTimeZonesforNumber ( PhoneNumber $number ) : array Returns the list of time zones corresponding to the country calling code of {@code number}.
getTimeZonesForGeocodableNumber ( PhoneNumber $number ) : array Returns a list of time zones to which a geocodable phone number belongs.
loadPrefixTimeZonesMapFromFile ( $path )

Method Details

__construct() protected method

protected __construct ( $phonePrefixDataDirectory )

getCountryLevelTimeZonesforNumber() protected method

Returns the list of time zones corresponding to the country calling code of {@code number}.
protected getCountryLevelTimeZonesforNumber ( PhoneNumber $number ) : array
$number PhoneNumber PhoneNumber the phone number to look up
return array the list of corresponding time zones or a single element list with the default unknown time zone if no other time zone was found

getInstance() public static method

The {@link PhoneNumberToTimeZonesMapper} is implemented as a singleton. Therefore, calling this method multiple times will only result in one instance being created.

public static getInstance ( $mappingDir = self::MAPPING_DATA_DIRECTORY ) : PhoneNumberToTimeZonesMapper
$mappingDir
return PhoneNumberToTimeZonesMapper instance

getTimeZonesForGeocodableNumber() protected method

Returns a list of time zones to which a geocodable phone number belongs.
protected getTimeZonesForGeocodableNumber ( PhoneNumber $number ) : array
$number PhoneNumber The phone number for which we want to get the time zones to which it belongs
return array the list of correspondiing time zones or a single element list with the default unknown timezone if no other time zone was found or if the number was invalid

getTimeZonesForGeographicalNumber() public method

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

public getTimeZonesForGeographicalNumber ( PhoneNumber $number ) : array
$number PhoneNumber PhoneNumber a valid phone number for which we want to get the time zones to which it belongs
return array a list of the corresponding time zones or a single element list with the default unknown time zone if no other time zone was found or if the number was invalid

getTimeZonesForNumber() public method

As per {@link #getTimeZonesForGeographicalNumber(PhoneNumber)} but explicitly checks the validity of the number passed in.
public getTimeZonesForNumber ( PhoneNumber $number ) : array
$number PhoneNumber PhoneNumber the phone number for which we want to get the time zones to which it belongs
return array a list of the corresponding time zones or a single element list with the default unknown time zone if no other time zone was found or if the number was invalid

getUnknownTimeZone() public static method

Returns a String with the ICU unknown time zone.
public static getUnknownTimeZone ( ) : string
return string

loadPrefixTimeZonesMapFromFile() protected static method

protected static loadPrefixTimeZonesMapFromFile ( $path )

Property Details

$instance protected_oe static_oe property

protected static PhoneNumberToTimeZonesMapper,libphonenumber $instance
return PhoneNumberToTimeZonesMapper

$phoneUtil protected_oe property

protected PhoneNumberUtil,libphonenumber $phoneUtil
return PhoneNumberUtil

$prefixTimeZonesMap protected_oe property

protected $prefixTimeZonesMap

$unknownTimeZoneList protected_oe property

protected $unknownTimeZoneList