PHP Class libphonenumber\ShortNumberUtil

Deprecation: As of release 5.8, replaced by ShortNumberInfo.
ファイルを表示 Open project: giggsey/libphonenumber-for-php Class Usage Examples

Protected Properties

Property Type Description
$phoneUtil PhoneNumberUtil

Public Methods

Method Description
__construct ( PhoneNumberUtil $phoneNumberUtil = null )
connectsToEmergencyNumber ( $number, $regionCode ) : boolean Returns true if the number might be used to connect to an emergency service in the given region.
getSupportedRegions ( )
isEmergencyNumber ( $number, $regionCode ) : boolean Returns true if the number exactly matches an emergency service number in the given region.

Method Details

__construct() public method

public __construct ( PhoneNumberUtil $phoneNumberUtil = null )
$phoneNumberUtil PhoneNumberUtil

connectsToEmergencyNumber() public method

This method takes into account cases where the number might contain formatting, or might have additional digits appended (when it is okay to do that in the region specified).
public connectsToEmergencyNumber ( $number, $regionCode ) : boolean
$number String the phone number to test
$regionCode String the region where the phone number is being dialed
return boolean if the number might be used to connect to an emergency service in the given region.

getSupportedRegions() public method

public getSupportedRegions ( )

isEmergencyNumber() public method

This method takes into account cases where the number might contain formatting, but doesn't allow additional digits to be appended.
public isEmergencyNumber ( $number, $regionCode ) : boolean
$number String The phone number to test
$regionCode String The region where the phone number is being dialed
return boolean if the number exactly matches an emergency services number in the given region.

Property Details

$phoneUtil protected_oe property

protected PhoneNumberUtil,libphonenumber $phoneUtil
return PhoneNumberUtil