update v 1.0.7.5

This commit is contained in:
Sujit Prasad
2016-06-13 20:41:55 +05:30
parent aa9786d829
commit 283d97e3ea
5078 changed files with 339851 additions and 175995 deletions

View File

@@ -2,4 +2,4 @@
# It can be a commit, branch or tag of the https://github.com/googlei18n/libphonenumber project
#
# For more information, look at the phing tasks in build.xml
libphonenumber-7.2.6
libphonenumber-7.4.2

View File

@@ -1,6 +1,7 @@
# libphonenumber for PHP [![Build Status](https://img.shields.io/travis/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://travis-ci.org/giggsey/libphonenumber-for-php) [![Coverage Status](https://img.shields.io/coveralls/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://coveralls.io/r/giggsey/libphonenumber-for-php?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
[![Total Downloads](https://poser.pugx.org/giggsey/libphonenumber-for-php/downloads?format=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
[![Downloads per month](https://img.shields.io/packagist/dm/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
[![Latest Stable Version](https://img.shields.io/packagist/v/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
[![License](http://img.shields.io/badge/license-Apache%202.0-red.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
@@ -14,9 +15,9 @@ A PHP library for parsing, formatting, storing and validating international phon
* `isNumberMatch` - gets a confidence level on whether two numbers could be the same.
* `getExampleNumber`/`getExampleNumberByType` - provides valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed.
* `isValidNumber` - full validation of a phone number for a region using length and prefix information.
* PhoneNumberOfflineGeocoder - provides geographical information related to a phone number.
* PhoneNumberToTimeZonesMapper - provides timezone information related to a phone number.
* PhoneNumberToCarrierMapper - provides carrier information related to a phone number.
* `PhoneNumberOfflineGeocoder` - provides geographical information related to a phone number.
* `PhoneNumberToTimeZonesMapper` - provides timezone information related to a phone number.
* `PhoneNumberToCarrierMapper` - provides carrier information related to a phone number.
## Installation
@@ -225,5 +226,7 @@ Other packages exist that integrate libphonenumber-for-php into frameworks.
- Symfony: [PhoneNumberBundle](https://github.com/misd-service-development/phone-number-bundle)
- Laravel: [Laravel Phone](https://github.com/Propaganistas/Laravel-Phone)
- Yii2: [PhoneInput](https://github.com/Borales/yii2-phone-input)
- Kohana: [PhoneNumber](https://github.com/softmediadev/kohana-phonenumber)
These packages are supplied by third parties, and their quality can not be guaranteed.

View File

@@ -0,0 +1,44 @@
<?php
namespace libphonenumber\Tests\Issues;
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
use libphonenumber\PhoneNumber;
class Issue106Test extends \PHPUnit_Framework_TestCase
{
private static $TW_Number1;
protected $geocoder;
public static function setUpBeforeClass()
{
self::$TW_Number1 = new PhoneNumber();
self::$TW_Number1->setCountryCode(886)->setNationalNumber(223113731);
}
public function setUp()
{
if(!extension_loaded('intl')) {
$this->markTestSkipped('The intl extension must be installed');
}
PhoneNumberOfflineGeocoder::resetInstance();
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
}
public function testGeocoderForZh()
{
$this->assertEquals("Taipei", $this->geocoder->getDescriptionForNumber(self::$TW_Number1, "en"));
$this->assertEquals(
pack('H*', 'e58fb0') . pack('H*', 'e58c97'),
$this->geocoder->getDescriptionForNumber(self::$TW_Number1, "zh_CN")
);
$this->assertEquals(
pack('H*', 'e887ba') . pack('H*', 'e58c97'),
$this->geocoder->getDescriptionForNumber(self::$TW_Number1, "zh_TW")
);
}
}

View File

@@ -51,6 +51,27 @@ class ExampleNumbersTest extends \PHPUnit_Framework_TestCase
return $returnList;
}
public function numberTypes()
{
return array(
array(PhoneNumberType::FIXED_LINE),
array(PhoneNumberType::MOBILE),
array(PhoneNumberType::FIXED_LINE_OR_MOBILE),
array(PhoneNumberType::TOLL_FREE),
array(PhoneNumberType::PREMIUM_RATE),
array(PhoneNumberType::SHARED_COST),
array(PhoneNumberType::VOIP),
array(PhoneNumberType::PERSONAL_NUMBER),
array(PhoneNumberType::PAGER),
array(PhoneNumberType::UAN),
array(PhoneNumberType::UNKNOWN),
array(PhoneNumberType::EMERGENCY),
array(PhoneNumberType::VOICEMAIL),
array(PhoneNumberType::SHORT_CODE),
array(PhoneNumberType::STANDARD_RATE),
);
}
/**
* @dataProvider regionList
*/
@@ -230,10 +251,10 @@ class ExampleNumbersTest extends \PHPUnit_Framework_TestCase
* @dataProvider regionList
* @param string $regionCode
*/
public function testEveryRegionHasExampleNumber($regionCode)
public function testEveryRegionHasAnExampleNumber($regionCode)
{
$exampleNumber = $this->phoneNumberUtil->getExampleNumber($regionCode);
$this->assertNotNull($exampleNumber, "None found for region " . $regionCode);
$this->assertNotNull($exampleNumber, "No example number found for region " . $regionCode);
/*
* Check the number is valid
@@ -249,6 +270,26 @@ class ExampleNumbersTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($this->phoneNumberUtil->isValidNumberForRegion($phoneObject, $regionCode));
}
/**
* @dataProvider regionList
* @param string $regionCode
*/
public function testEveryRegionHasAnInvalidExampleNumber($regionCode)
{
$exampleNumber = $this->phoneNumberUtil->getInvalidExampleNumber($regionCode);
$this->assertNotNull($exampleNumber, 'No invalid example number found for region ' . $regionCode);
}
/**
* @dataProvider numberTypes
* @param string $numberType
*/
public function testEveryTypeHasAnExampleNumber($numberType)
{
$exampleNumber = $this->phoneNumberUtil->getExampleNumberForType($numberType);
$this->assertNotNull($exampleNumber, 'No example number found for type ' . $numberType);
}
/**
* @dataProvider shortNumberRegionList
*/
@@ -268,7 +309,10 @@ class ExampleNumbersTest extends \PHPUnit_Framework_TestCase
if (!$this->shortNumberInfo->isValidShortNumber($phoneNumber)) {
$this->fail("Failed validation for " . (string)$phoneNumber);
}
}
public function shortRegionListAndNumberCost()
{
$costArray = array(
ShortNumberCost::PREMIUM_RATE,
ShortNumberCost::STANDARD_RATE,
@@ -276,16 +320,31 @@ class ExampleNumbersTest extends \PHPUnit_Framework_TestCase
ShortNumberCost::UNKNOWN_COST
);
foreach ($costArray as $cost) {
$exampleShortNumber = $this->shortNumberInfo->getExampleShortNumberForCost($regionCode, $cost);
if ($exampleShortNumber != '') {
$this->assertEquals(
$cost,
$this->shortNumberInfo->getExpectedCostForRegion($this->phoneNumberUtil->parse($exampleShortNumber, $regionCode), $regionCode),
"Wrong cost for " . (string)$phoneNumber
);
$output = array();
foreach ($this->shortNumberRegionList() as $region) {
foreach ($costArray as $cost) {
$output[] = array($region[0], $cost);
}
}
return $output;
}
/**
* @dataProvider shortRegionListAndNumberCost
* @param $regionCode
* @param $cost
*/
public function testShortNumberHasCorrectCost($regionCode, $cost)
{
$exampleShortNumber = $this->shortNumberInfo->getExampleShortNumberForCost($regionCode, $cost);
if ($exampleShortNumber != '') {
$phoneNumber = $this->phoneNumberUtil->parse($exampleShortNumber, $regionCode);
$exampleShortNumberCost = $this->shortNumberInfo->getExpectedCostForRegion($phoneNumber, $regionCode);
$this->assertEquals($cost, $exampleShortNumberCost, 'Wrong cost for ' . (string)$phoneNumber);
}
}
/**

View File

@@ -406,7 +406,7 @@ class ShortNumberInfoTest extends \PHPUnit_Framework_TestCase
);
$this->assertFalse($this->shortInfo->isEmergencyNumber("211", RegionCode::CA));
$this->assertEquals(
ShortNumberCost::UNKNOWN_COST,
ShortNumberCost::TOLL_FREE,
$this->shortInfo->getExpectedCostForRegion($this->parse("211", RegionCode::CA), RegionCode::CA)
);
}

View File

@@ -118,7 +118,7 @@
<target name="apply-data-patch">
<echo>Applying patch ${filename}</echo>
<resolvepath propertyName="fullpath" file="${absfilename}"/>
<patch patchfile="${fullpath}" dir="${git.path}/" strip="1" />
<patch patchfile="${fullpath}" dir="${git.path}/" strip="1" haltonfailure="true" />
</target>
<target name="build-test-metadata" description="Build test Phone Metadata" depends="git-pull">

View File

@@ -0,0 +1,54 @@
# PhoneNumberOfflineGeocoder
The Phone Number Geocoder requires the PHP [intl](http://php.net/intl) extension.
## Getting Started
As with [PhoneNumberUtil](PhoneNumberUtil.md), the Phone Number Geocoder uses a singleton.
```php
$geoCoder = \libphonenumber\geocoding\PhoneNumberOfflineGeocoder::getInstance();
```
## `getDescriptionForNumber()`
Returns a text description for the supplied `PhoneNumber` object, in the `$locale` language supplied.
The description returned might consist of the name of the country, or the name of the geographical area the phone number is from.
If `$userRegion` is supplied, it will also be taken into consideration. If the phone number is from the same region, only a lower-level description will be returned.
```php
$gbNumber = \libphonenumber\PhoneNumberUtil::getInstance()->parse('0161 496 0123', 'GB');
var_dump($geoCoder->getDescriptionForNumber($gbNumber, 'en'));
// string(10) "Manchester"
var_dump($geoCoder->getDescriptionForNumber($gbNumber, 'en_GB', 'GB'));
// string(10) "Manchester"
var_dump($geoCoder->getDescriptionForNumber($gbNumber, 'en_GB', 'US'));
// string(14) "United Kingdom"
var_dump($geoCoder->getDescriptionForNumber($gbNumber, 'ko-KR', 'US'));
// string(6) "영국" (Korean for United Kingdom)
$usNumber = \libphonenumber\PhoneNumberUtil::getInstance()->parse("+1 650 253 0000", "US");
var_dump($geoCoder->getDescriptionForNumber($usNumber, 'en'));
// string(10) "Mountain View, CA"
var_dump($geoCoder->getDescriptionForNumber($usNumber, 'en_GB', 'GB'));
// string(10) "United States"
var_dump($geoCoder->getDescriptionForNumber($usNumber, 'en_GB', 'US'));
// string(14) "Mountain View, CA"
var_dump($geoCoder->getDescriptionForNumber($usNumber, 'ko-KR', 'US'));
// string(6) "영국" (Korean for United States)
```
## `getDescriptionForValidNumber()`
Returns the same as `getDescriptionForNumber()`, but assumes that you have already checked whether the number is suitable for geolocation.

View File

@@ -0,0 +1,30 @@
# PhoneNumberToCarrierMapper
The Phone Number Carrier Mapper requires the PHP [intl](http://php.net/intl) extension.
## Getting Started
As with [PhoneNumberUtil](PhoneNumberUtil.md), the Phone Number Carrier Mapper uses a singleton.
```php
$carrierMapper = \libphonenumber\PhoneNumberToCarrierMapper::getInstance();
```
## `getNameForNumber()`
Returns the name of the carrier for the supplied `PhoneNumber` object within the `$language` supplied.
```php
$chNumber = \libphonenumber\PhoneNumberUtil::getInstance()->parse("798765432", "CH");
var_dump($carrierMapper->getNameForNumber($chNumber, 'en'));
// string(8) "Swisscom"
```
## `getNameForValidNumber()`
Returns the same as `getNameForNumber()` without checking whether it is a valid number for carrier mapping.
## `getSafeDisplayName()`
Returns the same as `getNameForNumber()`, but only if the number is safe for carrier mapping. A number is only validate for carrier mapping if it's a Mobile or Fixed line, and the country does not support Mobile Number Portability.

View File

@@ -0,0 +1,30 @@
# PhoneNumberToTimeZonesMapper
## Getting Started
As with [PhoneNumberUtil](PhoneNumberUtil.md), the Phone Number Timezone Mapper uses a singleton.
```php
$timezoneMapper = \libphonenumber\PhoneNumberToTimeZonesMapper::getInstance();
```
## `getTimeZonesForNumber()`
Returns an array of timezones for which the `PhoneNumber` object supplied belongs in.
```php
$usNumber = \libphonenumber\PhoneNumberUtil::getInstance()->parse("+1 650 253 0000", "US");
var_dump($timezoneMapper->getTimeZonesForNumber($usNumber));
// array(1) { [0]=> string(19) "America/Los_Angeles" }
/*
* A US Toll Free number is not geographically tied to any location, so could be in any US timezone
*/
$usNumber = \libphonenumber\PhoneNumberUtil::getInstance()->parse("+1 800 253 0000", "US");
var_dump($timezoneMapper->getTimeZonesForNumber($usNumber));
// array(35) { [0]=> string(16) "America/Anguilla" [1]=> string(15) "America/Antigua" [2]=> string(16) "America/Barbados" [3]=> string(14) "America/Cayman" [4]=> string(15) "America/Chicago" [5]=> string(14) "America/Denver" [6]=> string(16) "America/Dominica" [7]=> string(16) "America/Edmonton" [8]=> string(18) "America/Grand_Turk" [9]=> string(15) "America/Grenada" [10]=> string(15) "America/Halifax" [11]=> string(15) "America/Jamaica" [12]=> string(14) "America/Juneau" [13]=> string(19) "America/Los_Angeles" [14]=> string(21) "America/Lower_Princes" [15]=> string(18) "America/Montserrat" [16]=> string(14) "America/Nassau" [17]=> string(16) "America/New_York" [18]=> string(21) "America/Port_of_Spain" [19]=> string(19) "America/Puerto_Rico" [20]=> string(21) "America/Santo_Domingo" [21]=> string(16) "America/St_Johns" [22]=> string(16) "America/St_Kitts" [23]=> string(16) "America/St_Lucia" [24]=> string(17) "America/St_Thomas" [25]=> string(18) "America/St_Vincent" [26]=> string(15) "America/Toronto" [27]=> string(15) "America/Tortola" [28]=> string(17) "America/Vancouver" [29]=> string(16) "America/Winnipeg" [30]=> string(16) "Atlantic/Bermuda" [31]=> string(12) "Pacific/Guam" [32]=> string(16) "Pacific/Honolulu" [33]=> string(17) "Pacific/Pago_Pago" [34]=> string(14) "Pacific/Saipan" }
```

View File

@@ -6,7 +6,7 @@
Returns a `PhoneNumber` object version of the `$number` supplied with the `$region` code.
If the number is passed in an international format (e.g. `+44 117 496 123`), then the region code is not needed, and can be `null`. Failing that, the library will use the region code to work out the phone number based on rules loaded for that region.
If the number is passed in an international format (e.g. `+44 117 496 0123`), then the region code is not needed, and can be `null`. Failing that, the library will use the region code to work out the phone number based on rules loaded for that region.
```php
$phoneNumberUtil = \libphonenumber\PhoneNumberUtil::getInstance();
@@ -42,7 +42,7 @@ object(libphonenumber\PhoneNumber)#31 (9) {
}
```
A `PhoneNumberException` will be thrown if it is unable to obtain a viable number. For example, if the number is too short/long, or the region is invalid. This does not tell you whether the number is valid or not. In order to determine whether the number is valid, it needs to be checked in the validation functions.
A `NumberParseException` will be thrown if it is unable to obtain a viable number. For example, if the number is too short/long, or the region is invalid. This does not tell you whether the number is valid or not. In order to determine whether the number is valid, it needs to be checked in the validation functions.
The returned `PhoneNumber` object is used with other functions to provide additional information.
@@ -196,8 +196,27 @@ var_dump($phoneNumberUtil->getExampleNumber('GB'));
Returns an example `PhoneNumber` object for the `$regionCode` supplied of the `PhoneNumberType`.
This also accepts the first parameter being a `PhoneNumberType`, where it will return a valid number
for the specified number type from any country. Just leave the second parameter as null.
```php
var_dump($phoneNumberUtil->getExampleNumberForType('GB', PhoneNumberType::MOBILE));
// (PhoneNumber) Country Code: 44 National Number: 7400123456 ...
var_dump($phoneNumberUtil->getExampleNumberForType(PhoneNumberType::MOBILE));
// (PhoneNumber) Country Code: 1 National Number: 2015555555 ...
```
### `getInvalidExampleNumber()`
Returns an example invalid `PhoneNumber` object for the `$regionCode` supplied.
This can be useful for unit testing, where you want to test with an invalid number.
The number returned will be able to be parsed. It may also be a valid short number
for the region.
```php
var_dump($phoneNumberUtil->getInvalidExampleNumber('GB'));
// (PhoneNumber) Country Code: 44 National Number: 121234567 ...
```

View File

@@ -0,0 +1,172 @@
# ShortNumberInfo
## Getting Started
As with [PhoneNumberUtil](PhoneNumberUtil.md), ShortNumberInfo uses a singleton.
```php
$shortNumberUtil = \libphonenumber\ShortNumberInfo::getInstance();
```
## Example Numbers
### `getExampleShortNumber()`
Returns an example short phone number for the `$regionCode` supplied
```php
var_dump($shortNumberUtil->getExampleShortNumber('GB'));
// string(3) "150"
```
### `getExampleShortNumberForCost()`
Returns a valid short number for the specified `$regionCode` and `$cost` category.
```php
var_dump($shortNumberUtil->getExampleShortNumberForCost('GB', \libphonenumber\ShortNumberCost::TOLL_FREE));
// string(6) "116000"
var_dump($shortNumberUtil->getExampleShortNumberForCost('GB', \libphonenumber\ShortNumberCost::PREMIUM_RATE));
// string(0) ""
var_dump($shortNumberUtil->getExampleShortNumberForCost('US', \libphonenumber\ShortNumberCost::PREMIUM_RATE));
// string(5) "24280"
```
## Emergency Numbers
### `isEmergencyNumber()`
Returns whether the supplied `$number` exactly matches an emergency service number for the `$region`.
```php
var_dump($shortNumberUtil->isEmergencyNumber('999', 'GB'));
// bool(true)
var_dump($shortNumberUtil->isEmergencyNumber('9999', 'GB'));
// bool(false)
```
### `connectsToEmergencyNumber()`
Checks whether the `$number` (when dialled) might connect to an emergency service within the given `$region`.
```php
var_dump($shortNumberUtil->connectsToEmergencyNumber('999', 'GB'));
// bool(true)
// Note, 999 is a GB emergency service, but additional digits after the 999
// might be possible to dial.
var_dump($shortNumberUtil->connectsToEmergencyNumber('999123', 'GB'));
// bool(true)
```
## Short Number Validation
### `isPossibleShortNumber()`
Checks whether the specified `PhoneNumber` object is a possible short number.
```php
$phoneNumber = new \libphonenumber\PhoneNumber();
$phoneNumber->setCountryCode(44);
$phoneNumber->setNationalNumber(118118);
var_dump($shortNumberUtil->isPossibleShortNumber($phoneNumber));
// bool(true)
```
### `isPossibleShortNumberForRegion()`
Checks whether the supplied `$shortNumber` (which can either be a string or a `PhoneNumber` object) is possible for the `$region`.
```php
$phoneNumber = new \libphonenumber\PhoneNumber();
$phoneNumber->setCountryCode(44);
$phoneNumber->setNationalNumber(118118);
var_dump($shortNumberUtil->isPossibleShortNumberForRegion($phoneNumber, 'GB'));
// bool(true)
var_dump($shortNumberUtil->isPossibleShortNumberForRegion('1234', 'GB'));
// bool(true)
```
### `isValidShortNumber()`
Checks whether the specified `PhoneNumber` object is a valid short number.
**Important:** This doesn't actually validate whether the number is in use. libphonenumber-for-php is only able to validate number patterns, and isn't able to check with telecommunication providers.
```php
$phoneNumber = new \libphonenumber\PhoneNumber();
$phoneNumber->setCountryCode(44);
$phoneNumber->setNationalNumber(118118);
var_dump($shortNumberUtil->isValidShortNumber($phoneNumber));
// bool(true)
```
### `isValidShortNumberForRegion()`
Checks whether the supplied `$shortNumber` (which can either be a string or a `PhoneNumber` object) is valid for the `$region`.
**Important:** As with `isValidShortNumber()`, this can not validate whether the number is actually in use.
```php
$phoneNumber = new \libphonenumber\PhoneNumber();
$phoneNumber->setCountryCode(44);
$phoneNumber->setNationalNumber(118118);
var_dump($shortNumberUtil->isValidShortNumberForRegion($phoneNumber, 'GB'));
// bool(true)
var_dump($shortNumberUtil->isValidShortNumberForRegion('1234', 'GB'));
// bool(false)
```
### `isCarrierSpecific()`
Returns whether the supplied `PhoneNumber` is a carrier specific short number.
```php
$phoneNumber = new \libphonenumber\PhoneNumber();
$phoneNumber->setCountryCode(1);
$phoneNumber->setNationalNumber(611);
var_dump($shortNumberUtil->isCarrierSpecific($phoneNumber));
// (bool) true
```
## Expected Costs
### `getExpectedCost()`
Returns the expected cost (as a `ShortNumberCost` constant) of the supplied `PhoneNumber` short number.
```php
$phoneNumber = new \libphonenumber\PhoneNumber();
$phoneNumber->setCountryCode(44);
$phoneNumber->setNationalNumber(118118);
var_dump($shortNumberUtil->getExpectedCost($phoneNumber, 'GB'));
// int(10) (ShortNumberCost::UNKNOWN_COST)
```
### `getExpectedCostForRegion()`
Returns the expected cost (as a `ShortNumberCost` constant) of the supplied `$number` (which can be a string or a `PhoneNumber` object).
```php
$phoneNumber = new \libphonenumber\PhoneNumber();
$phoneNumber->setCountryCode(44);
$phoneNumber->setNationalNumber(118118);
var_dump($shortNumberUtil->getExpectedCostForRegion($phoneNumber, 'GB'));
// int(10) (ShortNumberCost::UNKNOWN_COST)
var_dump($shortNumberUtil->getExpectedCostForRegion('24280', 'US'));
// int(4) (ShortNumberCost::PREMIUM_RATE)
```

View File

@@ -7,8 +7,26 @@ namespace libphonenumber;
*/
class CountryCodeSource
{
/**
* The country_code is derived based on a phone number with a leading "+", e.g. the French
* number "+33 1 42 68 53 00".
*/
const FROM_NUMBER_WITH_PLUS_SIGN = 0;
/**
* The country_code is derived based on a phone number with a leading IDD, e.g. the French
* number "011 33 1 42 68 53 00", as it is dialled from US.
*/
const FROM_NUMBER_WITH_IDD = 1;
/**
* The country_code is derived based on a phone number without a leading "+", e.g. the French
* number "33 1 42 68 53 00" when defaultCountry is supplied as France.
*/
const FROM_NUMBER_WITHOUT_PLUS_SIGN = 2;
/**
* The country_code is derived NOT based on the phone number itself, but from the defaultCountry
* parameter provided in the parsing function by the clients. This happens mostly for numbers
* written in the national format (without country code). For example, this would be set when
* parsing the French number "01 42 68 53 00", when defaultCountry is supplied as France.
*/
const FROM_DEFAULT_COUNTRY = 3;
}

View File

@@ -14,17 +14,17 @@ class Matcher
/**
* @var string
*/
private $pattern;
protected $pattern;
/**
* @var string
*/
private $subject;
protected $subject;
/**
* @var array
*/
private $groups = array();
protected $groups = array();
/**
* @param string $pattern
@@ -36,7 +36,7 @@ class Matcher
$this->subject = $subject;
}
private function doMatch($type = 'find')
protected function doMatch($type = 'find')
{
$final_pattern = '(?:' . $this->pattern . ')';
switch ($type) {

View File

@@ -12,13 +12,13 @@ namespace libphonenumber;
class MultiFileMetadataSourceImpl implements MetadataSourceInterface
{
private static $metaDataFilePrefix = PhoneNumberUtil::META_DATA_FILE_PREFIX;
protected static $metaDataFilePrefix = PhoneNumberUtil::META_DATA_FILE_PREFIX;
/**
* A mapping from a region code to the PhoneMetadata for that region.
* @var PhoneMetadata[]
*/
private $regionToMetadataMap = array();
protected $regionToMetadataMap = array();
/**
* A mapping from a country calling code for a non-geographical entity to the PhoneMetadata for
@@ -26,20 +26,20 @@ class MultiFileMetadataSourceImpl implements MetadataSourceInterface
* Toll Free Service) and 808 (International Shared Cost Service).
* @var PhoneMetadata[]
*/
private $countryCodeToNonGeographicalMetadataMap = array();
protected $countryCodeToNonGeographicalMetadataMap = array();
/**
* The prefix of the metadata files from which region data is loaded.
* @var String
*/
private $currentFilePrefix;
protected $currentFilePrefix;
/**
* The metadata loader used to inject alternative metadata sources.
* @var MetadataLoaderInterface
*/
private $metadataLoader;
protected $metadataLoader;
/**
* @param MetadataLoaderInterface $metadataLoader
@@ -48,7 +48,7 @@ class MultiFileMetadataSourceImpl implements MetadataSourceInterface
public function __construct(MetadataLoaderInterface $metadataLoader, $currentFilePrefix = null)
{
if ($currentFilePrefix === null) {
$currentFilePrefix = self::$metaDataFilePrefix;
$currentFilePrefix = static::$metaDataFilePrefix;
}
$this->currentFilePrefix = $currentFilePrefix;

View File

@@ -7,11 +7,11 @@ namespace libphonenumber;
*/
class NumberFormat
{
private $pattern = null;
private $format = null;
private $leadingDigitsPattern = array();
private $nationalPrefixFormattingRule = null;
private $domesticCarrierCodeFormattingRule = null;
protected $pattern = null;
protected $format = null;
protected $leadingDigitsPattern = array();
protected $nationalPrefixFormattingRule = null;
protected $domesticCarrierCodeFormattingRule = null;
/**
* @return boolean

View File

@@ -24,7 +24,7 @@ class NumberParseException extends \Exception
// This indicates the string had more digits than any valid phone number could have.
const TOO_LONG = 4;
private $errorType;
protected $errorType;
public function __construct($errorType, $message, $previous = null)
{

View File

@@ -8,7 +8,7 @@ class PhoneMetadata
/**
* @var string
*/
private $id = null;
protected $id = null;
/**
* @return boolean
@@ -39,7 +39,7 @@ class PhoneMetadata
/**
* @var int
*/
private $countryCode = null;
protected $countryCode = null;
/**
* @return boolean
@@ -67,7 +67,7 @@ class PhoneMetadata
return $this;
}
private $leadingDigits = null;
protected $leadingDigits = null;
/**
* @return bool
@@ -88,7 +88,7 @@ class PhoneMetadata
return $this;
}
private $internationalPrefix = null;
protected $internationalPrefix = null;
public function hasInternationalPrefix()
{
@@ -106,7 +106,7 @@ class PhoneMetadata
return $this;
}
private $preferredInternationalPrefix = null;
protected $preferredInternationalPrefix = null;
public function hasPreferredInternationalPrefix()
{
@@ -124,7 +124,7 @@ class PhoneMetadata
return $this;
}
private $nationalPrefixForParsing = null;
protected $nationalPrefixForParsing = null;
public function hasNationalPrefixForParsing()
{
@@ -142,7 +142,7 @@ class PhoneMetadata
return $this;
}
private $nationalPrefixTransformRule = null;
protected $nationalPrefixTransformRule = null;
public function hasNationalPrefixTransformRule()
{
@@ -160,7 +160,7 @@ class PhoneMetadata
return $this;
}
private $nationalPrefix = null;
protected $nationalPrefix = null;
public function hasNationalPrefix()
{
@@ -178,7 +178,7 @@ class PhoneMetadata
return $this;
}
private $preferredExtnPrefix = null;
protected $preferredExtnPrefix = null;
public function hasPreferredExtnPrefix()
{
@@ -196,7 +196,7 @@ class PhoneMetadata
return $this;
}
private $mainCountryForCode = false;
protected $mainCountryForCode = false;
public function hasMainCountryForCode()
{
@@ -219,7 +219,7 @@ class PhoneMetadata
return $this;
}
private $leadingZeroPossible = false;
protected $leadingZeroPossible = false;
public function hasLeadingZeroPossible()
{
@@ -237,7 +237,7 @@ class PhoneMetadata
return $this;
}
private $mobileNumberPortableRegion = false;
protected $mobileNumberPortableRegion = false;
public function hasMobileNumberPortableRegion()
{
@@ -255,7 +255,7 @@ class PhoneMetadata
return $this;
}
private $generalDesc = null;
protected $generalDesc = null;
public function hasGeneralDesc()
{
@@ -279,7 +279,7 @@ class PhoneMetadata
/**
* @var PhoneNumberDesc
*/
private $mobile = null;
protected $mobile = null;
public function hasMobile()
{
@@ -300,7 +300,7 @@ class PhoneMetadata
return $this;
}
private $premiumRate = null;
protected $premiumRate = null;
public function hasPremiumRate()
{
@@ -321,7 +321,7 @@ class PhoneMetadata
return $this;
}
private $fixedLine = null;
protected $fixedLine = null;
public function hasFixedLine()
{
@@ -342,7 +342,7 @@ class PhoneMetadata
return $this;
}
private $sameMobileAndFixedLinePattern = false;
protected $sameMobileAndFixedLinePattern = false;
public function hasSameMobileAndFixedLinePattern()
{
@@ -360,7 +360,7 @@ class PhoneMetadata
return $this;
}
private $numberFormat = array();
protected $numberFormat = array();
/**
* @return NumberFormat[]
@@ -390,7 +390,7 @@ class PhoneMetadata
return $this;
}
private $tollFree = null;
protected $tollFree = null;
public function hasTollFree()
{
@@ -411,7 +411,7 @@ class PhoneMetadata
return $this;
}
private $sharedCost = null;
protected $sharedCost = null;
public function hasSharedCost()
{
@@ -432,7 +432,7 @@ class PhoneMetadata
return $this;
}
private $personalNumber;
protected $personalNumber;
public function hasPersonalNumber()
{
@@ -453,7 +453,7 @@ class PhoneMetadata
return $this;
}
private $voip;
protected $voip;
public function hasVoip()
{
@@ -474,7 +474,7 @@ class PhoneMetadata
return $this;
}
private $pager;
protected $pager;
public function hasPager()
{
@@ -495,7 +495,7 @@ class PhoneMetadata
return $this;
}
private $uan;
protected $uan;
public function hasUan()
{
@@ -516,7 +516,7 @@ class PhoneMetadata
return $this;
}
private $emergency;
protected $emergency;
public function hasEmergency()
{
@@ -537,7 +537,7 @@ class PhoneMetadata
return $this;
}
private $voicemail;
protected $voicemail;
public function hasVoicemail()
{
@@ -561,7 +561,7 @@ class PhoneMetadata
/**
* @var PhoneNumberDesc
*/
private $short_code;
protected $short_code;
public function hasShortCode()
{
@@ -582,7 +582,7 @@ class PhoneMetadata
/**
* @var PhoneNumberDesc
*/
private $standard_rate;
protected $standard_rate;
public function hasStandardRate()
{
@@ -603,7 +603,7 @@ class PhoneMetadata
/**
* @var PhoneNumberDesc
*/
private $carrierSpecific;
protected $carrierSpecific;
public function hasCarrierSpecific()
{
@@ -624,7 +624,7 @@ class PhoneMetadata
/**
* @var PhoneNumberDesc
*/
private $noInternationalDialling = null;
protected $noInternationalDialling = null;
public function hasNoInternationalDialling()
{
@@ -646,7 +646,7 @@ class PhoneMetadata
*
* @var NumberFormat[]
*/
private $intlNumberFormat = array();
protected $intlNumberFormat = array();
public function intlNumberFormats()
{

View File

@@ -5,423 +5,93 @@ namespace libphonenumber;
class PhoneNumber implements \Serializable
{
/**
* The country code.
* 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.
*
* @var int|null
*/
private $countryCode = null;
protected $countryCode = null;
/**
* Returns whether this phone number has a country code set.
* 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.
*
* @return bool True if a country code is set, false otherwise.
*/
public function hasCountryCode()
{
return isset($this->countryCode);
}
/**
* Returns the country code of this phone number.
*
* @return int|null The country code, or null if not set.
*/
public function getCountryCode()
{
return $this->countryCode;
}
/**
* Sets the country code of this phone number.
*
* @param int $value The country code.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setCountryCode($value)
{
$this->countryCode = (int) $value;
return $this;
}
/**
* Clears the country code of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearCountryCode()
{
$this->countryCode = null;
return $this;
}
/**
* The national number.
* Note that the National (significant) Number does not contain the National(trunk) prefix.
*
* @var string|null
*/
private $nationalNumber = null;
protected $nationalNumber = null;
/**
* Returns whether this phone number has a national number set.
*
* @return bool True if a national number is set, false otherwise.
*/
public function hasNationalNumber()
{
return isset($this->nationalNumber);
}
/**
* Returns the country code of this phone number.
*
* @return string|null The national number, or null if not set.
*/
public function getNationalNumber()
{
return $this->nationalNumber;
}
/**
* Sets the national number of this phone number.
*
* @param string $value The national number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setNationalNumber($value)
{
$this->nationalNumber = (string) $value;
return $this;
}
/**
* Clears the national number of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearNationalNumber()
{
$this->nationalNumber = null;
return $this;
}
/**
* The extension.
* 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.
*
* @var string|null
*/
private $extension = null;
protected $extension = null;
/**
* Returns whether this phone number has an extension set.
* 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.
*
* @return bool True if an extension is set, false otherwise.
*/
public function hasExtension()
{
return isset($this->extension);
}
/**
* Returns the extension of this phone number.
* 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.
*
* @return string|null The extension, or null if not set.
*/
public function getExtension()
{
return $this->extension;
}
/**
* Sets the extension of this phone number.
*
* @param string $value The extension.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setExtension($value)
{
$this->extension = (string) $value;
return $this;
}
/**
* Clears the extension of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearExtension()
{
$this->extension = null;
return $this;
}
/**
* Whether this phone number uses an italian leading zero.
* Clients who use the parsing functionality of the i18n phone number libraries
* will have these fields set if necessary automatically.
*
* @var bool|null
*/
private $italianLeadingZero = null;
protected $italianLeadingZero = null;
/**
* Returns whether this phone number has the italian leading zero information set.
*
* @return bool
*/
public function hasItalianLeadingZero()
{
return isset($this->italianLeadingZero);
}
/**
* Returns whether this phone number uses an italian leading zero.
*
* @return bool|null True if it uses an italian leading zero, false it it does not, null if not set.
*/
public function isItalianLeadingZero()
{
return $this->italianLeadingZero;
}
/**
* Sets whether this phone number uses an italian leading zero.
*
* @param bool $value True to use italian leading zero, false otherwise.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setItalianLeadingZero($value)
{
$this->italianLeadingZero = (bool) $value;
return $this;
}
/**
* Clears the italian leading zero information of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearItalianLeadingZero()
{
$this->italianLeadingZero = null;
return $this;
}
/**
* The raw input.
* 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".
*
* @var string|null
*/
private $rawInput = null;
protected $rawInput = null;
/**
* Returns whether this phone number has a raw input.
* 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.
*
* @return bool True if a raw input is set, false otherwise.
*/
public function hasRawInput()
{
return isset($this->rawInput);
}
/**
* Returns the raw input of this phone number.
*
* @return string|null The raw input, or null if not set.
*/
public function getRawInput()
{
return $this->rawInput;
}
/**
* Sets the raw input of this phone number.
*
* @param string $value The raw input.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setRawInput($value)
{
$this->rawInput = (string) $value;
return $this;
}
/**
* Clears the raw input of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearRawInput()
{
$this->rawInput = null;
return $this;
}
/**
* The country code source.
* @see CountryCodeSource
*
* This must be one of the CountryCodeSource constants.
*
* @var int|null
*/
private $countryCodeSource = null;
protected $countryCodeSource = null;
/**
* Returns whether this phone number has a country code source.
* 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.
*
* @return bool True if a country code source is set, false otherwise.
*/
public function hasCountryCodeSource()
{
return isset($this->countryCodeSource);
}
/**
* Returns the country code source of this phone number.
*
* @return int|null A CountryCodeSource constant, or null if not set.
*/
public function getCountryCodeSource()
{
return $this->countryCodeSource;
}
/**
* Sets the country code source of this phone number.
*
* @param int $value A CountryCodeSource constant.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setCountryCodeSource($value)
{
$this->countryCodeSource = (int) $value;
return $this;
}
/**
* Clears the country code source of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearCountryCodeSource()
{
$this->countryCodeSource = null;
return $this;
}
/**
* The preferred domestic carrier code.
* Note this is the "preferred" code, which means other codes may work as well.
*
* @var string|null
*/
private $preferredDomesticCarrierCode = null;
/**
* Returns whether this phone number has a preferred domestic carrier code.
*
* @return bool True if a preferred domestic carrier code is set, false otherwise.
*/
public function hasPreferredDomesticCarrierCode()
{
return isset($this->preferredDomesticCarrierCode);
}
/**
* Returns the preferred domestic carrier code of this phone number.
*
* @return string|null The preferred domestic carrier code, or null if not set.
*/
public function getPreferredDomesticCarrierCode()
{
return $this->preferredDomesticCarrierCode;
}
/**
* Sets the preferred domestic carrier code of this phone number.
*
* @param string $value The preferred domestic carrier code.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setPreferredDomesticCarrierCode($value)
{
$this->preferredDomesticCarrierCode = (string) $value;
return $this;
}
/**
* Clears the preferred domestic carrier code of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearPreferredDomesticCarrierCode()
{
$this->preferredDomesticCarrierCode = null;
return $this;
}
protected $preferredDomesticCarrierCode = null;
/**
* Whether this phone number has a number of leading zeros set.
*
* @var bool
*/
private $hasNumberOfLeadingZeros = false;
protected $hasNumberOfLeadingZeros = false;
/**
* The number of leading zeros of this phone number.
*
* @var int
*/
private $numberOfLeadingZeros = 1;
/**
* Returns whether this phone number has a number of leading zeros set.
*
* @return bool True if a number of leading zeros is set, false otherwise.
*/
public function hasNumberOfLeadingZeros()
{
return $this->hasNumberOfLeadingZeros;
}
/**
* Returns the number of leading zeros of this phone number.
*
* @return int The number of leading zeros.
*/
public function getNumberOfLeadingZeros()
{
return $this->numberOfLeadingZeros;
}
/**
* Sets the number of leading zeros of this phone number.
*
* @param int $value The number of leading zeros.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setNumberOfLeadingZeros($value)
{
$this->hasNumberOfLeadingZeros = true;
$this->numberOfLeadingZeros = (int) $value;
return $this;
}
/**
* Clears the number of leading zeros of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearNumberOfLeadingZeros()
{
$this->hasNumberOfLeadingZeros = false;
$this->numberOfLeadingZeros = 1;
return $this;
}
protected $numberOfLeadingZeros = 1;
/**
* Clears this phone number.
@@ -443,6 +113,95 @@ class PhoneNumber implements \Serializable
return $this;
}
/**
* Clears the country code of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearCountryCode()
{
$this->countryCode = null;
return $this;
}
/**
* Clears the national number of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearNationalNumber()
{
$this->nationalNumber = null;
return $this;
}
/**
* Clears the extension of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearExtension()
{
$this->extension = null;
return $this;
}
/**
* Clears the italian leading zero information of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearItalianLeadingZero()
{
$this->italianLeadingZero = null;
return $this;
}
/**
* Clears the number of leading zeros of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearNumberOfLeadingZeros()
{
$this->hasNumberOfLeadingZeros = false;
$this->numberOfLeadingZeros = 1;
return $this;
}
/**
* Clears the raw input of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearRawInput()
{
$this->rawInput = null;
return $this;
}
/**
* Clears the country code source of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearCountryCodeSource()
{
$this->countryCodeSource = null;
return $this;
}
/**
* Clears the preferred domestic carrier code of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearPreferredDomesticCarrierCode()
{
$this->preferredDomesticCarrierCode = null;
return $this;
}
/**
* Merges the information from another phone number into this phone number.
*
@@ -479,6 +238,271 @@ class PhoneNumber implements \Serializable
return $this;
}
/**
* Returns whether this phone number has a country code set.
*
* @return bool True if a country code is set, false otherwise.
*/
public function hasCountryCode()
{
return isset($this->countryCode);
}
/**
* Returns the country code of this phone number.
*
* @return int|null The country code, or null if not set.
*/
public function getCountryCode()
{
return $this->countryCode;
}
/**
* Sets the country code of this phone number.
*
* @param int $value The country code.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setCountryCode($value)
{
$this->countryCode = (int) $value;
return $this;
}
/**
* Returns whether this phone number has a national number set.
*
* @return bool True if a national number is set, false otherwise.
*/
public function hasNationalNumber()
{
return isset($this->nationalNumber);
}
/**
* Returns the country code of this phone number.
*
* @return string|null The national number, or null if not set.
*/
public function getNationalNumber()
{
return $this->nationalNumber;
}
/**
* Sets the national number of this phone number.
*
* @param string $value The national number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setNationalNumber($value)
{
$this->nationalNumber = (string) $value;
return $this;
}
/**
* Returns whether this phone number has an extension set.
*
* @return bool True if an extension is set, false otherwise.
*/
public function hasExtension()
{
return isset($this->extension);
}
/**
* Returns the extension of this phone number.
*
* @return string|null The extension, or null if not set.
*/
public function getExtension()
{
return $this->extension;
}
/**
* Sets the extension of this phone number.
*
* @param string $value The extension.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setExtension($value)
{
$this->extension = (string) $value;
return $this;
}
/**
* Returns whether this phone number has the italian leading zero information set.
*
* @return bool
*/
public function hasItalianLeadingZero()
{
return isset($this->italianLeadingZero);
}
/**
* Sets whether this phone number uses an italian leading zero.
*
* @param bool $value True to use italian leading zero, false otherwise.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setItalianLeadingZero($value)
{
$this->italianLeadingZero = (bool) $value;
return $this;
}
/**
* Returns whether this phone number uses an italian leading zero.
*
* @return bool|null True if it uses an italian leading zero, false it it does not, null if not set.
*/
public function isItalianLeadingZero()
{
return $this->italianLeadingZero;
}
/**
* Returns whether this phone number has a number of leading zeros set.
*
* @return bool True if a number of leading zeros is set, false otherwise.
*/
public function hasNumberOfLeadingZeros()
{
return $this->hasNumberOfLeadingZeros;
}
/**
* Returns the number of leading zeros of this phone number.
*
* @return int The number of leading zeros.
*/
public function getNumberOfLeadingZeros()
{
return $this->numberOfLeadingZeros;
}
/**
* Sets the number of leading zeros of this phone number.
*
* @param int $value The number of leading zeros.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setNumberOfLeadingZeros($value)
{
$this->hasNumberOfLeadingZeros = true;
$this->numberOfLeadingZeros = (int) $value;
return $this;
}
/**
* Returns whether this phone number has a raw input.
*
* @return bool True if a raw input is set, false otherwise.
*/
public function hasRawInput()
{
return isset($this->rawInput);
}
/**
* Returns the raw input of this phone number.
*
* @return string|null The raw input, or null if not set.
*/
public function getRawInput()
{
return $this->rawInput;
}
/**
* Sets the raw input of this phone number.
*
* @param string $value The raw input.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setRawInput($value)
{
$this->rawInput = (string) $value;
return $this;
}
/**
* Returns whether this phone number has a country code source.
*
* @return bool True if a country code source is set, false otherwise.
*/
public function hasCountryCodeSource()
{
return isset($this->countryCodeSource);
}
/**
* Returns the country code source of this phone number.
*
* @return int|null A CountryCodeSource constant, or null if not set.
*/
public function getCountryCodeSource()
{
return $this->countryCodeSource;
}
/**
* Sets the country code source of this phone number.
*
* @param int $value A CountryCodeSource constant.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setCountryCodeSource($value)
{
$this->countryCodeSource = (int) $value;
return $this;
}
/**
* Returns whether this phone number has a preferred domestic carrier code.
*
* @return bool True if a preferred domestic carrier code is set, false otherwise.
*/
public function hasPreferredDomesticCarrierCode()
{
return isset($this->preferredDomesticCarrierCode);
}
/**
* Returns the preferred domestic carrier code of this phone number.
*
* @return string|null The preferred domestic carrier code, or null if not set.
*/
public function getPreferredDomesticCarrierCode()
{
return $this->preferredDomesticCarrierCode;
}
/**
* Sets the preferred domestic carrier code of this phone number.
*
* @param string $value The preferred domestic carrier code.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setPreferredDomesticCarrierCode($value)
{
$this->preferredDomesticCarrierCode = (string) $value;
return $this;
}
/**
* Returns whether this phone number is equal to another.
*
@@ -527,7 +551,7 @@ class PhoneNumber implements \Serializable
if ($this->hasExtension()) {
$outputString .= ' Extension: ' . $this->extension;
}
if ($this->hasCountryCode()) {
if ($this->hasCountryCodeSource()) {
$outputString .= ' Country Code Source: ' . $this->countryCodeSource;
}
if ($this->hasPreferredDomesticCarrierCode()) {

View File

@@ -7,12 +7,12 @@ namespace libphonenumber;
*/
class PhoneNumberDesc
{
private $hasNationalNumberPattern = false;
private $nationalNumberPattern = "";
private $hasPossibleNumberPattern = false;
private $possibleNumberPattern = "";
private $hasExampleNumber = false;
private $exampleNumber = "";
protected $hasNationalNumberPattern = false;
protected $nationalNumberPattern = "";
protected $hasPossibleNumberPattern = false;
protected $possibleNumberPattern = "";
protected $hasExampleNumber = false;
protected $exampleNumber = "";
/**
* @return boolean

View File

@@ -17,20 +17,20 @@ class PhoneNumberToCarrierMapper
/**
* @var PhoneNumberToCarrierMapper[]
*/
private static $instance = array();
protected static $instance = array();
const MAPPING_DATA_DIRECTORY = '/carrier/data/';
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
protected $phoneUtil;
/**
* @var PrefixFileReader
*/
private $prefixFileReader;
protected $prefixFileReader;
private function __construct($phonePrefixDataDirectory)
protected function __construct($phonePrefixDataDirectory)
{
if(!extension_loaded('intl')) {
throw new \RuntimeException('The intl extension must be installed');
@@ -51,11 +51,11 @@ class PhoneNumberToCarrierMapper
*/
public static function getInstance($mappingDir = self::MAPPING_DATA_DIRECTORY)
{
if (!array_key_exists($mappingDir, self::$instance)) {
self::$instance[$mappingDir] = new self($mappingDir);
if (!array_key_exists($mappingDir, static::$instance)) {
static::$instance[$mappingDir] = new static($mappingDir);
}
return self::$instance[$mappingDir];
return static::$instance[$mappingDir];
}
/**
@@ -125,7 +125,7 @@ class PhoneNumberToCarrierMapper
* @param int $numberType A PhoneNumberType int
* @return bool
*/
private function isMobile($numberType)
protected function isMobile($numberType)
{
return ($numberType === PhoneNumberType::MOBILE ||
$numberType === PhoneNumberType::FIXED_LINE_OR_MOBILE ||

View File

@@ -18,25 +18,25 @@ class PhoneNumberToTimeZonesMapper
/**
* @var PhoneNumberToTimeZonesMapper
*/
private static $instance = null;
private $unknownTimeZoneList = array();
protected static $instance = null;
protected $unknownTimeZoneList = array();
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
private $prefixTimeZonesMap;
protected $phoneUtil;
protected $prefixTimeZonesMap;
private function __construct($phonePrefixDataDirectory)
protected function __construct($phonePrefixDataDirectory)
{
$this->prefixTimeZonesMap = self::loadPrefixTimeZonesMapFromFile(
dirname(__FILE__) . $phonePrefixDataDirectory . DIRECTORY_SEPARATOR . self::MAPPING_DATA_FILE_NAME
$this->prefixTimeZonesMap = static::loadPrefixTimeZonesMapFromFile(
dirname(__FILE__) . $phonePrefixDataDirectory . DIRECTORY_SEPARATOR . static::MAPPING_DATA_FILE_NAME
);
$this->phoneUtil = PhoneNumberUtil::getInstance();
$this->unknownTimeZoneList[] = self::UNKNOWN_TIMEZONE;
$this->unknownTimeZoneList[] = static::UNKNOWN_TIMEZONE;
}
private static function loadPrefixTimeZonesMapFromFile($path)
protected static function loadPrefixTimeZonesMapFromFile($path)
{
if (!is_readable($path)) {
throw new \InvalidArgumentException("Mapping file can not be found");
@@ -60,11 +60,11 @@ class PhoneNumberToTimeZonesMapper
*/
public static function getInstance($mappingDir = self::MAPPING_DATA_DIRECTORY)
{
if (self::$instance === null) {
self::$instance = new self($mappingDir);
if (static::$instance === null) {
static::$instance = new static($mappingDir);
}
return self::$instance;
return static::$instance;
}
/**
@@ -73,7 +73,7 @@ class PhoneNumberToTimeZonesMapper
*/
public static function getUnknownTimeZone()
{
return self::UNKNOWN_TIMEZONE;
return static::UNKNOWN_TIMEZONE;
}
/**
@@ -121,7 +121,7 @@ class PhoneNumberToTimeZonesMapper
* @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
*/
private function getCountryLevelTimeZonesforNumber(PhoneNumber $number)
protected function getCountryLevelTimeZonesforNumber(PhoneNumber $number)
{
$timezones = $this->prefixTimeZonesMap->lookupCountryLevelTimeZonesForNumber($number);
return (count($timezones) == 0) ? $this->unknownTimeZoneList : $timezones;
@@ -150,7 +150,7 @@ class PhoneNumberToTimeZonesMapper
* @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
*/
private function getTimeZonesForGeocodableNumber(PhoneNumber $number)
protected function getTimeZonesForGeocodableNumber(PhoneNumber $number)
{
$timezones = $this->prefixTimeZonesMap->lookupTimeZonesForNumber($number);
return (count($timezones) == 0) ? $this->unknownTimeZoneList : $timezones;

View File

@@ -18,29 +18,29 @@ class ShortNumberInfo
/**
* @var ShortNumberInfo
*/
private static $instance = null;
protected static $instance = null;
/**
* @var MatcherAPIInterface
*/
private $matcherAPI;
private $currentFilePrefix;
private $regionToMetadataMap = array();
private $countryCallingCodeToRegionCodeMap = array();
private $countryCodeToNonGeographicalMetadataMap = array();
private static $regionsWhereEmergencyNumbersMustBeExact = array(
protected $matcherAPI;
protected $currentFilePrefix;
protected $regionToMetadataMap = array();
protected $countryCallingCodeToRegionCodeMap = array();
protected $countryCodeToNonGeographicalMetadataMap = array();
protected static $regionsWhereEmergencyNumbersMustBeExact = array(
'BR',
'CL',
'NI',
);
private function __construct(MatcherAPIInterface $matcherAPI)
protected function __construct(MatcherAPIInterface $matcherAPI)
{
$this->matcherAPI = $matcherAPI;
// TODO: Create ShortNumberInfo for a given map
$this->countryCallingCodeToRegionCodeMap = CountryCodeToRegionCodeMap::$countryCodeToRegionCodeMap;
$this->currentFilePrefix = dirname(__FILE__) . '/data/' . self::META_DATA_FILE_PREFIX;
$this->currentFilePrefix = dirname(__FILE__) . '/data/' . static::META_DATA_FILE_PREFIX;
// Initialise PhoneNumberUtil to make sure regex's are setup correctly
PhoneNumberUtil::getInstance();
@@ -53,16 +53,16 @@ class ShortNumberInfo
*/
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self(RegexBasedMatcher::create());
if (null === static::$instance) {
static::$instance = new self(RegexBasedMatcher::create());
}
return self::$instance;
return static::$instance;
}
public static function resetInstance()
{
self::$instance = null;
static::$instance = null;
}
/**
@@ -73,7 +73,7 @@ class ShortNumberInfo
* @param int $countryCallingCode
* @return array
*/
private function getRegionCodesForCountryCode($countryCallingCode)
protected function getRegionCodesForCountryCode($countryCallingCode)
{
if (!array_key_exists($countryCallingCode, $this->countryCallingCodeToRegionCodeMap)) {
$regionCodes = null;
@@ -91,7 +91,7 @@ class ShortNumberInfo
* @param string $regionDialingFrom
* @return bool
*/
private function regionDialingFromMatchesNumber(PhoneNumber $number, $regionDialingFrom)
protected function regionDialingFromMatchesNumber(PhoneNumber $number, $regionDialingFrom)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
@@ -144,7 +144,7 @@ class ShortNumberInfo
return isset($this->regionToMetadataMap[$regionCode]) ? $this->regionToMetadataMap[$regionCode] : null;
}
private function loadMetadataFromFile($filePrefix, $regionCode, $countryCallingCode)
protected function loadMetadataFromFile($filePrefix, $regionCode, $countryCallingCode)
{
$isNonGeoRegion = PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY === $regionCode;
$fileName = $filePrefix . '_' . ($isNonGeoRegion ? $countryCallingCode : $regionCode) . '.php';
@@ -226,7 +226,7 @@ class ShortNumberInfo
* @param bool $allowPrefixMatch
* @return bool
*/
private function matchesEmergencyNumberHelper($number, $regionCode, $allowPrefixMatch)
protected function matchesEmergencyNumberHelper($number, $regionCode, $allowPrefixMatch)
{
$number = PhoneNumberUtil::extractPossibleNumber($number);
$matcher = new Matcher(PhoneNumberUtil::$PLUS_CHARS_PATTERN, $number);
@@ -246,7 +246,7 @@ class ShortNumberInfo
$emergencyDesc = $metadata->getEmergency();
$allowPrefixMatchForRegion = ($allowPrefixMatch
&& !in_array($regionCode, self::$regionsWhereEmergencyNumbersMustBeExact)
&& !in_array($regionCode, static::$regionsWhereEmergencyNumbersMustBeExact)
);
return $this->matcherAPI->matchesNationalNumber($normalizedNumber, $emergencyDesc, $allowPrefixMatchForRegion);
@@ -284,7 +284,7 @@ class ShortNumberInfo
* @param $regionCodes
* @return String|null Region Code (or null if none are found)
*/
private function getRegionCodeForShortNumberFromRegionList(PhoneNumber $number, $regionCodes)
protected function getRegionCodeForShortNumberFromRegionList(PhoneNumber $number, $regionCodes)
{
if (count($regionCodes) == 0) {
return null;
@@ -597,7 +597,7 @@ class ShortNumberInfo
* @param PhoneNumber $number the phone number for which the national significant number is needed
* @return string the national significant number of the PhoneNumber object passed in
*/
private function getNationalSignificantNumber(PhoneNumber $number)
protected function getNationalSignificantNumber(PhoneNumber $number)
{
// If leading zero(s) have been set, we prefix this now. Note this is not a national prefix.
$nationalNumber = '';
@@ -618,7 +618,7 @@ class ShortNumberInfo
* @param PhoneNumberDesc $numberDesc
* @return bool
*/
private function matchesPossibleNumberAndNationalNumber($number, PhoneNumberDesc $numberDesc)
protected function matchesPossibleNumberAndNationalNumber($number, PhoneNumberDesc $numberDesc)
{
return ($this->matcherAPI->matchesPossibleNumber($number, $numberDesc)
&& $this->matcherAPI->matchesNationalNumber($number, $numberDesc, false));

View File

@@ -20,7 +20,7 @@ class ShortNumberUtil
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
protected $phoneUtil;
public function __construct(PhoneNumberUtil $phoneNumberUtil = null)
{

View File

@@ -172,52 +172,61 @@ return array (
154 => 86137,
155 => 86138,
156 => 86139,
157 => 86150,
158 => 86151,
159 => 86153,
160 => 86156,
161 => 86157,
162 => 86158,
163 => 86159,
164 => 86176,
165 => 86177,
166 => 86178,
167 => 86180,
168 => 86185,
169 => 86186,
170 => 86187,
171 => 86188,
172 => 86189,
173 => 880,
174 => 90,
175 => 91,
176 => 92,
177 => 93,
178 => 94,
179 => 95,
180 => 960,
181 => 961,
182 => 962,
183 => 964,
184 => 965,
185 => 966,
186 => 967,
187 => 968,
188 => 970,
189 => 971,
190 => 972,
191 => 973,
192 => 974,
193 => 975,
194 => 976,
195 => 977,
196 => 98,
197 => 992,
198 => 993,
199 => 994,
200 => 995,
201 => 996,
202 => 998,
157 => 86145,
158 => 86147,
159 => 86150,
160 => 86151,
161 => 86152,
162 => 86153,
163 => 86155,
164 => 86156,
165 => 86157,
166 => 86158,
167 => 86159,
168 => 86173,
169 => 86176,
170 => 86177,
171 => 86178,
172 => 86180,
173 => 86181,
174 => 86182,
175 => 86183,
176 => 86184,
177 => 86185,
178 => 86186,
179 => 86187,
180 => 86188,
181 => 86189,
182 => 880,
183 => 90,
184 => 91,
185 => 92,
186 => 93,
187 => 94,
188 => 95,
189 => 960,
190 => 961,
191 => 962,
192 => 964,
193 => 965,
194 => 966,
195 => 967,
196 => 968,
197 => 970,
198 => 971,
199 => 972,
200 => 973,
201 => 974,
202 => 975,
203 => 976,
204 => 977,
205 => 98,
206 => 992,
207 => 993,
208 => 994,
209 => 995,
210 => 996,
211 => 998,
),
'ru' =>
array (

View File

@@ -5,6 +5,7 @@
*/
return array (
1671747 => 'PTI PACIFICA',
1671838 => 'i CAN_GSM',
1671848 => 'i CAN_GSM',
1671858 => 'i CAN_GSM',

View File

@@ -5,5 +5,21 @@
*/
return array (
2232079 => 'Sotelma',
22321 => 'Sotelma',
2236 => 'Sotelma',
2237 => 'Orange',
22382 => 'Orange',
22383 => 'Orange',
22389 => 'Sotelma',
22390 => 'Orange',
22391 => 'Orange',
22392 => 'Orange',
22393 => 'Orange',
22394 => 'Orange',
22395 => 'Sotelma',
22396 => 'Sotelma',
22397 => 'Sotelma',
22398 => 'Sotelma',
22399 => 'Sotelma',
);

View File

@@ -24,6 +24,7 @@ return array (
22547 => 'Orange',
22548 => 'Orange',
22549 => 'Orange',
22551 => 'Moov',
22554 => 'MTN',
22555 => 'MTN',
22556 => 'MTN',

View File

@@ -6,7 +6,10 @@
return array (
22961 => 'MTN',
22962 => 'MTN',
22963 => 'Moov',
22964 => 'Moov',
22965 => 'Moov',
22966 => 'MTN',
22967 => 'MTN',
22968 => 'Glo',

View File

@@ -10,5 +10,5 @@ return array (
25193 => 'Ethio Telecom',
25194 => 'Ethio Telecom',
25195 => 'Ethio Telecom',
251966 => 'Ethio Telecom',
25196 => 'Ethio Telecom',
);

View File

@@ -15,6 +15,7 @@ return array (
25268 => 'Nationlink',
25269 => 'Nationlink',
25279 => 'Somtel',
252906 => 'Golis Telecom',
252907 => 'Golis Telecom',
25292 => 'STG',
25293 => 'STG',

View File

@@ -9,20 +9,31 @@ return array (
25471 => 'Safaricom',
25472 => 'Safaricom',
25473 => 'Airtel',
25476 => 'Airtel',
254750 => 'Essar',
254751 => 'Essar',
254752 => 'Essar',
254753 => 'Essar',
254754 => 'Essar',
254755 => 'Essar',
254756 => 'Essar',
254750 => 'Airtel',
254751 => 'Airtel',
254752 => 'Airtel',
254753 => 'Airtel',
254754 => 'Airtel',
254755 => 'Airtel',
254756 => 'Airtel',
254760 => 'Mobile Pay',
254761 => 'Airtel',
254762 => 'Airtel',
254763 => 'Finserve',
254764 => 'Finserve',
254765 => 'Airtel',
254766 => 'Airtel',
254767 => 'Zioncell',
254768 => 'Airtel',
254769 => 'Airtel',
254770 => 'Telkom',
254771 => 'Telkom',
254772 => 'Telkom',
254773 => 'Telkom',
254774 => 'Telkom',
254775 => 'Telkom',
254776 => 'Telkom',
254777 => 'Telkom',
254780 => 'Airtel',
254781 => 'Airtel',
254782 => 'Airtel',
@@ -34,4 +45,9 @@ return array (
254790 => 'Safaricom',
254791 => 'Safaricom',
254792 => 'Safaricom',
254793 => 'Safaricom',
254794 => 'Safaricom',
254795 => 'Safaricom',
254796 => 'Safaricom',
254797 => 'Safaricom',
);

View File

@@ -45,6 +45,7 @@ return array (
61433 => 'Vodafone',
61434 => 'Optus',
61435 => 'Optus',
61436 => 'Telstra',
61437 => 'Telstra',
61438 => 'Telstra',
61439 => 'Telstra',

View File

@@ -21,6 +21,7 @@ return array (
67786 => 'BMobile',
67787 => 'BMobile',
67788 => 'BMobile',
67789 => 'BMobile',
67791 => 'Satsol',
67792 => 'Satsol',
677930 => 'Satsol',

View File

@@ -12,6 +12,9 @@ return array (
84129 => 'Vinaphone',
84162 => 'Viettel Mobile',
84199 => 'G-Mobile',
84868 => 'Viettel Mobile',
84888 => 'Vinaphone',
84898 => 'MobiFone',
8490 => 'MobiFone',
8491 => 'Vinaphone',
8494 => 'Vinaphone',

View File

@@ -302,6 +302,16 @@ return array (
8536812 => 'CTM',
8536813 => 'CTM',
8536814 => 'CTM',
8536815 => 'SmarTone',
8536816 => 'SmarTone',
8536817 => 'SmarTone',
8536818 => 'SmarTone',
8536819 => 'SmarTone',
8536850 => '3',
8536851 => '3',
8536852 => '3',
8536853 => '3',
8536854 => '3',
8536880 => 'CTM',
8536881 => 'CTM',
8536882 => 'CTM',

View File

@@ -9,6 +9,7 @@ return array (
85512 => 'Cellcard',
85514 => 'Cellcard',
85517 => 'Cellcard',
85518 => 'Seatel',
85560 => 'Beeline',
85566 => 'Beeline',
85567 => 'Beeline',

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86145 => 'China Unicom',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86147 => 'China Mobile',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86152 => 'China Mobile',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86155 => 'China Unicom',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86173 => 'China Telecom',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86181 => 'China Telecom',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86182 => 'China Mobile',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86183 => 'China Mobile',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
86184 => 'China Mobile',
);

View File

@@ -211,7 +211,72 @@ return array (
917308 => 'Reliance',
917309 => 'Idea',
917310 => 'Vodafone',
9173175 => 'Airtel',
9173176 => 'Airtel',
9173177 => 'Airtel',
9173178 => 'Airtel',
917318 => 'Airtel',
917319 => 'Airtel',
9173200 => 'Airtel',
9173208 => 'Airtel',
9173209 => 'Airtel',
9173210 => 'Airtel',
9173218 => 'Airtel',
9173219 => 'Airtel',
9173258 => 'Airtel',
9173259 => 'Airtel',
9173260 => 'Airtel',
9173268 => 'Airtel',
9173269 => 'Airtel',
9173270 => 'Airtel',
9173278 => 'Airtel',
9173279 => 'Airtel',
9173280 => 'Airtel',
9173288 => 'Airtel',
9173376 => 'Airtel',
9173377 => 'Airtel',
9173378 => 'Airtel',
917338 => 'Airtel',
9173390 => 'Airtel',
9173391 => 'Airtel',
9173392 => 'Airtel',
9173393 => 'Airtel',
9173394 => 'Airtel',
9173395 => 'Airtel',
9173396 => 'Airtel',
9173397 => 'Airtel',
9173398 => 'Airtel',
9173399 => 'Airtel',
917340 => 'Airtel',
9173411 => 'Airtel',
9173470 => 'Airtel',
9173472 => 'Airtel',
9173473 => 'Airtel',
9173474 => 'Airtel',
9173475 => 'Airtel',
9173476 => 'Airtel',
9173477 => 'Idea',
9173478 => 'Idea',
9173480 => 'Idea',
9173481 => 'Idea',
9173482 => 'Idea',
9173483 => 'Idea',
9173484 => 'Idea',
9173485 => 'Idea',
9173486 => 'Idea',
9173487 => 'Idea',
9173488 => 'Airtel',
9173489 => 'Airtel',
9173490 => 'Airtel',
9173491 => 'Airtel',
9173492 => 'Airtel',
9173493 => 'Airtel',
9173494 => 'Airtel',
9173495 => 'Airtel',
9173496 => 'Airtel',
9173497 => 'Airtel',
9173498 => 'Vodafone',
9173499 => 'Vodafone',
917350 => 'Idea',
917351 => 'Idea',
917352 => 'Idea',
@@ -222,21 +287,87 @@ return array (
917357 => 'Videocon',
917358 => 'Airtel',
917359 => 'Idea',
9173600 => 'Vodafone',
9173608 => 'Vodafone',
9173609 => 'Vodafone',
9173610 => 'Vodafone',
9173618 => 'Vodafone',
9173619 => 'Vodafone',
9173620 => 'Vodafone',
9173628 => 'Vodafone',
9173629 => 'Airtel',
9173630 => 'Airtel',
9173638 => 'Airtel',
9173639 => 'Airtel',
9173640 => 'Airtel',
9173648 => 'Airtel',
9173649 => 'Airtel',
9173650 => 'Airtel',
9173658 => 'Airtel',
9173659 => 'Airtel',
9173660 => 'Airtel',
9173668 => 'Airtel',
9173669 => 'Airtel',
9173670 => 'Airtel',
9173678 => 'Airtel',
9173679 => 'Airtel',
9173680 => 'Airtel',
9173688 => 'Airtel',
9173689 => 'Airtel',
9173690 => 'Airtel',
9173698 => 'Idea',
9173699 => 'Idea',
9173700 => 'Idea',
9173708 => 'Idea',
9173709 => 'Idea',
9173710 => 'Idea',
9173718 => 'Idea',
9173719 => 'Idea',
9173720 => 'Idea',
9173728 => 'Idea',
9173729 => 'Idea',
917373 => 'Aircel',
9173740 => 'Idea',
9173748 => 'Idea',
9173749 => 'Idea',
9173750 => 'Idea',
9173758 => 'Idea',
9173759 => 'Idea',
917376 => 'Cellone',
917377 => 'Idea',
9173780 => 'Idea',
9173781 => 'Idea',
9173782 => 'Idea',
9173783 => 'Vodafone',
9173784 => 'Vodafone',
9173785 => 'Vodafone',
9173786 => 'Vodafone',
9173787 => 'Vodafone',
9173788 => 'Vodafone',
9173789 => 'Vodafone',
917379 => 'Vodafone',
917380 => 'CellOne',
9173810 => 'Vodafone',
9173803 => 'Airtel',
9173804 => 'Airtel',
9173805 => 'Airtel',
9173806 => 'Airtel',
9173807 => 'Airtel',
9173808 => 'Airtel',
9173809 => 'Airtel',
917381 => 'Vodafone',
917382 => 'CellOne',
917383 => 'Telewings',
917384 => 'Airtel',
917385 => 'Telewings',
917386 => 'Telewings',
917387 => 'AirTel',
917388 => 'AirTel',
917389 => 'AirTel',
917387 => 'Airtel',
917388 => 'Airtel',
917389 => 'Airtel',
9173900 => 'Airtel',
9173908 => 'Airtel',
9173909 => 'Airtel',
9173910 => 'Vodafone',
9173918 => 'Vodafone',
9173919 => 'Vodafone',
917396 => 'Telewings',
917398 => 'Telewings',
917399 => 'Dishnet',
@@ -250,6 +381,8 @@ return array (
917408 => 'Vodafone',
917409 => 'Vodafone',
917411 => 'Tata Docomo',
9174140 => 'Vodafone',
9174148 => 'Vodafone',
917415 => 'Tata Docomo',
917416 => 'Tata Docomo',
917417 => 'Tata Docomo',
@@ -630,6 +763,12 @@ return array (
917897 => 'AirTel',
917898 => 'AirTel',
917899 => 'Airtel',
917994 => 'Airtel',
917995 => 'Airtel',
917996 => 'Idea',
917997 => 'Idea',
917998 => 'Dishnet',
917999 => 'Videocon',
9180000 => 'Reliance',
918000 => 'Reliance',
9180010 => 'Vodafone',
@@ -931,7 +1070,7 @@ return array (
918267 => 'Tata Docomo',
918268 => 'Aircel',
918269 => 'Videocon',
918270 => 'UNITECH',
918270 => 'Vodafone',
918271 => 'Telewings',
918272 => 'Tata Docomo',
918273 => 'Telewings',
@@ -1678,7 +1817,7 @@ return array (
919104 => 'Telewings',
919105 => 'Loop Mobile',
919106 => 'Tata Docomo',
919107 => 'Loop Mobile',
919107 => 'Dishnet',
919108 => 'Airtel',
919109 => 'Loop Mobile',
919110 => 'Loop Mobile',
@@ -1776,7 +1915,7 @@ return array (
919202 => 'Tata Docomo',
919203 => 'Tata Docomo',
919204 => 'Tata Docomo',
919205 => 'Tata Docomo',
919205 => 'Airtel',
919206 => 'Tata Docomo',
919207 => 'Tata Docomo',
919208 => 'Tata Docomo',

View File

@@ -5,7 +5,17 @@
*/
return array (
96890 => 'Omantel/Ooredoo',
96871 => 'Omantel',
96879 => 'Ooredoo',
968901 => 'Omantel',
968902 => 'Omantel',
968903 => 'Omantel',
968904 => 'Omantel',
968905 => 'Omantel',
968906 => 'Omantel',
968907 => 'Omantel',
968908 => 'Omantel',
968909 => 'Omantel',
96891 => 'Omantel',
96892 => 'Omantel',
96893 => 'Omantel',

View File

@@ -7,6 +7,7 @@
return array (
97150 => 'Etisalat',
97152 => 'du',
97154 => 'Etisalat',
97155 => 'du',
97156 => 'Etisalat',
);

View File

@@ -21,6 +21,8 @@ return array (
9725587 => 'Alon',
9725588 => 'Alon',
9725589 => 'Alon',
9725594 => 'Telzar',
9725595 => 'Telzar',
9725596 => 'Telzar',
9725597 => 'Telzar',
9725598 => 'Telzar',

View File

@@ -5,8 +5,11 @@
*/
return array (
992411 => 'Megafon',
992418 => 'Megafon',
992501 => 'Tcell',
992502 => 'Tcell',
99288 => 'Megafon',
99290 => 'Megafon',
992917 => 'Tacom',
992918 => 'Babilon-M',

View File

@@ -22,7 +22,7 @@ return array (
),
'mobile' =>
array (
'NationalNumberPattern' => '5[0256]\\d{7}',
'NationalNumberPattern' => '5[024-6]\\d{7}',
'PossibleNumberPattern' => '\\d{9}',
'ExampleNumber' => '501234567',
),
@@ -119,7 +119,7 @@ return array (
),
1 =>
array (
'pattern' => '(5[0256])(\\d{3})(\\d{4})',
'pattern' => '(5\\d)(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (

View File

@@ -16,8 +16,7 @@ return array (
'NationalNumberPattern' => '
[237]\\d{8}|
8(?:
[68]\\d{3}|
7[0-69]\\d{2}|
[6-8]\\d{3}|
9(?:
[02-9]\\d{2}|
1(?:
@@ -38,8 +37,7 @@ return array (
71
)\\d{5}|
4(?:
[0-2]\\d|
3[0-57-9]|
[0-3]\\d|
4[47-9]|
5[0-25-9]|
6[6-9]|
@@ -64,16 +62,23 @@ return array (
),
'premiumRate' =>
array (
'NationalNumberPattern' => '190[0126]\\d{6}',
'PossibleNumberPattern' => '\\d{10}',
'NationalNumberPattern' => '
19(?:
0[0126]\\d|
[679]
)\\d{5}
',
'PossibleNumberPattern' => '\\d{8,10}',
'ExampleNumber' => '1900123456',
),
'sharedCost' =>
array (
'NationalNumberPattern' => '
13(?:
00\\d{2}
)?\\d{4}
00\\d{3}|
45[0-4]|
\\d
)\\d{3}
',
'PossibleNumberPattern' => '\\d{6,10}',
'ExampleNumber' => '1300123456',
@@ -131,9 +136,10 @@ return array (
'NationalNumberPattern' => '
1(?:
3(?:
\\d{4}|
00\\d{6}
)|
00\\d{3}|
45[0-4]|
\\d
)\\d{3}|
80(?:
0\\d{6}|
2\\d{3}
@@ -239,7 +245,7 @@ return array (
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '19[67]',
0 => '19[679]',
),
'nationalPrefixFormattingRule' => '$1',
'domesticCarrierCodeFormattingRule' => '',

View File

@@ -31,7 +31,7 @@ return array (
array (
'NationalNumberPattern' => '
(?:
6[146-8]|
6[1-8]|
9[03-9]
)\\d{6}
',

View File

@@ -17,9 +17,8 @@ return array (
'fixedLine' =>
array (
'NationalNumberPattern' => '
1[1-9][2-5]\\d{7}|
(?:
[4689][1-9]|
[14689][1-9]|
2[12478]|
3[1-578]|
5[1-5]|
@@ -39,11 +38,14 @@ return array (
(?:
2[12478]|
3[1-578]|
7[13-579]|
[89][1-9]
)9?[6-9]\\d{7}|
[689][1-9]|
7[13-579]
)(?:
[6-8]|
9\\d?
)\\d{7}|
(?:
[46][1-9]|
4[1-9]|
5[1-5]
)[6-9]\\d{7}
',
@@ -58,7 +60,12 @@ return array (
),
'premiumRate' =>
array (
'NationalNumberPattern' => '[359]00\\d{6,7}',
'NationalNumberPattern' => '
(?:
300|
[59]00\\d?
)\\d{6}
',
'PossibleNumberPattern' => '\\d{8,11}',
'ExampleNumber' => '300123456',
),
@@ -66,14 +73,14 @@ return array (
array (
'NationalNumberPattern' => '
(?:
300\\d|
300\\d(?:\\d{2})?|
40(?:
0\\d|
20
)
)\\d{4}
',
'PossibleNumberPattern' => '\\d{8}',
'PossibleNumberPattern' => '\\d{8,10}',
'ExampleNumber' => '40041234',
),
'personalNumber' =>
@@ -195,7 +202,7 @@ return array (
array (
0 => '
(?:
[189][1-9]|
[1689][1-9]|
2[12478]|
3[1-578]|
7[13-579]
@@ -224,11 +231,11 @@ return array (
array (
0 => '
(?:
300|
40(?:
300|
40(?:
0|
20
)
)
)
',
),
@@ -257,7 +264,7 @@ return array (
array (
0 => '
(?:
[189][1-9]|
[1689][1-9]|
2[12478]|
3[1-578]|
7[13-579]
@@ -286,11 +293,11 @@ return array (
array (
0 => '
(?:
300|
40(?:
300|
40(?:
0|
20
)
)
)
',
),

View File

@@ -16,13 +16,21 @@ return array (
),
'fixedLine' =>
array (
'NationalNumberPattern' => '[234578][02]\\d{5}',
'NationalNumberPattern' => '
(?:
[23458][02]\\d|
7(?:
[02]\\d|
32
)
)\\d{4}
',
'PossibleNumberPattern' => '\\d{7}',
'ExampleNumber' => '2221234',
),
'mobile' =>
array (
'NationalNumberPattern' => '6[0-367]\\d{5}',
'NationalNumberPattern' => '6[0-35-7]\\d{5}',
'PossibleNumberPattern' => '\\d{7}',
'ExampleNumber' => '6221234',
),

View File

@@ -39,7 +39,7 @@ return array (
(?:
0[1-9]|
4\\d|
5[4-9]|
5[14-9]|
6[015-79]|
7[578]|
87

View File

@@ -21,12 +21,9 @@ return array (
array (
'NationalNumberPattern' => '
2(?:
1962\\d{4}|
2\\d{7}|
3(?:
20|
22
)\\d{5}|
1962\\d{4}
32[0-2]\\d{5}
)|
(?:
3[2-5]|

View File

@@ -32,7 +32,7 @@ return array (
)|
4(?:
[15]1|
3[12]
3[1-35]
)|
5(?:
1\\d|
@@ -95,15 +95,16 @@ return array (
2[248]|
3[04-9]|
4[3-6]|
5[0-3689]|
5[0-4689]|
6[2368]|
9[02-9]
)|
8(?:
078|
1[236-8]|
2[5-7]|
3\\d|
5[4-9]|
5[1-9]|
7[02-9]|
8[3678]|
9[1-7]
@@ -137,7 +138,7 @@ return array (
[38]\\d|
4[57]|
5[0-35-9]|
7[06-8]
7[036-8]
)\\d{8}
',
'PossibleNumberPattern' => '\\d{11}',
@@ -428,44 +429,6 @@ return array (
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
8 =>
array (
'pattern' => '(\\d{3})(\\d{4})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
3(?:
11|
7[179]
)|
4(?:
[15]1|
3[12]
)|
5(?:
1|
2[37]|
3[12]|
51|
7[13-79]|
9[15]
)|
7(?:
31|
5[457]|
6[09]|
91
)|
8(?:
[57]1|
98
)
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
9 =>
array (
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
@@ -514,7 +477,7 @@ return array (
1[236-8]|
2[5-7]|
3|
5[4-9]|
5[1-9]|
7[02-9]|
8[3678]|
9[1-7]
@@ -531,7 +494,57 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
9 =>
array (
'pattern' => '(\\d{3})(\\d{4})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
3(?:
11|
7[179]
)|
4(?:
[15]1|
3[1-35]
)|
5(?:
1|
2[37]|
3[12]|
51|
7[13-79]|
9[15]
)|
7(?:
31|
5[457]|
6[09]|
91
)|
8(?:
[57]1|
98
)
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
10 =>
array (
'pattern' => '(\\d{4})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '807',
1 => '8078',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
11 =>
array (
'pattern' => '(\\d{3})(\\d{4})(\\d{4})',
'format' => '$1 $2 $3',
@@ -542,7 +555,7 @@ return array (
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
11 =>
12 =>
array (
'pattern' => '(10800)(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
@@ -555,7 +568,7 @@ return array (
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',
),
12 =>
13 =>
array (
'pattern' => '(\\d{3})(\\d{7,8})',
'format' => '$1 $2',
@@ -683,44 +696,6 @@ return array (
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
6 =>
array (
'pattern' => '(\\d{3})(\\d{4})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
3(?:
11|
7[179]
)|
4(?:
[15]1|
3[12]
)|
5(?:
1|
2[37]|
3[12]|
51|
7[13-79]|
9[15]
)|
7(?:
31|
5[457]|
6[09]|
91
)|
8(?:
[57]1|
98
)
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
7 =>
array (
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
@@ -769,7 +744,7 @@ return array (
1[236-8]|
2[5-7]|
3|
5[4-9]|
5[1-9]|
7[02-9]|
8[3678]|
9[1-7]
@@ -786,7 +761,57 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
7 =>
array (
'pattern' => '(\\d{3})(\\d{4})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
3(?:
11|
7[179]
)|
4(?:
[15]1|
3[1-35]
)|
5(?:
1|
2[37]|
3[12]|
51|
7[13-79]|
9[15]
)|
7(?:
31|
5[457]|
6[09]|
91
)|
8(?:
[57]1|
98
)
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
8 =>
array (
'pattern' => '(\\d{4})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '807',
1 => '8078',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
9 =>
array (
'pattern' => '(\\d{3})(\\d{4})(\\d{4})',
'format' => '$1 $2 $3',
@@ -797,7 +822,7 @@ return array (
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '$CC $1',
),
9 =>
10 =>
array (
'pattern' => '(10800)(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
@@ -810,7 +835,7 @@ return array (
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',
),
10 =>
11 =>
array (
'pattern' => '(\\d{3})(\\d{7,8})',
'format' => '$1 $2',

View File

@@ -145,7 +145,32 @@ return array (
),
'voicemail' =>
array (
'NationalNumberPattern' => '17799\\d{7,8}',
'NationalNumberPattern' => '
1(?:
5(?:
(?:
2\\d55|
7\\d99|
9\\d33
)\\d{7}|
(?:
[034568]00|
113
)\\d{8}
)|
6(?:
013|
255|
399
)\\d{7,8}|
7(?:
[015]13|
[234]55|
[69]33|
[78]99
)\\d{7,8}
)
',
'PossibleNumberPattern' => '\\d{12,13}',
'ExampleNumber' => '177991234567',
),
@@ -370,19 +395,6 @@ return array (
'domesticCarrierCodeFormattingRule' => '',
),
8 =>
array (
'pattern' => '(177)(99)(\\d{7,8})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '177',
1 => '1779',
2 => '17799',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
9 =>
array (
'pattern' => '(\\d{3})(\\d)(\\d{4,10})',
'format' => '$1 $2 $3',
@@ -406,7 +418,7 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
10 =>
9 =>
array (
'pattern' => '(1\\d{2})(\\d{5,11})',
'format' => '$1 $2',
@@ -417,7 +429,7 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
11 =>
10 =>
array (
'pattern' => '(18\\d{3})(\\d{6})',
'format' => '$1 $2',
@@ -430,7 +442,7 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
12 =>
11 =>
array (
'pattern' => '(18\\d{2})(\\d{7})',
'format' => '$1 $2',
@@ -441,7 +453,7 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
13 =>
12 =>
array (
'pattern' => '(18\\d)(\\d{8})',
'format' => '$1 $2',
@@ -452,7 +464,7 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
14 =>
13 =>
array (
'pattern' => '(700)(\\d{4})(\\d{4})',
'format' => '$1 $2 $3',
@@ -463,7 +475,7 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
15 =>
14 =>
array (
'pattern' => '(138)(\\d{4})',
'format' => '$1 $2',
@@ -474,6 +486,44 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
15 =>
array (
'pattern' => '(15[013-68])(\\d{2})(\\d{8})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '15[013-68]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
16 =>
array (
'pattern' => '(15[279]\\d)(\\d{2})(\\d{7})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '15[279]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
17 =>
array (
'pattern' => '(1[67]\\d)(\\d{2})(\\d{7,8})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
1(?:
6[023]|
7
)
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
),
'intlNumberFormat' =>
array (

View File

@@ -24,12 +24,7 @@ return array (
),
'mobile' =>
array (
'NationalNumberPattern' => '
77(?:
08|
[6-8]\\d
)\\d{4}
',
'NationalNumberPattern' => '77[0-26-8]\\d{5}',
'PossibleNumberPattern' => '\\d{8}',
'ExampleNumber' => '77831001',
),

View File

@@ -44,7 +44,7 @@ return array (
6[5-8]
)|
5(?:
1[57]|
1[578]|
44|
5[0-4]
)|
@@ -136,9 +136,8 @@ return array (
array (
'NationalNumberPattern' => '
9(?:
[1-4]\\d|
5[89]|
66
[1-46]\\d|
5[89]
)\\d{6}
',
'PossibleNumberPattern' => '\\d{9}',

View File

@@ -27,9 +27,8 @@ return array (
array (
'NationalNumberPattern' => '
(?:
2[1-9]|
5\\d|
7[1-79]
[27][1-9]|
5\\d
)\\d{4}
',
'PossibleNumberPattern' => '\\d{6}',
@@ -48,7 +47,7 @@ return array (
[1345][15-7]|
2[125-7]|
99
)\\d{2}
)\\d{2}
',
'PossibleNumberPattern' => '\\d{6}',
'ExampleNumber' => '901123',

View File

@@ -31,7 +31,7 @@ return array (
),
'tollFree' =>
array (
'NationalNumberPattern' => '80\\d{7}',
'NationalNumberPattern' => '80[0-5]\\d{6}',
'PossibleNumberPattern' => '\\d{9}',
'ExampleNumber' => '801234567',
),
@@ -72,8 +72,9 @@ return array (
),
'uan' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '80[6-9]\\d{6}',
'PossibleNumberPattern' => '\\d{9}',
'ExampleNumber' => '806123456',
),
'emergency' =>
array (

View File

@@ -30,7 +30,7 @@ return array (
'NationalNumberPattern' => '
(?:
222|
551
55[15]
)\\d{6}
',
'PossibleNumberPattern' => '\\d{9}',

View File

@@ -43,6 +43,7 @@ return array (
[079]7|
2[0167]|
3[45]|
47|
8[789]
)|
8(?:
@@ -93,6 +94,7 @@ return array (
[079]7|
2[0167]|
3[45]|
47|
8[789]
)|
8(?:

View File

@@ -34,7 +34,8 @@ return array (
5[5689]|
6[67]|
7[0178]|
[89][6-9]
8[6-9]|
9[4-9]
)|
6[2-9]\\d
)\\d{5}

View File

@@ -196,32 +196,46 @@ return array (
'NationalNumberPattern' => '
(?:
7(?:
0\\d{2}|
0\\d{3}|
2(?:
[0235679]\\d|
[14][017-9]|
8[0-59]|
9[389]
)|
)\\d|
3(?:
[058]\\d|
1[09]|
7[3679]|
9[689]
[05-8]\\d{2}|
1(?:
[089]\\d|
7[5-8]
)|
2(?:
[5-8]\\d|
[01][089]
)|
3[17-9]\\d|
4(?:
[07-9]\\d|
11
)|
9[01689]\\d
)|
4(?:
0[1-9]|
1[015-9]|
[29][89]|
39|
8[389]
0[1-9]\\d|
1(?:
[015-9]\\d|
4[08]
)|
[29][89]\\d|
39\\d|
8[389]\\d
)|
5(?:
[034678]\\d|
2[03-9]|
5[017-9]|
9[7-9]
)|
)\\d|
6(?:
0[0-47]|
1[0-257-9]|
@@ -229,13 +243,14 @@ return array (
3[19]|
5[4589]|
[6-9]\\d
)|
)\\d|
7(?:
0[2-9]|
[1-79]\\d|
8[1-9]
)|
8[0-79]\\d
)\\d|
8[0-79]\\d{2}|
99[4-9]\\d
)|
8(?:
0(?:
@@ -270,9 +285,9 @@ return array (
2[2-9]|
4[0-8]
)
)|
9\\d{3}
)\\d{6}
)\\d|
9\\d{4}
)\\d{5}
',
'PossibleNumberPattern' => '\\d{10}',
'ExampleNumber' => '9123456789',
@@ -385,11 +400,11 @@ return array (
array (
0 => '
7(?:
[0257]|
3[0157-9]|
[02357]|
4[0-389]|
6[0-35-9]|
8[0-79]
8[0-79]|
99
)|
8(?:
0[015689]|
@@ -414,14 +429,16 @@ return array (
9[389]
)|
3(?:
[058]|
1[09]|
7[3679]|
9[689]
[05-8]|
1[07-9]|
2[015-8]|
3[17-9]|
4[017-9]|
9[01689]
)|
4(?:
0[1-9]|
1[015-9]|
1[014-9]|
[29][89]|
39|
8[389]
@@ -445,7 +462,102 @@ return array (
[1-79]|
8[1-9]
)|
8[0-79]
8[0-79]|
99[4-9]
)|
8(?:
0(?:
[01589]|
6[67]
)|
1(?:
[02-57-9]|
1[0135-9]
)|
2(?:
[236-9]|
5[1-9]
)|
3(?:
[0357-9]|
4[1-9]
)|
[45]|
6[02457-9]|
7(?:
07|
[1-69]
)|
8(?:
[0-26-9]|
44|
5[2-9]
)|
9(?:
[035-9]|
2[2-9]|
4[0-8]
)
)|
9
',
2 => '
7(?:
0|
2(?:
[0235679]|
[14][017-9]|
8[0-59]|
9[389]
)|
3(?:
[05-8]|
1(?:
[089]|
7[5-9]
)|
2(?:
[5-8]|
[01][089]
)|
3[17-9]|
4(?:
[07-9]|
11
)|
9[01689]
)|
4(?:
0[1-9]|
1(?:
[015-9]|
4[08]
)|
[29][89]|
39|
8[389]
)|
5(?:
[034678]|
2[03-9]|
5[017-9]|
9[7-9]
)|
6(?:
0[0-47]|
1[0-257-9]|
2[0-4]|
3[19]|
5[4589]|
[6-9]
)|
7(?:
0[2-9]|
[1-79]|
8[1-9]
)|
8[0-79]|
99[4-9]
)|
8(?:
0(?:

View File

@@ -40,9 +40,8 @@ return array (
7(?:
[0-36]\\d|
5[0-6]|
7[0-5]|
8[0-25-9]|
9[0-4]
[79][0-7]|
8[0-25-9]
)\\d{6}
',
'PossibleNumberPattern' => '\\d{9}',
@@ -119,7 +118,7 @@ return array (
'countryCode' => 254,
'internationalPrefix' => '000',
'nationalPrefix' => '0',
'nationalPrefixForParsing' => '0',
'nationalPrefixForParsing' => '005|0',
'sameMobileAndFixedLinePattern' => false,
'numberFormat' =>
array (

View File

@@ -38,25 +38,35 @@ return array (
'NationalNumberPattern' => '
(?:
1(?:
[013-9]|
2\\d?
[013-79]\\d|
[28]\\d{1,2}
)|
2[3-6]48|
3(?:
[18]\\d{2}|
[2-6]48
)|
4[2-4]48|
5[2-5]48|
6(?:
[016-9]\\d|
[2-5]48
)|
3[18]\\d|
6[016-9]|
7(?:
[07-9]|
[16]\\d
[07-9]\\d|
[16]\\d{2}|
[2-5]48
)|
8(?:
[013-79]|
8\\d
[013-79]\\d|
8\\d{2}
)|
9(?:
6\\d|
7\\d?|
[0-589]
6\\d{2}|
7\\d{1,2}|
[0-589]\\d
)
)\\d{6}
)\\d{5}
',
'PossibleNumberPattern' => '\\d{8,9}',
'ExampleNumber' => '91234567',

View File

@@ -9,10 +9,11 @@ return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '
007\\d{9,11}|
[1-7]\\d{3,9}|
8\\d{8}
',
'PossibleNumberPattern' => '\\d{4,10}',
'PossibleNumberPattern' => '\\d{4,14}',
),
'fixedLine' =>
array (
@@ -38,8 +39,13 @@ return array (
),
'tollFree' =>
array (
'NationalNumberPattern' => '80\\d{7}',
'PossibleNumberPattern' => '\\d{9}',
'NationalNumberPattern' => '
(?:
00798\\d{0,2}|
80
)\\d{7}
',
'PossibleNumberPattern' => '\\d{9,14}',
'ExampleNumber' => '801234567',
),
'premiumRate' =>
@@ -91,6 +97,7 @@ return array (
)|
8(?:
00|
33|
55|
77|
99
@@ -127,16 +134,233 @@ return array (
),
'noInternationalDialling' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '00798\\d{7,9}',
'PossibleNumberPattern' => '\\d{12,14}',
'ExampleNumber' => '007981234567',
),
'id' => 'KR',
'countryCode' => 82,
'internationalPrefix' => '00(?:[124-68]|[37]\\d{2})',
'internationalPrefix' => '00(?:[124-68]|3\\d{2}|7(?:[0-8]\\d|9[0-79]))',
'nationalPrefix' => '0',
'nationalPrefixForParsing' => '0(8[1-46-8]|85\\d{2})?',
'sameMobileAndFixedLinePattern' => false,
'numberFormat' =>
array (
0 =>
array (
'pattern' => '(\\d{5})(\\d{3,4})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '00798',
),
'nationalPrefixFormattingRule' => '$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
1 =>
array (
'pattern' => '(\\d{5})(\\d{2})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3 $4',
'leadingDigitsPatterns' =>
array (
0 => '00798',
),
'nationalPrefixFormattingRule' => '$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
2 =>
array (
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
'format' => '$1-$2-$3',
'leadingDigitsPatterns' =>
array (
0 => '
1(?:
0|
1[19]|
[69]9|
5[458]
)|
[57]0
',
1 => '
1(?:
0|
1[19]|
[69]9|
5(?:
44|
59|
8
)
)|
[57]0
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
3 =>
array (
'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})',
'format' => '$1-$2-$3',
'leadingDigitsPatterns' =>
array (
0 => '
1(?:
[01]|
5[1-4]|
6[2-8]|
[7-9]
)|
[68]0|
[3-6][1-9][1-9]
',
1 => '
1(?:
[01]|
5(?:
[1-3]|
4[56]
)|
6[2-8]|
[7-9]
)|
[68]0|
[3-6][1-9][1-9]
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
4 =>
array (
'pattern' => '(\\d{3})(\\d)(\\d{4})',
'format' => '$1-$2-$3',
'leadingDigitsPatterns' =>
array (
0 => '131',
1 => '1312',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
5 =>
array (
'pattern' => '(\\d{3})(\\d{2})(\\d{4})',
'format' => '$1-$2-$3',
'leadingDigitsPatterns' =>
array (
0 => '131',
1 => '131[13-9]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
6 =>
array (
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
'format' => '$1-$2-$3',
'leadingDigitsPatterns' =>
array (
0 => '13[2-9]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
7 =>
array (
'pattern' => '(\\d{2})(\\d{2})(\\d{3})(\\d{4})',
'format' => '$1-$2-$3-$4',
'leadingDigitsPatterns' =>
array (
0 => '30',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
8 =>
array (
'pattern' => '(\\d)(\\d{3,4})(\\d{4})',
'format' => '$1-$2-$3',
'leadingDigitsPatterns' =>
array (
0 => '2[1-9]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
9 =>
array (
'pattern' => '(\\d)(\\d{3,4})',
'format' => '$1-$2',
'leadingDigitsPatterns' =>
array (
0 => '21[0-46-9]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
10 =>
array (
'pattern' => '(\\d{2})(\\d{3,4})',
'format' => '$1-$2',
'leadingDigitsPatterns' =>
array (
0 => '[3-6][1-9]1',
1 => '
[3-6][1-9]1(?:
[0-46-9]
)
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
11 =>
array (
'pattern' => '(\\d{4})(\\d{4})',
'format' => '$1-$2',
'leadingDigitsPatterns' =>
array (
0 => '
1(?:
5[46-9]|
6[04678]|
8[03579]
)
',
1 => '
1(?:
5(?:
44|
66|
77|
88|
99
)|
6(?:
00|
44|
6[16]|
70|
88
)|
8(?:
00|
33|
55|
77|
99
)
)
',
),
'nationalPrefixFormattingRule' => '$1',
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
),
'intlNumberFormat' =>
array (
0 =>
array (
@@ -297,7 +521,7 @@ return array (
1(?:
5[46-9]|
6[04678]|
8[0579]
8[03579]
)
',
1 => '
@@ -318,6 +542,7 @@ return array (
)|
8(?:
00|
33|
55|
77|
99
@@ -329,9 +554,6 @@ return array (
'domesticCarrierCodeFormattingRule' => '0$CC-$1',
),
),
'intlNumberFormat' =>
array (
),
'mainCountryForCode' => false,
'leadingZeroPossible' => false,
'mobileNumberPortableRegion' => true,

View File

@@ -43,7 +43,7 @@ return array (
1[0-7]\\d|
2(?:
22|
55
5[25]
)
)|
6(?:
@@ -145,8 +145,12 @@ return array (
'leadingDigitsPatterns' =>
array (
0 => '
[126]|
9[04-9]|
[16]|
2(?:
[0-35-9]|
4[0-35-9]
)|
9[024-9]|
52[25]
',
),
@@ -160,8 +164,8 @@ return array (
'leadingDigitsPatterns' =>
array (
0 => '
5[015]|
92
244|
5[015]
',
),
'nationalPrefixFormattingRule' => '',

View File

@@ -17,16 +17,15 @@ return array (
(?:
2(?:
0(?:
2[0-589]|
7\\d
2\\d|
7[0-8]
)|
1(?:
2[5-7]|
[3-689]\\d|
7[2-4689]
[3-689]\\d
)
)|
44[239]\\d
44[1239]\\d
)\\d{4}
',
'PossibleNumberPattern' => '\\d{8}',
@@ -35,15 +34,21 @@ return array (
'mobile' =>
array (
'NationalNumberPattern' => '
[67]\\d{7}|
9[0-25-9]\\d{6}
(?:
2(?:
079|
17\\d
)|
[679]\\d{3}|
8[239]\\d{2}
)\\d{4}
',
'PossibleNumberPattern' => '\\d{8}',
'ExampleNumber' => '65012345',
),
'tollFree' =>
array (
'NationalNumberPattern' => '800\\d{5}',
'NationalNumberPattern' => '80\\d{6}',
'PossibleNumberPattern' => '\\d{8}',
'ExampleNumber' => '80012345',
),
@@ -104,8 +109,9 @@ return array (
),
'noInternationalDialling' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '80\\d{6}',
'PossibleNumberPattern' => '\\d{8}',
'ExampleNumber' => '80012345',
),
'id' => 'ML',
'countryCode' => 223,

View File

@@ -27,7 +27,7 @@ return array (
'NationalNumberPattern' => '
6(?:
[2356]\\d|
8[18]
8[158]
)\\d{5}
',
'PossibleNumberPattern' => '\\d{8}',

View File

@@ -34,6 +34,7 @@ return array (
(?:
4[015-8]|
5[89]|
87|
9\\d
)\\d{6}
',

View File

@@ -10,9 +10,8 @@ return array (
array (
'NationalNumberPattern' => '
(?:
2[2-6]|
5|
9\\d
[279]\\d
)\\d{6}|
800\\d{5,6}
',
@@ -27,6 +26,7 @@ return array (
'mobile' =>
array (
'NationalNumberPattern' => '
7[19]\\d{6}|
9(?:
0[1-9]|
[1-9]\\d
@@ -46,11 +46,7 @@ return array (
),
'premiumRate' =>
array (
'NationalNumberPattern' => '
(?:
900
)\\d{5}
',
'NationalNumberPattern' => '900\\d{5}',
'PossibleNumberPattern' => '\\d{8}',
'ExampleNumber' => '90012345',
),
@@ -128,11 +124,11 @@ return array (
),
1 =>
array (
'pattern' => '(9\\d{3})(\\d{4})',
'pattern' => '([79]\\d{3})(\\d{4})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '9',
0 => '[79]',
),
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',

View File

@@ -13,13 +13,13 @@ return array (
),
'fixedLine' =>
array (
'NationalNumberPattern' => '41\\d{4} ',
'NationalNumberPattern' => '41\\d{4}',
'PossibleNumberPattern' => '\\d{6}',
'ExampleNumber' => '411234',
),
'mobile' =>
array (
'NationalNumberPattern' => '55\\d{4} ',
'NationalNumberPattern' => '55\\d{4}',
'PossibleNumberPattern' => '\\d{6}',
'ExampleNumber' => '551234',
),

View File

@@ -35,7 +35,7 @@ return array (
5[025-9]|
9[0-5]
)\\d{4}|
8[4-8]\\d{5}|
8[4-9]\\d{5}|
9(?:
1[2-9]|
2[013-9]|

View File

@@ -237,16 +237,15 @@ return array (
),
2 =>
array (
'pattern' => '([1-69]\\d)(\\d{3})(\\d{2})',
'pattern' => '([1-469]\\d)(\\d{3})(\\d{2})',
'format' => '$1-$2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
1[13689]|
1[136]|
2[136]|
3[1356]|
3[356]|
4[0246]|
54|
6[03]|
90
',
@@ -262,11 +261,17 @@ return array (
array (
0 => '
1[2457]|
2[2457-9]|
2(?:
[247-9]|
5[0138]
)|
3[0247-9]|
4[1357-9]|
5[0-35-9]|
6[124-9]|
6(?:
[124-689]|
7[0-2]
)|
9(?:
[125-8]|
3[0-5]|
@@ -285,11 +290,17 @@ return array (
array (
0 => '
1[2457]|
2[2457-9]|
2(?:
[247-9]|
5[0138]
)|
3[0247-9]|
4[1357-9]|
5[0-35-9]|
6[124-9]|
6(?:
[124-689]|
7[0-2]
)|
9(?:
[125-8]|
3[0-5]|
@@ -355,6 +366,20 @@ return array (
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
10 =>
array (
'pattern' => '(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})',
'format' => '$1-$2 $3 $4 $5',
'leadingDigitsPatterns' =>
array (
0 => '
25[245]|
67[3-6]
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
),
),
'intlNumberFormat' =>
array (
@@ -386,16 +411,15 @@ return array (
),
2 =>
array (
'pattern' => '([1-69]\\d)(\\d{3})(\\d{2})',
'pattern' => '([1-469]\\d)(\\d{3})(\\d{2})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
1[13689]|
1[136]|
2[136]|
3[1356]|
3[356]|
4[0246]|
54|
6[03]|
90
',
@@ -409,11 +433,17 @@ return array (
array (
0 => '
1[2457]|
2[2457-9]|
2(?:
[247-9]|
5[0138]
)|
3[0247-9]|
4[1357-9]|
5[0-35-9]|
6[124-9]|
6(?:
[124-689]|
7[0-2]
)|
9(?:
[125-8]|
3[0-5]|
@@ -430,11 +460,17 @@ return array (
array (
0 => '
1[2457]|
2[2457-9]|
2(?:
[247-9]|
5[0138]
)|
3[0247-9]|
4[1357-9]|
5[0-35-9]|
6[124-9]|
6(?:
[124-689]|
7[0-2]
)|
9(?:
[125-8]|
3[0-5]|
@@ -488,6 +524,18 @@ return array (
0 => '9[034]',
),
),
10 =>
array (
'pattern' => '(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})',
'format' => '$1 $2 $3 $4 $5',
'leadingDigitsPatterns' =>
array (
0 => '
25[245]|
67[3-6]
',
),
),
),
'mainCountryForCode' => false,
'leadingZeroPossible' => false,

View File

@@ -40,7 +40,7 @@ return array (
99?\\d
)|
9(?:
07|
0[67]|
[2-9]
)\\d
)\\d{5}

View File

@@ -8,7 +8,7 @@
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[3-59]\\d{8}',
'NationalNumberPattern' => '[3-589]\\d{8}',
'PossibleNumberPattern' => '\\d{3,9}',
),
'fixedLine' =>
@@ -37,7 +37,9 @@ return array (
array (
'NationalNumberPattern' => '
(?:
41[18]|
50[125]|
88\\d|
9[0-35-9]\\d
)\\d{6}
',
@@ -134,13 +136,13 @@ return array (
),
1 =>
array (
'pattern' => '([459]\\d)(\\d{3})(\\d{4})',
'pattern' => '([4589]\\d)(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '
4[48]|
5|
4[148]|
[58]|
9(?:
1[59]|
[0235-9]

View File

@@ -8,20 +8,25 @@
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[2-9]\\d{3}',
'PossibleNumberPattern' => '\\d{4}',
'NationalNumberPattern' => '[2-47]\\d{3,6}',
'PossibleNumberPattern' => '\\d{4,7}',
),
'fixedLine' =>
array (
'NationalNumberPattern' => '[2-4]\\d{3}',
'PossibleNumberPattern' => '\\d{4}',
'ExampleNumber' => '3010',
'NationalNumberPattern' => '
(?:
2[2-4]|
[34]\\d
)\\d{2,5}
',
'PossibleNumberPattern' => '\\d{4,7}',
'ExampleNumber' => '3101',
),
'mobile' =>
array (
'NationalNumberPattern' => '[5-9]\\d{3}',
'PossibleNumberPattern' => '\\d{4}',
'ExampleNumber' => '5190',
'NationalNumberPattern' => '7[2-4]\\d{2,5}',
'PossibleNumberPattern' => '\\d{4,7}',
'ExampleNumber' => '7290',
),
'tollFree' =>
array (

View File

@@ -74,7 +74,7 @@ return array (
1[02-9]|
2[0457]|
3[1247]|
4[07]|
4[037]|
5[47]|
6[02359]|
7[02-59]|
@@ -168,7 +168,7 @@ return array (
1[02-9]|
2[0457]|
3[1247]|
4[07]|
4[037]|
5[47]|
6[02359]|
7[02-59]|

View File

@@ -40,9 +40,12 @@ return array (
7(?:
[02-79]|
[18][01]
)|
8[1-9]
)\\d{7}
)
)\\d{7}|
8(?:
[1-57]\\d|
[689][0-79]
)\\d{6}
',
'PossibleNumberPattern' => '\\d{9,10}',
'ExampleNumber' => '2101234567',
@@ -58,7 +61,8 @@ return array (
8[68]|
99
)
)\\d{7}
)\\d{7}|
8[689]8\\d{6}
',
'PossibleNumberPattern' => '\\d{9,10}',
'ExampleNumber' => '912345678',
@@ -164,7 +168,13 @@ return array (
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '[48]',
0 => '
4|
8(?:
[1-57]|
[689][0-79]
)
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
@@ -227,11 +237,14 @@ return array (
),
6 =>
array (
'pattern' => '(9\\d)(\\d{3})(\\d{2})(\\d{2})',
'pattern' => '([89]\\d)(\\d{3})(\\d{2})(\\d{2})',
'format' => '$1 $2 $3 $4',
'leadingDigitsPatterns' =>
array (
0 => '9',
0 => '
8[689]8|
9
',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',

View File

@@ -8,18 +8,18 @@
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[1249]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
'NationalNumberPattern' => '[1249]\\d{2,5}',
'PossibleNumberPattern' => '\\d{3,6}',
),
'fixedLine' =>
array (
'NationalNumberPattern' => '[1249]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
'NationalNumberPattern' => '[1249]\\d{2,5}',
'PossibleNumberPattern' => '\\d{3,6}',
),
'mobile' =>
array (
'NationalNumberPattern' => '[1249]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
'NationalNumberPattern' => '[1249]\\d{2,5}',
'PossibleNumberPattern' => '\\d{3,6}',
),
'tollFree' =>
array (
@@ -95,17 +95,24 @@ return array (
81|
9[0-5789]
)|
27878|
2(?:
7(?:
330|
878
)|
85959
)|
40404|
911
',
'PossibleNumberPattern' => '\\d{3,5}',
'PossibleNumberPattern' => '\\d{3,6}',
'ExampleNumber' => '168',
),
'standardRate' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '27330',
'PossibleNumberPattern' => '\\d{5}',
'ExampleNumber' => '27330',
),
'carrierSpecific' =>
array (

View File

@@ -8,23 +8,51 @@
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[129]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
'NationalNumberPattern' => '
[124-9]\\d{2,5}|
3(?:
\\d{2,5}|
\\d{7}
)
',
'PossibleNumberPattern' => '
\\d{3,6}|
\\d{8}
',
),
'fixedLine' =>
array (
'NationalNumberPattern' => '[129]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
'NationalNumberPattern' => '
[124-9]\\d{2,5}|
3(?:
\\d{2,5}|
\\d{7}
)
',
'PossibleNumberPattern' => '
\\d{3,6}|
\\d{8}
',
),
'mobile' =>
array (
'NationalNumberPattern' => '[129]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
'NationalNumberPattern' => '
[124-9]\\d{2,5}|
3(?:
\\d{2,5}|
\\d{7}
)
',
'PossibleNumberPattern' => '
\\d{3,6}|
\\d{8}
',
),
'tollFree' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '211',
'PossibleNumberPattern' => '\\d{3}',
'ExampleNumber' => '211',
),
'premiumRate' =>
array (
@@ -73,12 +101,26 @@ return array (
'shortCode' =>
array (
'NationalNumberPattern' => '
112|
21212|
911
1(?:
12|
\\d{4,5}
)|
[25-9](?:
11|
\\d{4,5}
)|
3(?:
\\d{4,5}|
0000\\d{3}|
11
)|
411
',
'PossibleNumberPattern' => '\\d{3,5}',
'ExampleNumber' => '911',
'PossibleNumberPattern' => '
\\d{3,6}|
\\d{8}
',
'ExampleNumber' => '12345',
),
'standardRate' =>
array (
@@ -87,8 +129,9 @@ return array (
),
'carrierSpecific' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '[23567]11',
'PossibleNumberPattern' => '\\d{3}',
'ExampleNumber' => '611',
),
'noInternationalDialling' =>
array (

View File

@@ -58,7 +58,7 @@ return array (
),
'emergency' =>
array (
'NationalNumberPattern' => '112',
'NationalNumberPattern' => '11[24]',
'PossibleNumberPattern' => '\\d{3}',
'ExampleNumber' => '112',
),

View File

@@ -48,7 +48,8 @@ return array (
[0459]|
6\\d{3}|
871[03]
)
)|
9[167]
)|
224|
3(?:
@@ -131,6 +132,7 @@ return array (
)|
8\\d{3}
)|
9[167]|
[578]
)|
2(?:

View File

@@ -8,28 +8,38 @@
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[1489]\\d{2,4}',
'NationalNumberPattern' => '[1-9]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
),
'fixedLine' =>
array (
'NationalNumberPattern' => '[1489]\\d{2,4}',
'NationalNumberPattern' => '[1-9]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
),
'mobile' =>
array (
'NationalNumberPattern' => '[1489]\\d{2,4}',
'NationalNumberPattern' => '[1-9]\\d{2,4}',
'PossibleNumberPattern' => '\\d{3,5}',
),
'tollFree' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '
15(?:
01|
2[127]|
6(?:
29|
6[67]
)
)
',
'PossibleNumberPattern' => '\\d{4,5}',
'ExampleNumber' => '1501',
),
'premiumRate' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleNumberPattern' => 'NA',
'NationalNumberPattern' => '909\\d{2}',
'PossibleNumberPattern' => '\\d{5}',
),
'sharedCost' =>
array (
@@ -60,6 +70,7 @@ return array (
array (
'NationalNumberPattern' => '
112|
114|
999
',
'PossibleNumberPattern' => '\\d{3}',
@@ -76,18 +87,54 @@ return array (
1(?:
0(?:
[079]|
1[12]|
400
)|
1(?:
[26]|
9[0-259]
[2456]|
9[0-2459]
)|
2[13]|
3[01]
2[123]|
3[01]|
5(?:
01|
1[01]|
2[0-2457]|
33|
55|
6(?:
29|
6[67]
)
)|
65\\d{2}|
[78]\\d|
9(?:
[02-9]\\d{2}|
19
)
)|
40404|
8988|
999
(?:
2[0-79]|
3[0-29]|
4[0-4]
)\\d{3}|
5(?:
[0-2]\\d|
99
)\\d{2}|
(?:
6[2357]|
7[0-29]
)\\d{3}|
8(?:
[0-9]\\d{3}|
988
)|
9(?:
09\\d{2}|
99
)
',
'PossibleNumberPattern' => '\\d{3,5}',
'ExampleNumber' => '116',
@@ -100,11 +147,35 @@ return array (
'carrierSpecific' =>
array (
'NationalNumberPattern' => '
10400|
40404|
8988
1(?:
0400|
3[01]|
5(?:
1[01]|
2[25]
)|
65\\d{2}
)|
(?:
2[0-79]|
3[0-29]|
4[0-4]
)\\d{3}|
5(?:
[0-2]\\d|
99
)\\d{2}|
(?:
6[2357]|
7[0-29]
)\\d{3}|
8(?:
988|
[0-9]\\d{3}
)|
909\\d{2}
',
'PossibleNumberPattern' => '\\d{4,5}',
'PossibleNumberPattern' => '\\d{3,5}',
),
'noInternationalDialling' =>
array (

View File

@@ -8,17 +8,17 @@
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[1367]\\d{1,4}',
'NationalNumberPattern' => '[13678]\\d{1,4}',
'PossibleNumberPattern' => '\\d{2,5}',
),
'fixedLine' =>
array (
'NationalNumberPattern' => '[1367]\\d{1,4}',
'NationalNumberPattern' => '[13678]\\d{1,4}',
'PossibleNumberPattern' => '\\d{2,5}',
),
'mobile' =>
array (
'NationalNumberPattern' => '[1367]\\d{1,4}',
'NationalNumberPattern' => '[13678]\\d{1,4}',
'PossibleNumberPattern' => '\\d{2,5}',
),
'tollFree' =>
@@ -32,7 +32,8 @@ return array (
74(?:
02|
44
)
)|
8000[12]
',
'PossibleNumberPattern' => '\\d{4,5}',
'ExampleNumber' => '35200',
@@ -49,7 +50,8 @@ return array (
99
)|
7574
)
)|
8002[12]
',
'PossibleNumberPattern' => '\\d{4,5}',
'ExampleNumber' => '35211',
@@ -81,13 +83,8 @@ return array (
),
'emergency' =>
array (
'NationalNumberPattern' => '
1(?:
12|
[578]
)
',
'PossibleNumberPattern' => '\\d{2,3}',
'NationalNumberPattern' => '1[578]',
'PossibleNumberPattern' => '\\d{2}',
'ExampleNumber' => '17',
),
'voicemail' =>
@@ -115,32 +112,9 @@ return array (
35|
57
)|
2(?:
00|
11|
2[02]|
3[04-6]
5[0-25-8]|
6[0-69]|
7[0-47]|
80|
99
)
2\\d{2}
)|
6(?:
666|
777
)|
7(?:
4\\d{2}|
5(?:
05|
1[59]|
25|
5[57]|
7[45]
)
)
[67]\\d{3}
)|
67(?:
0[09]|
@@ -153,7 +127,8 @@ return array (
0[02]|
44|
55
)
)|
800[012][12]
',
'PossibleNumberPattern' => '\\d{2,5}',
'ExampleNumber' => '1210',
@@ -165,7 +140,8 @@ return array (
433|
575
)|
7400
7400|
8001[12]
',
'PossibleNumberPattern' => '\\d{4,5}',
'ExampleNumber' => '7400',
@@ -175,8 +151,9 @@ return array (
'NationalNumberPattern' => '
3(?:
5035|
6\\d{3}
)
[67]\\d{3}
)|
800[012][12]
',
'PossibleNumberPattern' => '\\d{5}',
'ExampleNumber' => '35035',

View File

@@ -209,7 +209,7 @@ return array (
'NationalNumberPattern' => '
[2-9]\\d{3}|
33669|
611
[2356]11
',
'PossibleNumberPattern' => '\\d{3,5}',
'ExampleNumber' => '33669',

View File

@@ -15,17 +15,17 @@ class PhoneNumberOfflineGeocoder
/**
* @var PhoneNumberOfflineGeocoder
*/
private static $instance;
protected static $instance;
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
protected $phoneUtil;
/**
* @var PrefixFileReader
*/
private $prefixFileReader = null;
protected $prefixFileReader = null;
private function __construct($phonePrefixDataDirectory)
protected function __construct($phonePrefixDataDirectory)
{
if(!extension_loaded('intl')) {
throw new \RuntimeException('The intl extension must be installed');
@@ -47,16 +47,16 @@ class PhoneNumberOfflineGeocoder
*/
public static function getInstance($mappingDir = self::MAPPING_DATA_DIRECTORY)
{
if (self::$instance === null) {
self::$instance = new self($mappingDir);
if (static::$instance === null) {
static::$instance = new static($mappingDir);
}
return self::$instance;
return static::$instance;
}
public static function resetInstance()
{
self::$instance = null;
static::$instance = null;
}
/**
@@ -94,7 +94,7 @@ class PhoneNumberOfflineGeocoder
* @param int $numberType
* @return boolean
*/
private function canBeGeocoded($numberType)
protected function canBeGeocoded($numberType)
{
return ($numberType === PhoneNumberType::FIXED_LINE || $numberType === PhoneNumberType::MOBILE || $numberType === PhoneNumberType::FIXED_LINE_OR_MOBILE);
}
@@ -107,7 +107,7 @@ class PhoneNumberOfflineGeocoder
* @param $locale
* @return string
*/
private function getCountryNameForNumber(PhoneNumber $number, $locale)
protected function getCountryNameForNumber(PhoneNumber $number, $locale)
{
$regionCodes = $this->phoneUtil->getRegionCodesForCountryCode($number->getCountryCode());
@@ -137,7 +137,7 @@ class PhoneNumberOfflineGeocoder
* @param $locale
* @return string
*/
private function getRegionDisplayName($regionCode, $locale)
protected function getRegionDisplayName($regionCode, $locale)
{
if ($regionCode === null || $regionCode == 'ZZ' || $regionCode === PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY) {
return "";

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1548 => 'Ontario',
);

View File

@@ -0,0 +1,9 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1743 => 'North Carolina',
);

View File

@@ -0,0 +1,28 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
223202 => 'Bamako',
2232070 => 'Bamako',
2232071 => 'Bamako',
2232072 => 'Bamako',
2232073 => 'Bamako',
2232074 => 'Bamako',
2232075 => 'Bamako',
2232076 => 'Bamako',
2232077 => 'Bamako',
2232078 => 'Bamako',
2232126 => 'Koulikoro',
2232127 => 'Koulikoro',
223214 => 'Mopti',
223215 => 'Kayes',
223216 => 'Sikasso',
223218 => 'Gao and Kidal',
223219 => 'Tombouctou',
223442 => 'Bamako',
223443 => 'Bamako',
223449 => 'Bamako',
);

View File

@@ -73,6 +73,7 @@ return array (
25111468 => 'Keria V, Addis Ababa',
25111515 => 'Filwoha II, Addis Ababa',
25111517 => 'Sheraton/DID, Addis Ababa',
25111518 => 'Addis Ababa Region',
25111544 => 'ECA, Addis Ababa',
25111550 => 'Filwoha IV, Addis Ababa',
25111551 => 'Filwoha III, Addis Ababa',

View File

@@ -6,25 +6,25 @@
return array (
25420 => 'Nairobi',
25440 => 'Kwale',
25440 => 'Kwale/Ukunda/Msambweni/Lungalunga',
25441 => 'Mombasa/Mariakani/Kilifi',
25442 => 'Malindi/Lamu/Garsen',
25443 => 'Voi/Wundanyi/Mwatate/Taveta',
25444 => 'Machakos/Makueni/Mwingi/Kitui',
25445 => 'Kajiado/Ngong/Loitokitok/Athi River',
25446 => 'Garissa/Hola/Wajir/Mandera',
25450 => 'Naivasha/Narok',
25451 => 'Nakuru',
25450 => 'Naivasha/Narok/Gilgil',
25451 => 'Nakuru/Njoro/Molo',
25452 => 'Kericho/Bomet',
25453 => 'Eldoret/Turbo/Kapsabet/Iten/Kabarnet',
25454 => 'Kitale/Moi\'s Bridge/Kapenguria/Lodwar',
25455 => 'Bungoma/Busia',
25456 => 'Kakamega/Mbale/Butere/Mumias',
25457 => 'Kisumu/Siaya',
25457 => 'Kisumu/Siaya/Maseno',
25458 => 'Kisii/Kilgoris/Oyugis/Nyamira',
25459 => 'Homabay/Migori',
25460 => 'Muranga/Kerugoya',
25461 => 'Nyeri',
25461 => 'Nyeri/Karatina',
25462 => 'Nanyuki',
25464 => 'Meru/Maua/Chuka',
25465 => 'Nyahururu/Maralal',

View File

@@ -13,7 +13,7 @@ return array (
2715 => 'Polokwane',
2716 => 'Vaal Triangle',
2717 => 'Ermelo/Secunda',
2718 => 'Potschefstroom/Klerksdorp',
2718 => 'Potchefstroom/Klerksdorp',
2720 => 'Fraserberg/Leeugamka/Merweville',
2721 => 'Cape Town',
2722 => 'Malmesbury/Vredenburg',

View File

@@ -0,0 +1,14 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
5012 => 'Belize District',
5013 => 'Orange Walk District',
5014 => 'Corozal District',
5015 => 'Stann Creek District',
5017 => 'Toledo District',
5018 => 'Cayo District',
);

Some files were not shown because too many files have changed in this diff Show More