PHP Class libphonenumber\prefixmapper\PrefixFileReader

Show file Open project: giggsey/libphonenumber-for-php Class Usage Examples

Protected Properties

Property Type Description
$availablePhonePrefixMaps array A mapping from countryCallingCode_lang to the corresponding phone prefix map that has been loaded.
$mappingFileProvider MappingFileProvider The mappingFileProvider knows for which combination of countryCallingCode and language a phone prefix mapping file is available in the file system, so that a file can be loaded when needed.
$phonePrefixDataDirectory

Public Methods

Method Description
__construct ( $phonePrefixDataDirectory )
getDescriptionForNumber ( PhoneNumber $number, string $language, string $script, string $region ) : string Returns a text description in the given language for the given phone number.
getPhonePrefixDescriptions ( $prefixMapKey, $language, $script, $region ) : PhonePrefixMap | null
mayFallBackToEnglish ( $language )

Protected Methods

Method Description
loadMappingFileProvider ( )
loadPhonePrefixMapFromFile ( $fileName )

Method Details

__construct() public method

public __construct ( $phonePrefixDataDirectory )

getDescriptionForNumber() public method

Returns a text description in the given language for the given phone number.
public getDescriptionForNumber ( PhoneNumber $number, string $language, string $script, string $region ) : string
$number libphonenumber\PhoneNumber the phone number for which we want to get a text description
$language string two-letter lowercase ISO language codes as defined by ISO 639-1
$script string four-letter titlecase (the first letter is uppercase and the rest of the letters are lowercase) ISO script codes as defined in ISO 15924
$region string two-letter uppercase ISO country codes as defined by ISO 3166-1
return string a text description in the given language for the given phone number, or an empty string if a description is not available

getPhonePrefixDescriptions() public method

public getPhonePrefixDescriptions ( $prefixMapKey, $language, $script, $region ) : PhonePrefixMap | null
$prefixMapKey
$language
$script
$region
return PhonePrefixMap | null

loadMappingFileProvider() protected method

protected loadMappingFileProvider ( )

loadPhonePrefixMapFromFile() protected method

protected loadPhonePrefixMapFromFile ( $fileName )

mayFallBackToEnglish() public method

public mayFallBackToEnglish ( $language )

Property Details

$availablePhonePrefixMaps protected property

A mapping from countryCallingCode_lang to the corresponding phone prefix map that has been loaded.
protected array $availablePhonePrefixMaps
return array

$mappingFileProvider protected property

The mappingFileProvider knows for which combination of countryCallingCode and language a phone prefix mapping file is available in the file system, so that a file can be loaded when needed.
protected MappingFileProvider,libphonenumber\prefixmapper $mappingFileProvider
return MappingFileProvider

$phonePrefixDataDirectory protected property

protected $phonePrefixDataDirectory