composer-update-patch
This commit is contained in:
8
vendor/giggsey/libphonenumber-for-php/.gitattributes
vendored
Normal file
8
vendor/giggsey/libphonenumber-for-php/.gitattributes
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
Tests/ export-ignore
|
||||
build/ export-ignore
|
||||
.travis.yml export-ignore
|
||||
build.xml export-ignore
|
||||
phpunit.xml.dist export-ignore
|
||||
libphonenumber-for-php.spec export-ignore
|
||||
|
||||
* text=auto
|
@@ -1,37 +0,0 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- PREFER_LOWEST="--prefer-lowest"
|
||||
- PREFER_LOWEST=""
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
- 7
|
||||
- nightly
|
||||
|
||||
before_script:
|
||||
- composer update --no-interaction $PREFER_LOWEST
|
||||
- mkdir -p build/logs
|
||||
|
||||
script:
|
||||
- ./vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
|
||||
|
||||
after_script:
|
||||
- php vendor/bin/coveralls -v --exclude-no-stmt
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
|
||||
|
||||
notifications:
|
||||
irc: "irc.appliedirc.com#applied"
|
@@ -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.6.1
|
||||
libphonenumber-7.7.3
|
||||
|
@@ -21,7 +21,7 @@ A PHP library for parsing, formatting, storing and validating international phon
|
||||
|
||||
## Installation
|
||||
|
||||
PHP versions 5.3 up to PHP 7 are currently supported. HHVM is not yet supported.
|
||||
PHP versions 5.3 up to PHP 7 are currently supported. HHVM is also supported.
|
||||
|
||||
The PECL [mbstring](http://php.net/mbstring) extension is required.
|
||||
|
||||
@@ -35,6 +35,10 @@ You can also use any other [PSR-0](https://github.com/php-fig/fig-standards/blob
|
||||
|
||||
If you do not use composer, ensure that you also load any dependencies that this project has, such as [giggsey/locale](https://github.com/giggsey/Locale).
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation can be found in the [docs](docs/) directory.
|
||||
|
||||
## Versioning
|
||||
|
||||
This library will try to follow the same version numbers as Google. There could be additional releases where needed to fix critical issues that can not wait until the next release from Google.
|
||||
|
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
ini_set('memory_limit', '1024M');
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class CodeCoverageTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
public function testNullException()
|
||||
{
|
||||
try {
|
||||
$this->phoneUtil->parse(null, null);
|
||||
} catch (\Exception $e) {
|
||||
$this->assertEquals("libphonenumber\\NumberParseException", get_class($e));
|
||||
$this->assertEquals("The phone number supplied was null.", $e->getMessage());
|
||||
|
||||
$this->assertEquals("Error type: 1. The phone number supplied was null.", (string)$e);
|
||||
}
|
||||
}
|
||||
|
||||
public function testTooShortNumber()
|
||||
{
|
||||
try {
|
||||
$this->phoneUtil->parse("+441", "GB");
|
||||
} catch (\Exception $e) {
|
||||
$this->assertEquals("libphonenumber\\NumberParseException", get_class($e));
|
||||
$this->assertEquals("The string supplied is too short to be a phone number.", $e->getMessage());
|
||||
$this->assertEquals(3, $e->getCode());
|
||||
|
||||
$this->assertEquals("Error type: 3. The string supplied is too short to be a phone number.", (string)$e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
<?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()
|
||||
{
|
||||
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")
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberType;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue14Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
public function testKWMobileNumber()
|
||||
{
|
||||
$number = "51440519";
|
||||
$phoneNumber = $this->phoneUtil->parse($number, "KW");
|
||||
|
||||
$this->assertTrue($this->phoneUtil->isValidNumber($phoneNumber));
|
||||
$this->assertEquals(PhoneNumberType::MOBILE, $this->phoneUtil->getNumberType($phoneNumber));
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue17Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberOfflineGeocoder
|
||||
*/
|
||||
private $geocoder;
|
||||
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
PhoneNumberOfflineGeocoder::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
|
||||
}
|
||||
|
||||
public function testIsleOfManLocale()
|
||||
{
|
||||
$number = "447624806000";
|
||||
|
||||
$phoneNumber = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$this->assertEquals("Isle of Man", $this->geocoder->getDescriptionForNumber($phoneNumber, 'en'));
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue21Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
public function testFloatNumber()
|
||||
{
|
||||
$number = "0358112345678987";
|
||||
$phoneNumber = $this->phoneUtil->parse($number, "DE");
|
||||
|
||||
$this->assertTrue($this->phoneUtil->isValidNumber($phoneNumber));
|
||||
|
||||
$this->assertEquals('+49358112345678987', $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::E164));
|
||||
$this->assertEquals('+49 3581 12345678987', $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::INTERNATIONAL));
|
||||
$this->assertEquals('03581 12345678987', $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::NATIONAL));
|
||||
|
||||
|
||||
$this->assertEquals('011 49 3581 12345678987', $this->phoneUtil->formatOutOfCountryCallingNumber($phoneNumber, 'US'));
|
||||
$this->assertEquals('00 49 3581 12345678987', $this->phoneUtil->formatOutOfCountryCallingNumber($phoneNumber, 'CH'));
|
||||
}
|
||||
|
||||
public function testLongerNumber()
|
||||
{
|
||||
$number = "12345678901234567";
|
||||
$phoneNumber = $this->phoneUtil->parse($number, "DE");
|
||||
|
||||
$this->assertEquals('+4912345678901234567', $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::E164));
|
||||
$this->assertEquals('+49 12345678901234567', $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::INTERNATIONAL));
|
||||
$this->assertEquals('12345678901234567', $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::NATIONAL));
|
||||
|
||||
|
||||
$this->assertEquals('011 49 12345678901234567', $this->phoneUtil->formatOutOfCountryCallingNumber($phoneNumber, 'US'));
|
||||
$this->assertEquals('00 49 12345678901234567', $this->phoneUtil->formatOutOfCountryCallingNumber($phoneNumber, 'CH'));
|
||||
}
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use libphonenumber\RegionCode;
|
||||
|
||||
class Issue23Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
/**
|
||||
* @var PhoneNumberOfflineGeocoder|null
|
||||
*/
|
||||
private $geocoder;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
|
||||
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
|
||||
}
|
||||
|
||||
public function testTKGeoLocation()
|
||||
{
|
||||
$number = '+6903010';
|
||||
|
||||
$phoneNumber = $this->phoneUtil->parse($number, RegionCode::ZZ);
|
||||
|
||||
$this->assertEquals('TK', $this->phoneUtil->getRegionCodeForNumber($phoneNumber));
|
||||
|
||||
$this->assertEquals('Tokelau', $this->geocoder->getDescriptionForNumber($phoneNumber, 'en'));
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue34Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
public function testIsValidNumberForRegion()
|
||||
{
|
||||
$number = "+33 6 76 83 51 85";
|
||||
$region = "DE";
|
||||
$phoneNumber = $this->phoneUtil->parse($number, $region);
|
||||
|
||||
$this->assertFalse($this->phoneUtil->isValidNumberForRegion($phoneNumber, "DE"));
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue35Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
public function testSerializingPhoneNumber()
|
||||
{
|
||||
$number = "+441174900000";
|
||||
$region = "GB";
|
||||
$phoneNumber = $this->phoneUtil->parse($number, $region);
|
||||
|
||||
$serializedString = serialize($phoneNumber);
|
||||
|
||||
$phoneObject2 = unserialize($serializedString);
|
||||
|
||||
$this->assertTrue($phoneObject2->equals($phoneNumber));
|
||||
}
|
||||
|
||||
public function testSerializingPhoneNumber2()
|
||||
{
|
||||
$phoneNumber = new PhoneNumber();
|
||||
$phoneNumber->setCountryCode(1);
|
||||
$phoneNumber->setNationalNumber(1);
|
||||
$phoneNumber->setExtension(1);
|
||||
$phoneNumber->setItalianLeadingZero(1);
|
||||
$phoneNumber->setNumberOfLeadingZeros(1);
|
||||
$phoneNumber->setRawInput(1);
|
||||
$phoneNumber->setCountryCodeSource(1);
|
||||
$phoneNumber->setPreferredDomesticCarrierCode(1);
|
||||
|
||||
$serializedString = serialize($phoneNumber);
|
||||
$phoneObject2 = unserialize($serializedString);
|
||||
|
||||
$this->assertTrue($phoneObject2->equals($phoneNumber));
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue36Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberOfflineGeocoder
|
||||
*/
|
||||
private $geocoder;
|
||||
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
PhoneNumberOfflineGeocoder::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
|
||||
}
|
||||
|
||||
public function testIsleOfManLocale()
|
||||
{
|
||||
$number = "447797752305";
|
||||
|
||||
$phoneNumber = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$this->assertEquals("Jersey", $this->geocoder->getDescriptionForNumber($phoneNumber, 'en'));
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue3Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
public $phoneNumberUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
public function testParseUSNumber()
|
||||
{
|
||||
$number = $this->phoneNumberUtil->parse('011543549480042', 'US');
|
||||
|
||||
$this->assertEquals("+543549480042", $this->phoneNumberUtil->format($number, PhoneNumberFormat::E164));
|
||||
}
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
|
||||
use libphonenumber\PhoneNumberToCarrierMapper;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue44Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
/**
|
||||
* @var PhoneNumberOfflineGeocoder
|
||||
*/
|
||||
private $geocoder;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
|
||||
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
|
||||
}
|
||||
|
||||
public function testMemoryUsageOfGeoLocationWithNoResult()
|
||||
{
|
||||
$number = $this->phoneUtil->parse("86-157-9662-1289", "CN");
|
||||
|
||||
$startMemory = memory_get_usage();
|
||||
$location = $this->geocoder->getDescriptionForNumber($number, "en");
|
||||
$endMemory = memory_get_usage();
|
||||
|
||||
$this->assertEquals("China", $location);
|
||||
|
||||
$memoryUsed = $endMemory - $startMemory;
|
||||
|
||||
$this->assertLessThan(5000000, $memoryUsed, "Memory usage should be below 5MB");
|
||||
}
|
||||
|
||||
public function testMemoryUsageOfGeoLocationWithResult()
|
||||
{
|
||||
$number = $this->phoneUtil->parse("86-131-2270-1411", "CN");
|
||||
|
||||
$startMemory = memory_get_usage();
|
||||
$location = $this->geocoder->getDescriptionForNumber($number, "en");
|
||||
$endMemory = memory_get_usage();
|
||||
|
||||
$this->assertEquals("Shanghai", $location);
|
||||
|
||||
$memoryUsed = $endMemory - $startMemory;
|
||||
|
||||
$this->assertLessThan(5000000, $memoryUsed, "Memory usage should be below 5MB");
|
||||
}
|
||||
|
||||
public function testChineseGeolocation()
|
||||
{
|
||||
$number = $this->phoneUtil->parse("+86 150 3657 7264", "CN");
|
||||
$location = $this->geocoder->getDescriptionForNumber($number, "en");
|
||||
|
||||
$this->assertEquals("Luoyang, Henan", $location);
|
||||
}
|
||||
|
||||
public function testChineseCarrierLookup()
|
||||
{
|
||||
$number = $this->phoneUtil->parse("+86 150 3657 7264", "CN");
|
||||
|
||||
$carrier = PhoneNumberToCarrierMapper::getInstance();
|
||||
|
||||
$location = $carrier->getNameForNumber($number, "en");
|
||||
|
||||
$this->assertEquals("China Mobile", $location);
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue4Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
public $phoneNumberUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
public function testParseUSNumber()
|
||||
{
|
||||
$number = $this->phoneNumberUtil->parse('0351-152-303-473', 'AR');
|
||||
|
||||
$this->assertEquals("+5493512303473", $this->phoneNumberUtil->format($number, PhoneNumberFormat::E164));
|
||||
}
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use libphonenumber\ShortNumberInfo;
|
||||
|
||||
class Issue64Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testIssue64WithoutPhoneNumberUtil()
|
||||
{
|
||||
$sortNumberUtil = ShortNumberInfo::getInstance();
|
||||
$this->assertTrue($sortNumberUtil->isEmergencyNumber('999', 'GB'));
|
||||
}
|
||||
|
||||
public function testIssue64WithoutPhoneNumberUtilgetInstance()
|
||||
{
|
||||
PhoneNumberUtil::getInstance();
|
||||
|
||||
$sortNumberUtil = ShortNumberInfo::getInstance();
|
||||
$this->assertTrue($sortNumberUtil->isEmergencyNumber('999', 'GB'));
|
||||
}
|
||||
|
||||
public function testIssue64WithoutPhoneNumberUtilresetInstance()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
|
||||
$sortNumberUtil = ShortNumberInfo::getInstance();
|
||||
$this->assertTrue($sortNumberUtil->isEmergencyNumber('999', 'GB'));
|
||||
}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use libphonenumber\ShortNumberInfo;
|
||||
|
||||
class Issue68Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testShortNumberInfoIsPossibleShortNumberWithRegionMissingFromCodeSet()
|
||||
{
|
||||
$exampleNumber = $this->getExampleNumber('NE');
|
||||
|
||||
$shortNumberInfo = ShortNumberInfo::getInstance();
|
||||
|
||||
$this->assertFalse($shortNumberInfo->isPossibleShortNumber($exampleNumber));
|
||||
}
|
||||
|
||||
public function testShortNumberInfoIsPossibleShortNumberForRegionWithRegionMissingFromCodeSet()
|
||||
{
|
||||
$exampleNumber = $this->getExampleNumber('NE');
|
||||
|
||||
$shortNumberInfo = ShortNumberInfo::getInstance();
|
||||
|
||||
$this->assertFalse($shortNumberInfo->isPossibleShortNumberForRegion($exampleNumber, 'NE'));
|
||||
}
|
||||
|
||||
private function getExampleNumber($region)
|
||||
{
|
||||
$phoneUtil = PhoneNumberUtil::getInstance();
|
||||
|
||||
$exampleNumber = $phoneUtil->getExampleNumber($region);
|
||||
|
||||
// Reset PhoneNumberUtil just to make sure that doesn't interfere
|
||||
PhoneNumberUtil::resetInstance();
|
||||
|
||||
return $exampleNumber;
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class Issue76Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \libphonenumber\NumberParseException
|
||||
* @expectedExceptionCode 1
|
||||
* @expectedExceptionMessage The string supplied did not seem to be a phone number.
|
||||
*/
|
||||
public function testIssue76()
|
||||
{
|
||||
$number = 'Abc811@hotmail.com';
|
||||
$region = 'DE';
|
||||
$util = PhoneNumberUtil::getInstance();
|
||||
$util->parse($number, $region);
|
||||
}
|
||||
}
|
@@ -1,313 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author joshuag
|
||||
* @created: 14/08/2014 12:35
|
||||
* @project libphonenumber-for-php
|
||||
*/
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\CountryCodeToRegionCodeMap;
|
||||
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
|
||||
use libphonenumber\PhoneNumberType;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class LocaleTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberOfflineGeocoder
|
||||
*/
|
||||
private $geocoder;
|
||||
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
PhoneNumberOfflineGeocoder::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider localeList
|
||||
* @param string $regionCode
|
||||
* @param string $countryName
|
||||
*/
|
||||
public function testLocales($regionCode, $countryName)
|
||||
{
|
||||
if (!in_array($regionCode, $this->phoneUtil->getSupportedRegions())) {
|
||||
$this->markTestSkipped("{$regionCode} is not supported");
|
||||
}
|
||||
|
||||
$phoneNumber = $this->phoneUtil->getExampleNumberForType($regionCode, PhoneNumberType::FIXED_LINE_OR_MOBILE);
|
||||
|
||||
$this->assertContains($regionCode, CountryCodeToRegionCodeMap::$countryCodeToRegionCodeMap[$phoneNumber->getCountryCode()]);
|
||||
|
||||
$this->assertEquals($regionCode, $this->phoneUtil->getRegionCodeForNumber($phoneNumber));
|
||||
|
||||
$this->assertEquals($countryName, $this->geocoder->getDescriptionForValidNumber($phoneNumber, 'en', 'ZZ'), "Checking {$phoneNumber} is part of {$countryName}");
|
||||
}
|
||||
|
||||
public function localeList()
|
||||
{
|
||||
$codes = $this->getCountryCodes();
|
||||
|
||||
$return = array();
|
||||
foreach ($codes as $code => $country) {
|
||||
$return[] = array($code, $country);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This list was got from the Internet, and altered slightly to make the tests pass
|
||||
*
|
||||
* @see https://gist.github.com/vxnick/380904
|
||||
* @return array
|
||||
*/
|
||||
private function getCountryCodes()
|
||||
{
|
||||
return array(
|
||||
'AF' => 'Afghanistan',
|
||||
'AX' => 'Åland Islands',
|
||||
'AL' => 'Albania',
|
||||
'DZ' => 'Algeria',
|
||||
'AS' => 'American Samoa',
|
||||
'AD' => 'Andorra',
|
||||
'AO' => 'Angola',
|
||||
'AI' => 'Anguilla',
|
||||
'AG' => 'Antigua & Barbuda',
|
||||
'AR' => 'Argentina',
|
||||
'AU' => 'Australia',
|
||||
'AT' => 'Austria',
|
||||
'AZ' => 'Azerbaijan',
|
||||
'BS' => 'Bahamas',
|
||||
'BH' => 'Bahrain',
|
||||
'BD' => 'Bangladesh',
|
||||
'BB' => 'Barbados',
|
||||
'BY' => 'Belarus',
|
||||
'BE' => 'Belgium',
|
||||
'BZ' => 'Belize',
|
||||
'BJ' => 'Benin',
|
||||
'BM' => 'Bermuda',
|
||||
'BT' => 'Bhutan',
|
||||
'BO' => 'Bolivia',
|
||||
'BA' => 'Bosnia & Herzegovina',
|
||||
'BW' => 'Botswana',
|
||||
'BR' => 'Brazil',
|
||||
'IO' => 'British Indian Ocean Territory',
|
||||
'BN' => 'Brunei',
|
||||
'BG' => 'Bulgaria',
|
||||
'BF' => 'Burkina Faso',
|
||||
'BI' => 'Burundi',
|
||||
'KH' => 'Cambodia',
|
||||
'CM' => 'Cameroon',
|
||||
'CA' => 'Canada',
|
||||
'CV' => 'Cape Verde',
|
||||
'KY' => 'Cayman Islands',
|
||||
'CF' => 'Central African Republic',
|
||||
'TD' => 'Chad',
|
||||
'CL' => 'Chile',
|
||||
'CN' => 'China',
|
||||
'CX' => 'Christmas Island',
|
||||
'CC' => 'Cocos (Keeling) Islands',
|
||||
'CO' => 'Colombia',
|
||||
'KM' => 'Comoros',
|
||||
'CG' => 'Congo - Brazzaville',
|
||||
'CD' => 'Congo - Kinshasa',
|
||||
'CK' => 'Cook Islands',
|
||||
'CR' => 'Costa Rica',
|
||||
'CI' => 'Côte d’Ivoire',
|
||||
'HR' => 'Croatia',
|
||||
'CU' => 'Cuba',
|
||||
'CY' => 'Cyprus',
|
||||
'CZ' => 'Czech Republic',
|
||||
'DK' => 'Denmark',
|
||||
'DJ' => 'Djibouti',
|
||||
'DM' => 'Dominica',
|
||||
'DO' => 'Dominican Republic',
|
||||
'EC' => 'Ecuador',
|
||||
'EG' => 'Egypt',
|
||||
'SV' => 'El Salvador',
|
||||
'GQ' => 'Equatorial Guinea',
|
||||
'ER' => 'Eritrea',
|
||||
'EE' => 'Estonia',
|
||||
'ET' => 'Ethiopia',
|
||||
'FK' => 'Falkland Islands',
|
||||
'FO' => 'Faroe Islands',
|
||||
'FJ' => 'Fiji',
|
||||
'FI' => 'Finland',
|
||||
'FR' => 'France',
|
||||
'GF' => 'French Guiana',
|
||||
'PF' => 'French Polynesia',
|
||||
'GA' => 'Gabon',
|
||||
'GM' => 'Gambia',
|
||||
'GE' => 'Georgia',
|
||||
'DE' => 'Germany',
|
||||
'GH' => 'Ghana',
|
||||
'GI' => 'Gibraltar',
|
||||
'GR' => 'Greece',
|
||||
'GL' => 'Greenland',
|
||||
'GD' => 'Grenada',
|
||||
'GP' => 'Guadeloupe',
|
||||
'GU' => 'Guam',
|
||||
'GT' => 'Guatemala',
|
||||
'GG' => 'Guernsey',
|
||||
'GN' => 'Guinea',
|
||||
'GW' => 'Guinea-Bissau',
|
||||
'GY' => 'Guyana',
|
||||
'HT' => 'Haiti',
|
||||
'HN' => 'Honduras',
|
||||
'HK' => 'Hong Kong SAR China',
|
||||
'HU' => 'Hungary',
|
||||
'IS' => 'Iceland',
|
||||
'IN' => 'India',
|
||||
'ID' => 'Indonesia',
|
||||
'IR' => 'Iran',
|
||||
'IQ' => 'Iraq',
|
||||
'IE' => 'Ireland',
|
||||
'IM' => 'Isle of Man',
|
||||
'IL' => 'Israel',
|
||||
'IT' => 'Italy',
|
||||
'JM' => 'Jamaica',
|
||||
'JP' => 'Japan',
|
||||
'JE' => 'Jersey',
|
||||
'JO' => 'Jordan',
|
||||
'KZ' => 'Kazakhstan',
|
||||
'KE' => 'Kenya',
|
||||
'KI' => 'Kiribati',
|
||||
'KP' => 'North Korea',
|
||||
'KR' => 'South Korea',
|
||||
'KW' => 'Kuwait',
|
||||
'KG' => 'Kyrgyzstan',
|
||||
'LA' => 'Laos',
|
||||
'LV' => 'Latvia',
|
||||
'LB' => 'Lebanon',
|
||||
'LS' => 'Lesotho',
|
||||
'LR' => 'Liberia',
|
||||
'LY' => 'Libya',
|
||||
'LI' => 'Liechtenstein',
|
||||
'LT' => 'Lithuania',
|
||||
'LU' => 'Luxembourg',
|
||||
'MO' => 'Macau SAR China',
|
||||
'MK' => 'Macedonia',
|
||||
'MG' => 'Madagascar',
|
||||
'MW' => 'Malawi',
|
||||
'MY' => 'Malaysia',
|
||||
'MV' => 'Maldives',
|
||||
'ML' => 'Mali',
|
||||
'MT' => 'Malta',
|
||||
'MH' => 'Marshall Islands',
|
||||
'MQ' => 'Martinique',
|
||||
'MR' => 'Mauritania',
|
||||
'MU' => 'Mauritius',
|
||||
'YT' => 'Mayotte',
|
||||
'MX' => 'Mexico',
|
||||
'FM' => 'Micronesia',
|
||||
'MD' => 'Moldova',
|
||||
'MC' => 'Monaco',
|
||||
'MN' => 'Mongolia',
|
||||
'ME' => 'Montenegro',
|
||||
'MS' => 'Montserrat',
|
||||
'MA' => 'Morocco',
|
||||
'MZ' => 'Mozambique',
|
||||
'MM' => 'Myanmar (Burma)',
|
||||
'NA' => 'Namibia',
|
||||
'NR' => 'Nauru',
|
||||
'NP' => 'Nepal',
|
||||
'NL' => 'Netherlands',
|
||||
'NC' => 'New Caledonia',
|
||||
'NZ' => 'New Zealand',
|
||||
'NI' => 'Nicaragua',
|
||||
'NE' => 'Niger',
|
||||
'NG' => 'Nigeria',
|
||||
'NU' => 'Niue',
|
||||
'NF' => 'Norfolk Island',
|
||||
'MP' => 'Northern Mariana Islands',
|
||||
'NO' => 'Norway',
|
||||
'OM' => 'Oman',
|
||||
'PK' => 'Pakistan',
|
||||
'PW' => 'Palau',
|
||||
'PS' => 'Palestinian Territories',
|
||||
'PA' => 'Panama',
|
||||
'PG' => 'Papua New Guinea',
|
||||
'PY' => 'Paraguay',
|
||||
'PE' => 'Peru',
|
||||
'PH' => 'Philippines',
|
||||
'PL' => 'Poland',
|
||||
'PT' => 'Portugal',
|
||||
'PR' => 'Puerto Rico',
|
||||
'QA' => 'Qatar',
|
||||
'RE' => 'Réunion',
|
||||
'RO' => 'Romania',
|
||||
'RU' => 'Russia',
|
||||
'RW' => 'Rwanda',
|
||||
'SH' => 'St. Helena',
|
||||
'KN' => 'St. Kitts & Nevis',
|
||||
'LC' => 'St. Lucia',
|
||||
'PM' => 'St. Pierre & Miquelon',
|
||||
'VC' => 'St. Vincent & Grenadines',
|
||||
'WS' => 'Samoa',
|
||||
'SM' => 'San Marino',
|
||||
'ST' => 'São Tomé & Príncipe',
|
||||
'SA' => 'Saudi Arabia',
|
||||
'SN' => 'Senegal',
|
||||
'RS' => 'Serbia',
|
||||
'SC' => 'Seychelles',
|
||||
'SL' => 'Sierra Leone',
|
||||
'SG' => 'Singapore',
|
||||
'SK' => 'Slovakia',
|
||||
'SI' => 'Slovenia',
|
||||
'SB' => 'Solomon Islands',
|
||||
'SO' => 'Somalia',
|
||||
'ZA' => 'South Africa',
|
||||
'ES' => 'Spain',
|
||||
'LK' => 'Sri Lanka',
|
||||
'SD' => 'Sudan',
|
||||
'SR' => 'Suriname',
|
||||
'SJ' => 'Svalbard & Jan Mayen',
|
||||
'SZ' => 'Swaziland',
|
||||
'SE' => 'Sweden',
|
||||
'CH' => 'Switzerland',
|
||||
'SY' => 'Syria',
|
||||
'TW' => 'Taiwan',
|
||||
'TJ' => 'Tajikistan',
|
||||
'TZ' => 'Tanzania',
|
||||
'TH' => 'Thailand',
|
||||
'TL' => 'Timor-Leste',
|
||||
'TG' => 'Togo',
|
||||
'TK' => 'Tokelau',
|
||||
'TO' => 'Tonga',
|
||||
'TT' => 'Trinidad & Tobago',
|
||||
'TN' => 'Tunisia',
|
||||
'TR' => 'Turkey',
|
||||
'TM' => 'Turkmenistan',
|
||||
'TC' => 'Turks & Caicos Islands',
|
||||
'TV' => 'Tuvalu',
|
||||
'UG' => 'Uganda',
|
||||
'UA' => 'Ukraine',
|
||||
'AE' => 'United Arab Emirates',
|
||||
'GB' => 'United Kingdom',
|
||||
'US' => 'United States',
|
||||
'UY' => 'Uruguay',
|
||||
'UZ' => 'Uzbekistan',
|
||||
'VU' => 'Vanuatu',
|
||||
'VE' => 'Venezuela',
|
||||
'VN' => 'Vietnam',
|
||||
'VG' => 'British Virgin Islands',
|
||||
'VI' => 'U.S. Virgin Islands',
|
||||
'WF' => 'Wallis & Futuna',
|
||||
'EH' => 'Western Sahara',
|
||||
'YE' => 'Yemen',
|
||||
'ZM' => 'Zambia',
|
||||
'ZW' => 'Zimbabwe',
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class PHP7Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $number
|
||||
* @dataProvider validPolishNumbers
|
||||
*/
|
||||
public function testValidPolishNumbers($number)
|
||||
{
|
||||
$phoneNumber = $this->phoneUtil->parse($number, 'PL');
|
||||
|
||||
$this->assertTrue($this->phoneUtil->isValidNumber($phoneNumber));
|
||||
$this->assertEquals($number, $this->phoneUtil->format($phoneNumber, PhoneNumberFormat::NATIONAL));
|
||||
}
|
||||
|
||||
public function validPolishNumbers()
|
||||
{
|
||||
return array(
|
||||
array('22 222 22 22'),
|
||||
array('33 222 22 22'),
|
||||
array('46 222 22 22'),
|
||||
array('61 222 22 22'),
|
||||
array('62 222 22 22'),
|
||||
array('642 222 222'),
|
||||
array('65 222 22 22'),
|
||||
array('512 345 678'),
|
||||
array('800 123 456'),
|
||||
array('700 000 000'),
|
||||
array('801 234 567'),
|
||||
array('91 000 00 00'),
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,188 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\Issues;
|
||||
|
||||
use libphonenumber\CountryCodeToRegionCodeMap;
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
use libphonenumber\PhoneNumberType;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class UKNumbersTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
const META_DATA_FILE_PREFIX = 'PhoneNumberMetadata';
|
||||
/**
|
||||
* @var \libphonenumber\PhoneNumberUtil
|
||||
*/
|
||||
protected $phoneUtil;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance(
|
||||
self::META_DATA_FILE_PREFIX,
|
||||
CountryCodeToRegionCodeMap::$countryCodeToRegionCodeMap
|
||||
);
|
||||
;
|
||||
}
|
||||
|
||||
public function testMobileNumber()
|
||||
{
|
||||
$number = '07987458147';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(PhoneNumberType::MOBILE, $type, "Checking phone number is detected as mobile");
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+447987458147", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("07987 458147", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testFixedLine()
|
||||
{
|
||||
$number = '01234512345';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(PhoneNumberType::FIXED_LINE, $type, "Checking phone number is detected as fixed line");
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+441234512345", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("01234 512345", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testSharedCost()
|
||||
{
|
||||
$number = '08451234568';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(PhoneNumberType::SHARED_COST, $type, "Checking phone number is detected as shared cost");
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+448451234568", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("0845 123 4568", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testPersonalNumber()
|
||||
{
|
||||
$number = '07010020249';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(
|
||||
PhoneNumberType::PERSONAL_NUMBER,
|
||||
$type,
|
||||
"Checking phone number is detected as a personal number"
|
||||
);
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+447010020249", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("070 1002 0249", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testUAN()
|
||||
{
|
||||
$number = '03335555555';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(PhoneNumberType::UAN, $type, "Checking phone number is detected as UAN");
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+443335555555", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("0333 555 5555", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testTollFree()
|
||||
{
|
||||
$number = '0800800150';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(PhoneNumberType::TOLL_FREE, $type, "Checking phone number is detected as TOLL FREE");
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+44800800150", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("0800 800150", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testPremium()
|
||||
{
|
||||
$number = '09063020288';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(PhoneNumberType::PREMIUM_RATE, $type, "Checking phone number is detected as PREMIUM RATE");
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+449063020288", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("0906 302 0288", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testChildLine()
|
||||
{
|
||||
$number = '08001111';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertTrue($valid, "Checking phone number is valid");
|
||||
|
||||
$type = $this->phoneUtil->getNumberType($phoneObject);
|
||||
$this->assertEquals(
|
||||
PhoneNumberType::TOLL_FREE,
|
||||
$type,
|
||||
"Checking phone number is detected as TOLL FREE"
|
||||
);
|
||||
|
||||
$formattedE164 = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::E164);
|
||||
$this->assertEquals("+448001111", $formattedE164, "Checking E164 format is correct");
|
||||
|
||||
$formattedNational = $this->phoneUtil->format($phoneObject, PhoneNumberFormat::NATIONAL);
|
||||
$this->assertEquals("0800 1111", $formattedNational, "Checking National format is correct");
|
||||
}
|
||||
|
||||
public function testInvalidNumber()
|
||||
{
|
||||
$number = '123401234512345';
|
||||
$phoneObject = $this->phoneUtil->parse($number, 'GB');
|
||||
|
||||
$valid = $this->phoneUtil->isValidNumber($phoneObject);
|
||||
$this->assertFalse($valid, "Checking phone number is invalid");
|
||||
}
|
||||
}
|
@@ -1,915 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @author giggsey
|
||||
* @package libphonenumber-for-php
|
||||
*/
|
||||
|
||||
namespace libphonenumber\Tests\buildtools;
|
||||
|
||||
use libphonenumber\buildtools\BuildMetadataFromXml;
|
||||
use libphonenumber\NumberFormat;
|
||||
use libphonenumber\PhoneMetadata;
|
||||
use libphonenumber\PhoneNumberDesc;
|
||||
|
||||
class BuildMetadataFromXmlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param $xmlString
|
||||
* @return \DOMElement
|
||||
*/
|
||||
private function parseXMLString($xmlString)
|
||||
{
|
||||
$domDocument = new \DOMDocument();
|
||||
$domDocument->loadXML($xmlString);
|
||||
|
||||
return $domDocument->documentElement;
|
||||
}
|
||||
|
||||
public function testValidateRERemovesWhiteSpaces()
|
||||
{
|
||||
$input = " hello world ";
|
||||
// Should remove all the white spaces contained in the provided string.
|
||||
$this->assertEquals("helloworld", BuildMetadataFromXml::validateRE($input, true));
|
||||
// Make sure it only happens when the last parameter is set to true.
|
||||
$this->assertEquals(" hello world ", BuildMetadataFromXml::validateRE($input, false));
|
||||
}
|
||||
|
||||
public function testValidateREThrowsException()
|
||||
{
|
||||
$invalidPattern = '[';
|
||||
// Should throw an exception when an invalid pattern is provided independently of the last
|
||||
// parameter (remove white spaces).
|
||||
try {
|
||||
BuildMetadataFromXml::validateRE($invalidPattern, false);
|
||||
$this->fail();
|
||||
} catch (\Exception $e) {
|
||||
// Test passed.
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
try {
|
||||
BuildMetadataFromXml::validateRE($invalidPattern, true);
|
||||
$this->fail();
|
||||
} catch (\Exception $e) {
|
||||
// Test passed.
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
// We don't allow | to be followed by ) because it introduces bugs, since we typically use it at
|
||||
// the end of each line and when a line is deleted, if the pipe from the previous line is not
|
||||
// removed, we end up erroneously accepting an empty group as well.
|
||||
$patternWithPipeFollowedByClosingParentheses = '|)';
|
||||
try {
|
||||
BuildMetadataFromXml::validateRE($patternWithPipeFollowedByClosingParentheses, true);
|
||||
$this->fail();
|
||||
} catch (\Exception $e) {
|
||||
// Test passed.
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
$patternWithPipeFollowedByNewLineAndClosingParentheses = "|\n)";
|
||||
try {
|
||||
BuildMetadataFromXml::validateRE($patternWithPipeFollowedByNewLineAndClosingParentheses, true);
|
||||
$this->fail();
|
||||
} catch (\Exception $e) {
|
||||
// Test passed.
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
}
|
||||
|
||||
public function testValidateRE()
|
||||
{
|
||||
$validPattern = "[a-zA-Z]d{1,9}";
|
||||
// The provided pattern should be left unchanged.
|
||||
$this->assertEquals($validPattern, BuildMetadataFromXml::validateRE($validPattern, false));
|
||||
}
|
||||
|
||||
public function testGetNationalPrefix()
|
||||
{
|
||||
$xmlInput = "<territory nationalPrefix='00'/>";
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$this->assertEquals('00', BuildMetadataFromXml::getNationalPrefix($territoryElement));
|
||||
}
|
||||
|
||||
public function testLoadTerritoryTagMetadata()
|
||||
{
|
||||
$xmlInput = "<territory"
|
||||
. " countryCode='33' leadingDigits='2' internationalPrefix='00'"
|
||||
. " preferredInternationalPrefix='0011' nationalPrefixForParsing='0'"
|
||||
. " nationalPrefixTransformRule='9$1'" // nationalPrefix manually injected.
|
||||
. " preferredExtnPrefix=' x' mainCountryForCode='true'"
|
||||
. " leadingZeroPossible='true' mobileNumberPortableRegion='true'>"
|
||||
. "</territory>";
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$phoneMetadata = BuildMetadataFromXml::loadTerritoryTagMetadata('33', $territoryElement, '0');
|
||||
$this->assertEquals(33, $phoneMetadata->getCountryCode());
|
||||
$this->assertEquals("2", $phoneMetadata->getLeadingDigits());
|
||||
$this->assertEquals("00", $phoneMetadata->getInternationalPrefix());
|
||||
$this->assertEquals("0011", $phoneMetadata->getPreferredInternationalPrefix());
|
||||
$this->assertEquals("0", $phoneMetadata->getNationalPrefixForParsing());
|
||||
$this->assertEquals("9$1", $phoneMetadata->getNationalPrefixTransformRule());
|
||||
$this->assertEquals("0", $phoneMetadata->getNationalPrefix());
|
||||
$this->assertEquals(" x", $phoneMetadata->getPreferredExtnPrefix());
|
||||
$this->assertTrue($phoneMetadata->isMainCountryForCode());
|
||||
$this->assertTrue($phoneMetadata->isLeadingZeroPossible());
|
||||
$this->assertTrue($phoneMetadata->isMobileNumberPortableRegion());
|
||||
}
|
||||
|
||||
public function testLoadTerritoryTagMetadataSetsBooleanFieldsToFalseByDefault()
|
||||
{
|
||||
$xmlInput = "<territory countryCode='33'/>";
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$phoneMetadata = BuildMetadataFromXml::loadTerritoryTagMetadata('33', $territoryElement, '');
|
||||
$this->assertFalse($phoneMetadata->isMainCountryForCode());
|
||||
$this->assertFalse($phoneMetadata->isLeadingZeroPossible());
|
||||
$this->assertFalse($phoneMetadata->isMobileNumberPortableRegion());
|
||||
}
|
||||
|
||||
public function testLoadTerritoryTagMetadataSetsNationalPrefixForParsingByDefault()
|
||||
{
|
||||
$xmlInput = "<territory countryCode='33'/>";
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$phoneMetadata = BuildMetadataFromXml::loadTerritoryTagMetadata('33', $territoryElement, '00');
|
||||
// When unspecified, nationalPrefixForParsing defaults to nationalPrefix.
|
||||
$this->assertEquals("00", $phoneMetadata->getNationalPrefix());
|
||||
$this->assertEquals($phoneMetadata->getNationalPrefix(), $phoneMetadata->getNationalPrefixForParsing());
|
||||
}
|
||||
|
||||
public function testLoadTerritoryTagMetadataWithRequiredAttributesOnly()
|
||||
{
|
||||
$xmlInput = "<territory countryCode='33' internationalPrefix='00'/>";
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
// Should not throw any exception
|
||||
BuildMetadataFromXml::loadTerritoryTagMetadata('33', $territoryElement, '');
|
||||
}
|
||||
|
||||
public function testLoadInternationalFormat()
|
||||
{
|
||||
$intlFormat = '$1 $2';
|
||||
$xmlInput = "<numberFormat><intlFormat>" . $intlFormat . "</intlFormat></numberFormat>";
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$nationalFormat = new NumberFormat();
|
||||
|
||||
$this->assertTrue(BuildMetadataFromXml::loadInternationalFormat($metadata, $numberFormatElement, $nationalFormat));
|
||||
$this->assertEquals($intlFormat, $metadata->getIntlNumberFormat(0)->getFormat());
|
||||
}
|
||||
|
||||
public function testLoadInternationalFormatWithBothNationalAndIntlFormatsDefined()
|
||||
{
|
||||
$intlFormat = '$1 $2';
|
||||
$xmlInput = "<numberFormat><intlFormat>" . $intlFormat . "</intlFormat></numberFormat>";
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$nationalFormat = new NumberFormat();
|
||||
$nationalFormat->setFormat('$1');
|
||||
|
||||
$this->assertTrue(BuildMetadataFromXml::loadInternationalFormat($metadata, $numberFormatElement, $nationalFormat));
|
||||
$this->assertEquals($intlFormat, $metadata->getIntlNumberFormat(0)->getFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testLoadInternationalFormatExpectsOnlyOnePattern()
|
||||
{
|
||||
$xmlInput = '<numberFormat><intlFormat/><intlFormat/></numberFormat>';
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
|
||||
// Should throw an exception as multiple intlFormats are provided
|
||||
BuildMetadataFromXml::loadInternationalFormat($metadata, $numberFormatElement, new NumberFormat());
|
||||
}
|
||||
|
||||
public function testLoadInternationalFormatUsesNationalFormatByDefault()
|
||||
{
|
||||
$xmlInput = '<numberFormat></numberFormat>';
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$nationalFormat = new NumberFormat();
|
||||
$nationPattern = '$1 $2 $3';
|
||||
$nationalFormat->setFormat($nationPattern);
|
||||
|
||||
$this->assertFalse(BuildMetadataFromXml::loadInternationalFormat($metadata, $numberFormatElement, $nationalFormat));
|
||||
$this->assertEquals($nationPattern, $metadata->getIntlNumberFormat(0)->getFormat());
|
||||
}
|
||||
|
||||
public function testLoadInternationalFormatCopiesNationalFormatData()
|
||||
{
|
||||
$xmlInput = '<numberFormat></numberFormat>';
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$nationalFormat = new NumberFormat();
|
||||
$nationalFormat->setFormat('$1-$2');
|
||||
$nationalFormat->setNationalPrefixOptionalWhenFormatting(true);
|
||||
|
||||
$this->assertFalse(BuildMetadataFromXml::loadInternationalFormat($metadata, $numberFormatElement, $nationalFormat));
|
||||
$this->assertTrue($metadata->getIntlNumberFormat(0)->isNationalPrefixOptionalWhenFormatting());
|
||||
}
|
||||
|
||||
public function testLoadNationalFormat()
|
||||
{
|
||||
$nationalFormat = '$1 $2';
|
||||
$xmlInput = '<numberFormat><format>' . $nationalFormat . '</format></numberFormat>';
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$numberFormat = new NumberFormat();
|
||||
BuildMetadataFromXml::loadNationalFormat($metadata, $numberFormatElement, $numberFormat);
|
||||
$this->assertEquals($nationalFormat, $numberFormat->getFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testLoadNationalFormatRequiresFormat()
|
||||
{
|
||||
$xmlInput = '<numberFormat></numberFormat>';
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$numberFormat = new NumberFormat();
|
||||
|
||||
BuildMetadataFromXml::loadNationalFormat($metadata, $numberFormatElement, $numberFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testLoadNationalFormatExpectsExactlyOneFormat()
|
||||
{
|
||||
$xmlInput = "<numberFormat><format/><format/></numberFormat>";
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$numberFormat = new NumberFormat();
|
||||
|
||||
BuildMetadataFromXml::loadNationalFormat($metadata, $numberFormatElement, $numberFormat);
|
||||
}
|
||||
|
||||
public function testLoadAvailableFormats()
|
||||
{
|
||||
$xmlInput = '<territory>'
|
||||
. ' <availableFormats>'
|
||||
. ' <numberFormat nationalPrefixFormattingRule=\'($FG)\''
|
||||
. ' carrierCodeFormattingRule=\'$NP $CC ($FG)\'>'
|
||||
. ' <format>$1 $2 $3</format>'
|
||||
. ' </numberFormat>'
|
||||
. ' </availableFormats>'
|
||||
. '</territory>';
|
||||
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::loadAvailableFormats($metadata, $element, '0', '', false /* NP not optional */);
|
||||
$this->assertEquals('($1)', $metadata->getNumberFormat(0)->getNationalPrefixFormattingRule());
|
||||
$this->assertEquals('0 $CC ($1)', $metadata->getNumberFormat(0)->getDomesticCarrierCodeFormattingRule());
|
||||
$this->assertEquals('$1 $2 $3', $metadata->getNumberFormat(0)->getFormat());
|
||||
}
|
||||
|
||||
public function testLoadAvailableFormatsPropagatesCarrierCodeFormattingRule()
|
||||
{
|
||||
$xmlInput =
|
||||
'<territory carrierCodeFormattingRule=\'$NP $CC ($FG)\'>'
|
||||
. ' <availableFormats>'
|
||||
. ' <numberFormat nationalPrefixFormattingRule=\'($FG)\'>'
|
||||
. ' <format>$1 $2 $3</format>'
|
||||
. ' </numberFormat>'
|
||||
. ' </availableFormats>'
|
||||
. '</territory>';
|
||||
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::loadAvailableFormats($metadata, $element, '0', '', false /* NP not optional */);
|
||||
$this->assertEquals('($1)', $metadata->getNumberFormat(0)->getNationalPrefixFormattingRule());
|
||||
$this->assertEquals('0 $CC ($1)', $metadata->getNumberFormat(0)->getDomesticCarrierCodeFormattingRule());
|
||||
$this->assertEquals('$1 $2 $3', $metadata->getNumberFormat(0)->getFormat());
|
||||
}
|
||||
|
||||
public function testLoadAvailableFormatsSetsProvidedNationalPrefixFormattingRule()
|
||||
{
|
||||
$xmlInput = "<territory>"
|
||||
. " <availableFormats>"
|
||||
. ' <numberFormat><format>$1 $2 $3</format></numberFormat>'
|
||||
. " </availableFormats>"
|
||||
. "</territory>";
|
||||
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::loadAvailableFormats($metadata, $element, '', '($1)', false /* NP not optional */);
|
||||
$this->assertEquals('($1)', $metadata->getNumberFormat(0)->getNationalPrefixFormattingRule());
|
||||
}
|
||||
|
||||
public function testLoadAvailableFormatsClearsIntlFormat()
|
||||
{
|
||||
$xmlInput = "<territory>"
|
||||
. " <availableFormats>"
|
||||
. ' <numberFormat><format>$1 $2 $3</format></numberFormat>'
|
||||
. " </availableFormats>"
|
||||
. "</territory>";
|
||||
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::loadAvailableFormats($metadata, $element, '0', '($1)', false /* NP not optional */);
|
||||
$this->assertCount(0, $metadata->intlNumberFormats());
|
||||
}
|
||||
|
||||
public function testLoadAvailableFormatsHandlesMultipleNumberFormats()
|
||||
{
|
||||
$xmlInput = "<territory>"
|
||||
. " <availableFormats>"
|
||||
. ' <numberFormat><format>$1 $2 $3</format></numberFormat>'
|
||||
. ' <numberFormat><format>$1-$2</format></numberFormat>'
|
||||
. " </availableFormats>"
|
||||
. "</territory>";
|
||||
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::loadAvailableFormats($metadata, $element, '0', '($1)', false /* NP not optional */);
|
||||
$this->assertEquals('$1 $2 $3', $metadata->getNumberFormat(0)->getFormat());
|
||||
$this->assertEquals('$1-$2', $metadata->getNumberFormat(1)->getFormat());
|
||||
}
|
||||
|
||||
public function testLoadInternationalFormatDoesNotSetIntlFormatWhenNA()
|
||||
{
|
||||
$xmlInput = '<numberFormat><intlFormat>NA</intlFormat></numberFormat>';
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
$nationalFormat = new NumberFormat();
|
||||
$nationalFormat->setFormat('$1 $2');
|
||||
|
||||
BuildMetadataFromXml::loadInternationalFormat($metadata, $numberFormatElement, $nationalFormat);
|
||||
$this->assertCount(0, $metadata->intlNumberFormats());
|
||||
}
|
||||
|
||||
public function testSetLeadingDigitsPatterns()
|
||||
{
|
||||
$xmlInput = "<numberFormat>"
|
||||
. "<leadingDigits>1</leadingDigits><leadingDigits>2</leadingDigits>"
|
||||
. "</numberFormat>";
|
||||
|
||||
$numberFormatElement = $this->parseXMLString($xmlInput);
|
||||
$numberFormat = new NumberFormat();
|
||||
BuildMetadataFromXml::setLeadingDigitsPatterns($numberFormatElement, $numberFormat);
|
||||
|
||||
$this->assertEquals('1', $numberFormat->getLeadingDigitsPattern(0));
|
||||
$this->assertEquals('2', $numberFormat->getLeadingDigitsPattern(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests setLeadingDigitsPatterns() in the case of international and national formatting rules
|
||||
* being present but not both defined for this numberFormat - we don't want to add them twice.
|
||||
*/
|
||||
public function testSetLeadingDigitsPatternsNotAddedTwiceWhenInternationalFormatsPresent()
|
||||
{
|
||||
$xmlInput = "<availableFormats>"
|
||||
. " <numberFormat pattern=\"(1)(\\d{3})\">"
|
||||
. " <leadingDigits>1</leadingDigits>"
|
||||
. ' <format>$1</format>'
|
||||
. " </numberFormat>"
|
||||
. " <numberFormat pattern=\"(2)(\\d{3})\">"
|
||||
. " <leadingDigits>2</leadingDigits>"
|
||||
. ' <format>$1</format>'
|
||||
. ' <intlFormat>9-$1</intlFormat>'
|
||||
. " </numberFormat>"
|
||||
. "</availableFormats>";
|
||||
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::loadAvailableFormats($metadata, $element, '0', '', false /* NP not optional */);
|
||||
$this->assertCount(1, $metadata->getNumberFormat(0)->leadingDigitPatterns());
|
||||
$this->assertCount(1, $metadata->getNumberFormat(1)->leadingDigitPatterns());
|
||||
// When we merge the national format rules into the international format rules, we shouldn't add
|
||||
// the leading digit patterns multiple times.
|
||||
$this->assertCount(1, $metadata->getIntlNumberFormat(0)->leadingDigitPatterns());
|
||||
$this->assertCount(1, $metadata->getIntlNumberFormat(1)->leadingDigitPatterns());
|
||||
}
|
||||
|
||||
public function testGetNationalPrefixFormattingRuleFromElement()
|
||||
{
|
||||
$xmlInput = '<territory nationalPrefixFormattingRule="$NP$FG" />';
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$this->assertEquals('0$1', BuildMetadataFromXml::getNationalPrefixFormattingRuleFromElement($element, '0'));
|
||||
}
|
||||
|
||||
public function testGetDomesticCarrierCodeFormattingRuleFromElement()
|
||||
{
|
||||
$xmlInput = '<territory carrierCodeFormattingRule=\'$NP$CC $FG\'/>';
|
||||
$element = $this->parseXMLString($xmlInput);
|
||||
$this->assertEquals('0$CC $1', BuildMetadataFromXml::getDomesticCarrierCodeFormattingRuleFromElement($element, '0'));
|
||||
}
|
||||
|
||||
public function testIsValidNumberTypeWithInvalidInput()
|
||||
{
|
||||
$this->assertFalse(BuildMetadataFromXml::numberTypeShouldAlwaysBeFilledIn('invalidType'));
|
||||
$this->assertFalse(BuildMetadataFromXml::numberTypeShouldAlwaysBeFilledIn('tollFree'));
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescElementWithInvalidInputWithRegex()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$territoryElement = $this->parseXMLString("<territory/>");
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'invalidType', false);
|
||||
$this->assertEquals('NA', $phoneNumberDesc->getPossibleNumberPattern());
|
||||
$this->assertEquals('NA', $phoneNumberDesc->getNationalNumberPattern());
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescElementMergesWithGeneralDesc()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleNumberPattern('\\d{6}');
|
||||
$territoryElement = $this->parseXMLString('<territory><fixedLine/></territory>');
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false);
|
||||
$this->assertEquals('\\d{6}', $phoneNumberDesc->getPossibleNumberPattern());
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescElementOverridesGeneralDesc()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleNumberPattern('\\d{8');
|
||||
$xmlInput = "<territory><fixedLine>"
|
||||
. " <possibleNumberPattern>\\d{6}</possibleNumberPattern>"
|
||||
. "</fixedLine></territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false);
|
||||
$this->assertEquals('\\d{6}', $phoneNumberDesc->getPossibleNumberPattern());
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescElementHandlesLiteBuild()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$xmlInput = "<territory><fixedLine>"
|
||||
. " <exampleNumber>01 01 01 01</exampleNumber>"
|
||||
. "</fixedLine></territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', true);
|
||||
$this->assertEquals('', $phoneNumberDesc->getExampleNumber());
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescOutputsExampleNumberByDefault()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$xmlInput = "<territory><fixedLine>"
|
||||
. " <exampleNumber>01 01 01 01</exampleNumber>"
|
||||
. "</fixedLine></territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false);
|
||||
$this->assertEquals('01 01 01 01', $phoneNumberDesc->getExampleNumber());
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescRemovesWhiteSpacesInPatterns()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$xmlInput = "<territory><fixedLine>"
|
||||
. " <possibleNumberPattern>\t \\d { 6 } </possibleNumberPattern>"
|
||||
. "</fixedLine></territory>";
|
||||
|
||||
$countryElement = $this->parseXMLString($xmlInput);
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $countryElement, 'fixedLine', false);
|
||||
$this->assertEquals('\\d{6}', $phoneNumberDesc->getPossibleNumberPattern());
|
||||
}
|
||||
|
||||
public function testSetRelevantDescPatternsSetsSameMobileAndFixedLinePattern()
|
||||
{
|
||||
$xmlInput = "<territory countryCode=\"33\">"
|
||||
. " <fixedLine><nationalNumberPattern>\\d{6}</nationalNumberPattern></fixedLine>"
|
||||
. " <mobile><nationalNumberPattern>\\d{6}</nationalNumberPattern></mobile>"
|
||||
. "</territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
// Should set sameMobileAndFixedPattern to true.
|
||||
BuildMetadataFromXml::setRelevantDescPatterns($metadata, $territoryElement, false /* liteBuild */, false /* isShortNumberMetadata */);
|
||||
$this->assertTrue($metadata->hasSameMobileAndFixedLinePattern());
|
||||
}
|
||||
|
||||
public function testSetRelevantDescPatternsSetsAllDescriptionsForRegularLengthNumbers()
|
||||
{
|
||||
$xmlInput = "<territory countryCode=\"33\">"
|
||||
. " <fixedLine><nationalNumberPattern>\\d{1}</nationalNumberPattern></fixedLine>"
|
||||
. " <mobile><nationalNumberPattern>\\d{2}</nationalNumberPattern></mobile>"
|
||||
. " <pager><nationalNumberPattern>\\d{3}</nationalNumberPattern></pager>"
|
||||
. " <tollFree><nationalNumberPattern>\\d{4}</nationalNumberPattern></tollFree>"
|
||||
. " <premiumRate><nationalNumberPattern>\\d{5}</nationalNumberPattern></premiumRate>"
|
||||
. " <sharedCost><nationalNumberPattern>\\d{6}</nationalNumberPattern></sharedCost>"
|
||||
. " <personalNumber><nationalNumberPattern>\\d{7}</nationalNumberPattern></personalNumber>"
|
||||
. " <voip><nationalNumberPattern>\\d{8}</nationalNumberPattern></voip>"
|
||||
. " <uan><nationalNumberPattern>\\d{9}</nationalNumberPattern></uan>"
|
||||
. "</territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::setRelevantDescPatterns($metadata, $territoryElement, false /* liteBuild */, false /* isShortNumberMetadata */);
|
||||
$this->assertEquals("\\d{1}", $metadata->getFixedLine()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{2}", $metadata->getMobile()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{3}", $metadata->getPager()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{4}", $metadata->getTollFree()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{5}", $metadata->getPremiumRate()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{6}", $metadata->getSharedCost()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{7}", $metadata->getPersonalNumber()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{8}", $metadata->getVoip()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{9}", $metadata->getUan()->getNationalNumberPattern());
|
||||
}
|
||||
|
||||
public function testSetRelevantDescPatternsSetsAllDescriptionsForShortNumbers()
|
||||
{
|
||||
$xmlInput = "<territory ID=\"FR\">"
|
||||
. " <tollFree><nationalNumberPattern>\\d{1}</nationalNumberPattern></tollFree>"
|
||||
. " <standardRate><nationalNumberPattern>\\d{2}</nationalNumberPattern></standardRate>"
|
||||
. " <premiumRate><nationalNumberPattern>\\d{3}</nationalNumberPattern></premiumRate>"
|
||||
. " <shortCode><nationalNumberPattern>\\d{4}</nationalNumberPattern></shortCode>"
|
||||
. " <carrierSpecific>"
|
||||
. " <nationalNumberPattern>\\d{5}</nationalNumberPattern>"
|
||||
. " </carrierSpecific>"
|
||||
. "</territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::setRelevantDescPatterns($metadata, $territoryElement, false /* liteBuild */, true /* isShortNumberMetadata */);
|
||||
$this->assertEquals("\\d{1}", $metadata->getTollFree()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{2}", $metadata->getStandardRate()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{3}", $metadata->getPremiumRate()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{4}", $metadata->getShortCode()->getNationalNumberPattern());
|
||||
$this->assertEquals("\\d{5}", $metadata->getCarrierSpecific()->getNationalNumberPattern());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Multiple elements with type fixedLine found.
|
||||
*/
|
||||
public function testSetRelevantDescPatternsThrowsErrorIfTypePresentMultipleTimes()
|
||||
{
|
||||
$xmlInput = "<territory countryCode=\"33\">"
|
||||
. " <fixedLine><nationalNumberPattern>\\d{6}</nationalNumberPattern></fixedLine>"
|
||||
. " <fixedLine><nationalNumberPattern>\\d{6}</nationalNumberPattern></fixedLine>"
|
||||
. "</territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = new PhoneMetadata();
|
||||
BuildMetadataFromXml::setRelevantDescPatterns($metadata, $territoryElement, false /* liteBuild */, false /* isShortNumberMetadata */);
|
||||
}
|
||||
|
||||
public function testAlternateFormatsOmitsDescPatterns()
|
||||
{
|
||||
$xmlInput = "<territory countryCode=\"33\">"
|
||||
. " <availableFormats>"
|
||||
. " <numberFormat pattern=\"(1)(\\d{3})\">"
|
||||
. " <leadingDigits>1</leadingDigits>"
|
||||
. ' <format>$1</format>'
|
||||
. " </numberFormat>"
|
||||
. " </availableFormats>"
|
||||
. " <fixedLine><nationalNumberPattern>\\d{1}</nationalNumberPattern></fixedLine>"
|
||||
. " <shortCode><nationalNumberPattern>\\d{2}</nationalNumberPattern></shortCode>"
|
||||
. "</territory>";
|
||||
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = BuildMetadataFromXml::loadCountryMetadata('FR', $territoryElement, false /* liteBuild */, false /* isShortNumberMetadata */, true /* isAlternateFormatsMetadata */);
|
||||
$this->assertEquals('(1)(\\d{3})', $metadata->getNumberFormat(0)->getPattern());
|
||||
$this->assertEquals('1', $metadata->getNumberFormat(0)->getLeadingDigitsPattern(0));
|
||||
$this->assertEquals('$1', $metadata->getNumberFormat(0)->getFormat());
|
||||
$this->assertNull($metadata->getFixedLine());
|
||||
$this->assertNull($metadata->getShortCode());
|
||||
}
|
||||
|
||||
public function testNationalPrefixRulesSetCorrectly()
|
||||
{
|
||||
$xmlInput = "<territory countryCode=\"33\" nationalPrefix=\"0\""
|
||||
. ' nationalPrefixFormattingRule="$NP$FG">'
|
||||
. " <availableFormats>"
|
||||
. " <numberFormat pattern=\"(1)(\\d{3})\" nationalPrefixOptionalWhenFormatting=\"true\">"
|
||||
. " <leadingDigits>1</leadingDigits>"
|
||||
. ' <format>$1</format>'
|
||||
. " </numberFormat>"
|
||||
. " <numberFormat pattern=\"(\\d{3})\" nationalPrefixOptionalWhenFormatting=\"false\">"
|
||||
. " <leadingDigits>2</leadingDigits>"
|
||||
. ' <format>$1</format>'
|
||||
. " </numberFormat>"
|
||||
. " </availableFormats>"
|
||||
. " <fixedLine><nationalNumberPattern>\\d{1}</nationalNumberPattern></fixedLine>"
|
||||
. "</territory>";
|
||||
$territoryElement = $this->parseXMLString($xmlInput);
|
||||
$metadata = BuildMetadataFromXml::loadCountryMetadata('FR', $territoryElement, false /* liteBuild */, false /* isShortNumberMetadata */, true /* isAlternateFormatsMetadata */);
|
||||
$this->assertTrue($metadata->getNumberFormat(0)->isNationalPrefixOptionalWhenFormatting());
|
||||
// This is inherited from the territory, with $NP replaced by the actual national prefix, and
|
||||
// $FG replaced with $1.
|
||||
$this->assertEquals("0$1", $metadata->getNumberFormat(0)->getNationalPrefixFormattingRule());
|
||||
// Here it is explicitly set to false.
|
||||
$this->assertFalse($metadata->getNumberFormat(1)->isNationalPrefixOptionalWhenFormatting());
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescElement_PossibleLengthsSetCorrectly()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
// The number lengths set for the general description must be a super-set of those in the
|
||||
// element being parsed.
|
||||
$generalDesc->setPossibleLength(array(4, 6, 7, 13));
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
// Sorting will be done when parsing.
|
||||
. " <possibleLengths national=\"13,4\" localOnly=\"6\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* no liteBuild */);
|
||||
$possibleLength = $phoneNumberDesc->getPossibleLength();
|
||||
$this->assertCount(2, $possibleLength);
|
||||
$this->assertEquals(4, $possibleLength[0]);
|
||||
$this->assertEquals(13, $possibleLength[1]);
|
||||
// We don't set the local-only lengths on child elements such as fixed-line.
|
||||
$this->assertCount(0, $phoneNumberDesc->getPossibleLengthLocalOnly());
|
||||
}
|
||||
|
||||
public function testSetPossibleLengthsGeneralDesc_BuiltFromChildElements()
|
||||
{
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"13\" localOnly=\"6\"/>"
|
||||
. "</fixedLine>"
|
||||
. "<mobile>"
|
||||
. " <possibleLengths national=\"15\" localOnly=\"7,13\"/>"
|
||||
. "</mobile>"
|
||||
. "<tollFree>"
|
||||
. " <possibleLengths national=\"15\"/>"
|
||||
. "</tollFree>"
|
||||
. "</territory>");
|
||||
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
BuildMetadataFromXml::setPossibleLengthsGeneralDesc($generalDesc, 'someId', $territoryElement, false /* not short-number metadata */);
|
||||
|
||||
$possibleLength = $generalDesc->getPossibleLength();
|
||||
$this->assertCount(2, $possibleLength);
|
||||
$this->assertEquals(13, $possibleLength[0]);
|
||||
// 15 is present twice in the input in different sections, but only once in the output.
|
||||
$this->assertEquals(15, $possibleLength[1]);
|
||||
$possibleLengthLocalOnly = $generalDesc->getPossibleLengthLocalOnly();
|
||||
$this->assertCount(2, $possibleLengthLocalOnly);
|
||||
$this->assertEquals(6, $possibleLengthLocalOnly[0]);
|
||||
$this->assertEquals(7, $possibleLengthLocalOnly[1]);
|
||||
// 13 is skipped as a "local only" length, since it is also present as a normal length.
|
||||
}
|
||||
|
||||
public function testSetPossibleLengthsGeneralDesc_IgnoresNoIntlDialling()
|
||||
{
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"13\"/>"
|
||||
. "</fixedLine>"
|
||||
. "<noInternationalDialling>"
|
||||
. " <possibleLengths national=\"15\"/>"
|
||||
. "</noInternationalDialling>"
|
||||
. "</territory>");
|
||||
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
BuildMetadataFromXml::setPossibleLengthsGeneralDesc($generalDesc, 'someId', $territoryElement, false /* not short-number metadata */);
|
||||
|
||||
$possibleLength = $generalDesc->getPossibleLength();
|
||||
$this->assertCount(1, $possibleLength);
|
||||
$this->assertEquals(13, $possibleLength[0]);
|
||||
// 15 is skipped because noInternationalDialling should not contribute to the general lengths;
|
||||
// it isn't a particular "type" of number per se, it is a property that different types may
|
||||
// have.
|
||||
}
|
||||
|
||||
public function testSetPossibleLengthsGeneralDesc_ShortNumberMetadata()
|
||||
{
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<shortCode>"
|
||||
. " <possibleLengths national=\"6,13\"/>"
|
||||
. "</shortCode>"
|
||||
. "<carrierSpecific>"
|
||||
. " <possibleLengths national=\"7,13,15\"/>"
|
||||
. "</carrierSpecific>"
|
||||
. "<tollFree>"
|
||||
. " <possibleLengths national=\"15\"/>"
|
||||
. "</tollFree>"
|
||||
. "</territory>");
|
||||
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
BuildMetadataFromXml::setPossibleLengthsGeneralDesc($generalDesc, 'someId', $territoryElement, true /* short-number metadata */);
|
||||
|
||||
// All elements other than shortCode are ignored when creating the general desc.
|
||||
$possibleLength = $generalDesc->getPossibleLength();
|
||||
$this->assertCount(2, $possibleLength);
|
||||
$this->assertEquals(6, $possibleLength[0]);
|
||||
$this->assertEquals(13, $possibleLength[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Found local-only lengths in short-number metadata
|
||||
*/
|
||||
public function testSetPossibleLengthsGeneralDesc_ShortNumberMetadataErrorsOnLocalLengths()
|
||||
{
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<shortCode>"
|
||||
. " <possibleLengths national=\"13\" localOnly=\"6\"/>"
|
||||
. "</shortCode>"
|
||||
. "</territory>");
|
||||
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
BuildMetadataFromXml::setPossibleLengthsGeneralDesc($generalDesc, 'someId', $territoryElement, true /* short-number metadata */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Duplicate length element found (6) in possibleLength string 6,6
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorDuplicates()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(6));
|
||||
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<mobile>"
|
||||
. " <possibleLengths national=\"6,6\"/>"
|
||||
. "</mobile>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'mobile', false /* not light build */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Possible length(s) found specified as a normal and local-only length: [6]
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorDuplicatesOneLocal()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(6));
|
||||
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<mobile>"
|
||||
. " <possibleLengths national=\"6\" localOnly=\"6\"/>"
|
||||
. "</mobile>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'mobile', false /* not light build */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Out-of-range possible length
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorUncoveredLengths()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(4));
|
||||
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<noInternationalDialling>"
|
||||
// Sorting will be done when parsing.
|
||||
. " <possibleLengths national=\"6,7,4\"/>"
|
||||
. "</noInternationalDialling>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'noInternationalDialling', false /* not light build */);
|
||||
}
|
||||
|
||||
public function testProcessPhoneNumberDescElement_SameAsParent()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
// The number lengths set for the general description must be a super-set of those in the
|
||||
// element being parsed.
|
||||
$generalDesc->setPossibleLength(array(4, 6, 7));
|
||||
$generalDesc->setPossibleLengthLocalOnly(array(2));
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
// Sorting will be done when parsing.
|
||||
. " <possibleLengths national=\"6,7,4\" localOnly=\"2\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
$phoneNumberDesc = BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* not light build */);
|
||||
|
||||
// No possible lengths should be present, because they match the general description.
|
||||
$this->assertCount(0, $phoneNumberDesc->getPossibleLength());
|
||||
$this->assertCount(0, $phoneNumberDesc->getPossibleLengthLocalOnly());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage For input string "4d"
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_InvalidNumber()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(4));
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"4d\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* not light build */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Found possible lengths specified at general desc: this should be derived from child elements. Affected country: FR
|
||||
*/
|
||||
public function testLoadCountryMetadata_GeneralDescHasNumberLengthsSet()
|
||||
{
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<generalDesc>"
|
||||
// This shouldn't be set, the possible lengths should be derived for generalDesc.
|
||||
. " <possibleLengths national=\"4\"/>"
|
||||
. "</generalDesc>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"4\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::loadCountryMetadata('FR', $territoryElement, false /* liteBuild */, false /* isShortNumberMetadata */, false /* isAlternateFormatsMetadata */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Empty possibleLength string found.
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorEmptyPossibleLengthStringAttribute()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(4));
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* not light build */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Missing end of range character in possible length string [4,7].
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorRangeSpecifiedWithComma()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(4));
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"[4,7]\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* not light build */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Missing end of range character in possible length string [4-.
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorIncompleteRange()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(4));
|
||||
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"[4-\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* not light build */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage Ranges must have exactly one - character: missing for [4:10].
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorNoDashInRange()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(4));
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"[4:10]\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* not light build */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage The first number in a range should be two or more digits lower than the second. Culprit possibleLength string: [10-10]
|
||||
*/
|
||||
public function testProcessPhoneNumberDescElement_ErrorRangeIsNotFromMinToMax()
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc->setPossibleLength(array(4));
|
||||
$territoryElement = $this->parseXMLString("<territory>"
|
||||
. "<fixedLine>"
|
||||
. " <possibleLengths national=\"[10-10]\"/>"
|
||||
. "</fixedLine>"
|
||||
. "</territory>");
|
||||
|
||||
BuildMetadataFromXml::processPhoneNumberDescElement($generalDesc, $territoryElement, 'fixedLine', false /* not light build */);
|
||||
}
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\buildtools;
|
||||
|
||||
use libphonenumber\buildtools\GeneratePhonePrefixData;
|
||||
|
||||
class GeneratePhonePrefixDataTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private static $available_data_files;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$temporaryMap = array();
|
||||
|
||||
$phonePrefixData = new GeneratePhonePrefixData();
|
||||
|
||||
|
||||
// Languages for US.
|
||||
$phonePrefixData->addConfigurationMapping($temporaryMap, "1", "en");
|
||||
$phonePrefixData->addConfigurationMapping($temporaryMap, "1", "en_US");
|
||||
$phonePrefixData->addConfigurationMapping($temporaryMap, "1", "es");
|
||||
|
||||
// Languages for France.
|
||||
$phonePrefixData->addConfigurationMapping($temporaryMap, "33", "fr");
|
||||
$phonePrefixData->addConfigurationMapping($temporaryMap, "33", "en");
|
||||
|
||||
// Languages for China.
|
||||
$phonePrefixData->addConfigurationMapping($temporaryMap, "86", "zh_Hans");
|
||||
|
||||
self::$available_data_files = $temporaryMap;
|
||||
}
|
||||
|
||||
public function testAddConfigurationMapping()
|
||||
{
|
||||
$this->assertCount(3, self::$available_data_files);
|
||||
|
||||
$languagesForUS = self::$available_data_files[1];
|
||||
|
||||
$this->assertContains("en", $languagesForUS);
|
||||
$this->assertContains("en_US", $languagesForUS);
|
||||
$this->assertContains("es", $languagesForUS);
|
||||
|
||||
$languagesForFR = self::$available_data_files[33];
|
||||
|
||||
$this->assertContains("fr", $languagesForFR);
|
||||
$this->assertContains("en", $languagesForFR);
|
||||
|
||||
$languagesForCN = self::$available_data_files[86];
|
||||
$this->assertCount(1, $languagesForCN);
|
||||
|
||||
$this->assertContains("zh_Hans", $languagesForCN);
|
||||
}
|
||||
}
|
@@ -1,138 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\carrier;
|
||||
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\PhoneNumberToCarrierMapper;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class PhoneNumberToCarrierMapperTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
const TEST_META_DATA_FILE_PREFIX = "/../../Tests/libphonenumber/Tests/carrier/data/";
|
||||
private static $AO_MOBILE1;
|
||||
private static $AO_MOBILE2;
|
||||
private static $AO_FIXED1;
|
||||
private static $AO_FIXED2;
|
||||
private static $AO_INVALID_NUMBER;
|
||||
private static $UK_MOBILE1;
|
||||
private static $UK_MOBILE2;
|
||||
private static $UK_FIXED1;
|
||||
private static $UK_FIXED2;
|
||||
private static $UK_INVALID_NUMBER;
|
||||
private static $UK_PAGER;
|
||||
private static $US_FIXED_OR_MOBILE;
|
||||
private static $NUMBER_WITH_INVALID_COUNTRY_CODE;
|
||||
private static $INTERNATIONAL_TOLL_FREE;
|
||||
/**
|
||||
* @var PhoneNumberToCarrierMapper
|
||||
*/
|
||||
protected $carrierMapper;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
|
||||
self::$AO_MOBILE1 = new PhoneNumber();
|
||||
self::$AO_MOBILE1->setCountryCode(244)->setNationalNumber(917654321);
|
||||
|
||||
self::$AO_MOBILE2 = new PhoneNumber();
|
||||
self::$AO_MOBILE2->setCountryCode(244)->setNationalNumber(927654321);
|
||||
|
||||
self::$AO_FIXED1 = new PhoneNumber();
|
||||
self::$AO_FIXED1->setCountryCode(244)->setNationalNumber(22254321);
|
||||
|
||||
self::$AO_FIXED2 = new PhoneNumber();
|
||||
self::$AO_FIXED2->setCountryCode(244)->setNationalNumber(26254321);
|
||||
|
||||
self::$AO_INVALID_NUMBER = new PhoneNumber();
|
||||
self::$AO_INVALID_NUMBER->setCountryCode(244)->setNationalNumber(101234);
|
||||
|
||||
self::$UK_MOBILE1 = new PhoneNumber();
|
||||
self::$UK_MOBILE1->setCountryCode(44)->setNationalNumber(7387654321);
|
||||
|
||||
self::$UK_MOBILE2 = new PhoneNumber();
|
||||
self::$UK_MOBILE2->setCountryCode(44)->setNationalNumber(7487654321);
|
||||
|
||||
self::$UK_FIXED1 = new PhoneNumber();
|
||||
self::$UK_FIXED1->setCountryCode(44)->setNationalNumber(1123456789);
|
||||
|
||||
self::$UK_FIXED2 = new PhoneNumber();
|
||||
self::$UK_FIXED2->setCountryCode(44)->setNationalNumber(2987654321);
|
||||
|
||||
self::$UK_INVALID_NUMBER = new PhoneNumber();
|
||||
self::$UK_INVALID_NUMBER->setCountryCode(44)->setNationalNumber(7301234);
|
||||
|
||||
self::$UK_PAGER = new PhoneNumber();
|
||||
self::$UK_PAGER->setCountryCode(44)->setNationalNumber(7601234567);
|
||||
|
||||
self::$US_FIXED_OR_MOBILE = new PhoneNumber();
|
||||
self::$US_FIXED_OR_MOBILE->setCountryCode(1)->setNationalNumber(6502123456);
|
||||
|
||||
self::$NUMBER_WITH_INVALID_COUNTRY_CODE = new PhoneNumber();
|
||||
self::$NUMBER_WITH_INVALID_COUNTRY_CODE->setCountryCode(999)->setNationalNumber(2423651234);
|
||||
|
||||
self::$INTERNATIONAL_TOLL_FREE = new PhoneNumber();
|
||||
self::$INTERNATIONAL_TOLL_FREE->setCountryCode(800)->setNationalNumber(12345678);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->carrierMapper = PhoneNumberToCarrierMapper::getInstance(self::TEST_META_DATA_FILE_PREFIX);
|
||||
}
|
||||
|
||||
public function testGetNameForMobilePortableRegion()
|
||||
{
|
||||
$this->assertEquals("British carrier", $this->carrierMapper->getNameForNumber(self::$UK_MOBILE1, "en"));
|
||||
$this->assertEquals("Brittisk operat" . pack('H*', 'c3b6') . "r", $this->carrierMapper->getNameForNumber(self::$UK_MOBILE1, "sv_SE"));
|
||||
$this->assertEquals("British carrier", $this->carrierMapper->getNameForNumber(self::$UK_MOBILE1, "fr"));
|
||||
// Returns an empty string because the UK implements mobile number portability.
|
||||
$this->assertEquals("", $this->carrierMapper->getSafeDisplayName(self::$UK_MOBILE1, "en"));
|
||||
}
|
||||
|
||||
public function testGetNameForNonMobilePortableRegion()
|
||||
{
|
||||
$this->assertEquals("Angolan carrier", $this->carrierMapper->getNameForNumber(self::$AO_MOBILE1, "en"));
|
||||
$this->assertEquals("Angolan carrier", $this->carrierMapper->getSafeDisplayName(self::$AO_MOBILE1, "en"));
|
||||
}
|
||||
|
||||
public function testGetNameForFixedLineNumber()
|
||||
{
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$AO_FIXED1, "en"));
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$UK_FIXED1, "en"));
|
||||
// If the carrier information is present in the files and the method that assumes a valid
|
||||
// number is used, a carrier is returned
|
||||
$this->assertEquals("Angolan fixed line carrier", $this->carrierMapper->getNameForValidNumber(self::$AO_FIXED2, "en"));
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForValidNumber(self::$UK_FIXED2, "en"));
|
||||
}
|
||||
|
||||
public function testGetNameForFixedOrMobileNumber()
|
||||
{
|
||||
$this->assertEquals("US carrier", $this->carrierMapper->getNameForNumber(self::$US_FIXED_OR_MOBILE, "en"));
|
||||
}
|
||||
|
||||
public function testGetNameForPagerNumber()
|
||||
{
|
||||
$this->assertEquals("British pager", $this->carrierMapper->getNameForNumber(self::$UK_PAGER, "en"));
|
||||
}
|
||||
|
||||
public function testGetNameForNumberWithNoDataFile()
|
||||
{
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$NUMBER_WITH_INVALID_COUNTRY_CODE, "en"));
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$INTERNATIONAL_TOLL_FREE, "en"));
|
||||
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForValidNumber(self::$NUMBER_WITH_INVALID_COUNTRY_CODE, "en"));
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForValidNumber(self::$INTERNATIONAL_TOLL_FREE, "en"));
|
||||
}
|
||||
|
||||
public function testGetNameForNumberWithMissingPrefix()
|
||||
{
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$UK_MOBILE2, "en"));
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$AO_MOBILE2, "en"));
|
||||
}
|
||||
|
||||
public function testGetNameForInvalidNumber()
|
||||
{
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$UK_INVALID_NUMBER, "en"));
|
||||
$this->assertEquals("", $this->carrierMapper->getNameForNumber(self::$AO_INVALID_NUMBER, "en"));
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
'en' =>
|
||||
array (
|
||||
0 => 1650,
|
||||
1 => 244,
|
||||
2 => 44,
|
||||
),
|
||||
'sv' =>
|
||||
array (
|
||||
0 => 44,
|
||||
),
|
||||
);
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1650212 => 'US carrier',
|
||||
1650213 => 'US carrier2',
|
||||
);
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
244262 => 'Angolan fixed line carrier',
|
||||
244917 => 'Angolan carrier',
|
||||
);
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
4473 => 'Brittisk operatör',
|
||||
);
|
@@ -1,394 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\core;
|
||||
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumberFormat;
|
||||
use libphonenumber\PhoneNumberType;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use libphonenumber\ShortNumberCost;
|
||||
use libphonenumber\ShortNumberInfo;
|
||||
|
||||
/**
|
||||
* Verifies all of the example numbers in the metadata are valid and of the correct type. If no
|
||||
* example number exists for a particular type, the test still passes.
|
||||
*/
|
||||
class ExampleNumbersTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
private $phoneNumberUtil;
|
||||
/**
|
||||
* @var ShortNumberInfo
|
||||
*/
|
||||
private $shortNumberInfo;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
PhoneNumberUtil::getInstance();
|
||||
ShortNumberInfo::resetInstance();
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
|
||||
$this->shortNumberInfo = ShortNumberInfo::getInstance();
|
||||
}
|
||||
|
||||
public function regionList()
|
||||
{
|
||||
$returnList = array();
|
||||
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$phoneUtil = PhoneNumberUtil::getInstance();
|
||||
foreach ($phoneUtil->getSupportedRegions() as $regionCode) {
|
||||
$returnList[] = array($regionCode);
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
public function testFixedLine($region)
|
||||
{
|
||||
$fixedLineTypes = array(PhoneNumberType::FIXED_LINE, PhoneNumberType::FIXED_LINE_OR_MOBILE);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::FIXED_LINE, $fixedLineTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testFixedLineOrMobile($region)
|
||||
{
|
||||
$numberTypes = array(PhoneNumberType::FIXED_LINE, PhoneNumberType::FIXED_LINE_OR_MOBILE);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::FIXED_LINE_OR_MOBILE, $numberTypes, $region);
|
||||
}
|
||||
|
||||
private function checkNumbersValidAndCorrectType($exampleNumberRequestedType, $possibleExpectedTypes, $regionCode)
|
||||
{
|
||||
$exampleNumber = $this->phoneNumberUtil->getExampleNumberForType($regionCode, $exampleNumberRequestedType);
|
||||
if ($exampleNumber !== null) {
|
||||
$this->assertTrue(
|
||||
$this->phoneNumberUtil->isValidNumber($exampleNumber),
|
||||
"Failed validation for {$exampleNumber}"
|
||||
);
|
||||
|
||||
// We know the number is valid, now we check the type.
|
||||
$exampleNumberType = $this->phoneNumberUtil->getNumberType($exampleNumber);
|
||||
$this->assertContains($exampleNumberType, $possibleExpectedTypes, "Wrong type for {$exampleNumber}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testMobile($region)
|
||||
{
|
||||
$mobileTypes = array(PhoneNumberType::MOBILE, PhoneNumberType::FIXED_LINE_OR_MOBILE);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::MOBILE, $mobileTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testTollFree($region)
|
||||
{
|
||||
$tollFreeTypes = array(PhoneNumberType::TOLL_FREE);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::TOLL_FREE, $tollFreeTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testPremiumRate($region)
|
||||
{
|
||||
$premiumRateTypes = array(PhoneNumberType::PREMIUM_RATE);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::PREMIUM_RATE, $premiumRateTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testVoip($region)
|
||||
{
|
||||
$voipTypes = array(PhoneNumberType::VOIP);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::VOIP, $voipTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testPager($region)
|
||||
{
|
||||
$pagerTypes = array(PhoneNumberType::PAGER);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::PAGER, $pagerTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testUan($region)
|
||||
{
|
||||
$uanTypes = array(PhoneNumberType::UAN);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::UAN, $uanTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testVoicemail($region)
|
||||
{
|
||||
$voicemailTypes = array(PhoneNumberType::VOICEMAIL);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::VOICEMAIL, $voicemailTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testPersonalNumber($region)
|
||||
{
|
||||
$numberTypes = array(PhoneNumberType::PERSONAL_NUMBER);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::PERSONAL_NUMBER, $numberTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testSharedCost($region)
|
||||
{
|
||||
$sharedCostTypes = array(PhoneNumberType::SHARED_COST);
|
||||
$this->checkNumbersValidAndCorrectType(PhoneNumberType::SHARED_COST, $sharedCostTypes, $region);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
*/
|
||||
public function testCanBeInternationallyDialled($regionCode)
|
||||
{
|
||||
$exampleNumber = null;
|
||||
/** @var \libphonenumber\PhoneNumberDesc $desc */
|
||||
$desc = $this->phoneNumberUtil->getMetadataForRegion($regionCode)->getNoInternationalDialling();
|
||||
try {
|
||||
if ($desc->hasExampleNumber()) {
|
||||
$exampleNumber = $this->phoneNumberUtil->parse($desc->getExampleNumber(), $regionCode);
|
||||
}
|
||||
} catch (NumberParseException $e) {
|
||||
}
|
||||
|
||||
if ($exampleNumber !== null && $this->phoneNumberUtil->canBeInternationallyDialled($exampleNumber)) {
|
||||
$this->fail("Number {$exampleNumber} should not be internationally diallable");
|
||||
}
|
||||
}
|
||||
|
||||
public function shortNumberRegionList()
|
||||
{
|
||||
$returnList = array();
|
||||
|
||||
PhoneNumberUtil::resetInstance();
|
||||
ShortNumberInfo::resetInstance();
|
||||
$shortNumberInfo = ShortNumberInfo::getInstance();
|
||||
foreach ($shortNumberInfo->getSupportedRegions() as $regionCode) {
|
||||
$returnList[] = array($regionCode);
|
||||
}
|
||||
|
||||
return $returnList;
|
||||
}
|
||||
|
||||
public function supportedGlobalNetworkCallingCodes()
|
||||
{
|
||||
$returnList = array();
|
||||
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$phoneUtil = PhoneNumberUtil::getInstance();
|
||||
foreach ($phoneUtil->getSupportedGlobalNetworkCallingCodes() as $callingCode) {
|
||||
$returnList[] = array($callingCode);
|
||||
}
|
||||
|
||||
return $returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider supportedGlobalNetworkCallingCodes
|
||||
*/
|
||||
public function testGlobalNetworkNumbers($callingCode)
|
||||
{
|
||||
$exampleNumber = $this->phoneNumberUtil->getExampleNumberForNonGeoEntity($callingCode);
|
||||
$this->assertNotNull($exampleNumber, "No example phone number for calling code " . $callingCode);
|
||||
if (!$this->phoneNumberUtil->isValidNumber($exampleNumber)) {
|
||||
$this->fail("Failed validation for " . $exampleNumber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider regionList
|
||||
* @param string $regionCode
|
||||
*/
|
||||
public function testEveryRegionHasAnExampleNumber($regionCode)
|
||||
{
|
||||
$exampleNumber = $this->phoneNumberUtil->getExampleNumber($regionCode);
|
||||
$this->assertNotNull($exampleNumber, "No example number found for region " . $regionCode);
|
||||
|
||||
/*
|
||||
* Check the number is valid
|
||||
*/
|
||||
|
||||
$e164 = $this->phoneNumberUtil->format($exampleNumber, PhoneNumberFormat::E164);
|
||||
|
||||
$phoneObject = $this->phoneNumberUtil->parse($e164, 'ZZ');
|
||||
|
||||
$this->assertEquals($phoneObject, $exampleNumber);
|
||||
|
||||
$this->assertTrue($this->phoneNumberUtil->isValidNumber($phoneObject));
|
||||
$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
|
||||
*/
|
||||
public function testShortNumbersValidAndCorrectCost($regionCode)
|
||||
{
|
||||
$exampleShortNumber = $this->shortNumberInfo->getExampleShortNumber($regionCode);
|
||||
if (!$this->shortNumberInfo->isValidShortNumberForRegion(
|
||||
$this->phoneNumberUtil->parse($exampleShortNumber, $regionCode),
|
||||
$regionCode
|
||||
)
|
||||
) {
|
||||
$this->fail(
|
||||
"Failed validation for string region_code: {$regionCode}, national_number: {$exampleShortNumber}"
|
||||
);
|
||||
}
|
||||
$phoneNumber = $this->phoneNumberUtil->parse($exampleShortNumber, $regionCode);
|
||||
if (!$this->shortNumberInfo->isValidShortNumber($phoneNumber)) {
|
||||
$this->fail("Failed validation for " . (string)$phoneNumber);
|
||||
}
|
||||
}
|
||||
|
||||
public function shortRegionListAndNumberCost()
|
||||
{
|
||||
$costArray = array(
|
||||
ShortNumberCost::PREMIUM_RATE,
|
||||
ShortNumberCost::STANDARD_RATE,
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
ShortNumberCost::UNKNOWN_COST
|
||||
);
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider shortNumberRegionList
|
||||
*/
|
||||
public function testEmergency($regionCode)
|
||||
{
|
||||
$desc = $this->shortNumberInfo->getMetadataForRegion($regionCode)->getEmergency();
|
||||
if ($desc->hasExampleNumber()) {
|
||||
$exampleNumber = $desc->getExampleNumber();
|
||||
$phoneNumber = $this->phoneNumberUtil->parse($exampleNumber, $regionCode);
|
||||
|
||||
if (!$this->shortNumberInfo->isPossibleShortNumberForRegion(
|
||||
$phoneNumber,
|
||||
$regionCode
|
||||
) || !$this->shortNumberInfo->isEmergencyNumber($exampleNumber, $regionCode)
|
||||
) {
|
||||
$this->fail("Emergency example number test failed for " . $regionCode);
|
||||
} elseif ($this->shortNumberInfo->getExpectedCostForRegion(
|
||||
$phoneNumber,
|
||||
$regionCode
|
||||
) !== ShortNumberCost::TOLL_FREE
|
||||
) {
|
||||
$this->fail("Emergency example number not toll free for " . $regionCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider shortNumberRegionList
|
||||
*/
|
||||
public function testCarrierSpecificShortNumbers($regionCode)
|
||||
{
|
||||
// Test the carrier-specific tag.
|
||||
$desc = $this->shortNumberInfo->getMetadataForRegion($regionCode)->getCarrierSpecific();
|
||||
if ($desc->hasExampleNumber()) {
|
||||
$exampleNumber = $desc->getExampleNumber();
|
||||
$carrierSpecificNumber = $this->phoneNumberUtil->parse($exampleNumber, $regionCode);
|
||||
|
||||
if (!$this->shortNumberInfo->isPossibleShortNumberForRegion(
|
||||
$carrierSpecificNumber,
|
||||
$regionCode
|
||||
) || !$this->shortNumberInfo->isCarrierSpecific($carrierSpecificNumber)
|
||||
) {
|
||||
$this->fail("Carrier-specific test failed for " . $regionCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\core;
|
||||
|
||||
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
|
||||
use libphonenumber\PhoneNumberToCarrierMapper;
|
||||
|
||||
/**
|
||||
* Verifies that classes which require the Intl extension cannot be instantiated.
|
||||
*/
|
||||
class IntlTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
if (extension_loaded('intl')) {
|
||||
$this->markTestSkipped('The intl extension must not be installed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage The intl extension must be installed
|
||||
*/
|
||||
public function testPhoneNumberOfflineGeocoder()
|
||||
{
|
||||
PhoneNumberOfflineGeocoder::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage The intl extension must be installed
|
||||
*/
|
||||
public function testPhoneNumberToCarrierMapper()
|
||||
{
|
||||
PhoneNumberToCarrierMapper::getInstance();
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\core;
|
||||
|
||||
use libphonenumber\DefaultMetadataLoader;
|
||||
use libphonenumber\MultiFileMetadataSourceImpl;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class MultiFileMetadataSourceImplTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var MultiFileMetadataSourceImpl
|
||||
*/
|
||||
private $multiFileMetadataSource;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->multiFileMetadataSource = new MultiFileMetadataSourceImpl(
|
||||
new DefaultMetadataLoader(),
|
||||
PhoneNumberUtilTest::TEST_META_DATA_FILE_PREFIX
|
||||
);
|
||||
}
|
||||
|
||||
public function testMissingMetadataFileThrowsRuntimeException()
|
||||
{
|
||||
// In normal usage we should never get a state where we are asking to load metadata that doesn't
|
||||
// exist. However if the library is packaged incorrectly, this could happen and the best we can
|
||||
// do is make sure the exception has the file name in it.
|
||||
|
||||
try {
|
||||
$this->multiFileMetadataSource->loadMetadataFromFile("no/such/file", "XX", -1, new DefaultMetadataLoader());
|
||||
$this->fail("Expected Exception");
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->assertContains('no/such/file_XX', $e->getMessage(), "Unexpected error: " . $e->getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
$this->multiFileMetadataSource->loadMetadataFromFile(
|
||||
"no/such/file",
|
||||
PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY,
|
||||
123,
|
||||
new DefaultMetadataLoader()
|
||||
);
|
||||
$this->fail("Expected Exception");
|
||||
} catch (\RuntimeException $e) {
|
||||
$this->assertContains('no/such/file_123', $e->getMessage(), "Unexpected error: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\core;
|
||||
|
||||
use libphonenumber\CountryCodeSource;
|
||||
use libphonenumber\PhoneNumber;
|
||||
|
||||
/**
|
||||
* Tests for the PhoneNumber object itself.
|
||||
*/
|
||||
class PhoneNumberTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testEqualSimpleNumber()
|
||||
{
|
||||
$numberA = new PhoneNumber();
|
||||
$numberA->setCountryCode(1)->setNationalNumber(6502530000);
|
||||
|
||||
$numberB = new PhoneNumber();
|
||||
$numberB->setCountryCode(1)->setNationalNumber(6502530000);
|
||||
|
||||
$this->assertEquals($numberA, $numberB);
|
||||
}
|
||||
|
||||
public function testEqualWithItalianLeadingZeroSetToDefault()
|
||||
{
|
||||
$numberA = new PhoneNumber();
|
||||
$numberA->setCountryCode(1)->setNationalNumber(6502530000)->setItalianLeadingZero(false);
|
||||
|
||||
$numberB = new PhoneNumber();
|
||||
$numberB->setCountryCode(1)->setNationalNumber(6502530000);
|
||||
|
||||
// These should still be equal, since the default value for this field is false.
|
||||
$this->assertEquals($numberA, $numberB);
|
||||
}
|
||||
|
||||
public function testEqualWithCountryCodeSourceSet()
|
||||
{
|
||||
$numberA = new PhoneNumber();
|
||||
$numberA->setRawInput("+1 650 253 00 00")->setCountryCode(CountryCodeSource::FROM_NUMBER_WITH_PLUS_SIGN);
|
||||
|
||||
$numberB = new PhoneNumber();
|
||||
$numberB->setRawInput("+1 650 253 00 00")->setCountryCode(CountryCodeSource::FROM_NUMBER_WITH_PLUS_SIGN);
|
||||
|
||||
$this->assertEquals($numberA, $numberB);
|
||||
}
|
||||
|
||||
public function testNonEqualWithItalianLeadingZeroSetToTrue()
|
||||
{
|
||||
$numberA = new PhoneNumber();
|
||||
$numberA->setCountryCode(1)->setNationalNumber(6502530000)->setItalianLeadingZero(true);
|
||||
|
||||
$numberB = new PhoneNumber();
|
||||
$numberB->setCountryCode(1)->setNationalNumber(6502530000);
|
||||
|
||||
$this->assertNotEquals($numberA, $numberB);
|
||||
$this->assertFalse($numberA->equals($numberB));
|
||||
}
|
||||
|
||||
public function testNonEqualWithDifferingRawInput()
|
||||
{
|
||||
$numberA = new PhoneNumber();
|
||||
$numberA->setCountryCode(1)
|
||||
->setNationalNumber(6502530000)
|
||||
->setRawInput("+1 650 253 00 00")
|
||||
->setCountryCodeSource(CountryCodeSource::FROM_NUMBER_WITH_PLUS_SIGN);
|
||||
|
||||
$numberB = new PhoneNumber();
|
||||
$numberB->setCountryCode(1)
|
||||
->setNationalNumber(6502530000)
|
||||
->setRawInput("+1-650-253-00-00")
|
||||
->setCountryCodeSource(CountryCodeSource::FROM_NUMBER_WITH_PLUS_SIGN);
|
||||
|
||||
$this->assertNotEquals($numberA, $numberB);
|
||||
$this->assertFalse($numberA->equals($numberB));
|
||||
}
|
||||
|
||||
public function testNonEqualWithPreferredDomesticCarrierCodeSetToDefault()
|
||||
{
|
||||
$numberA = new PhoneNumber();
|
||||
$numberA->setCountryCode(1)->setNationalNumber(6502530000)->setPreferredDomesticCarrierCode("");
|
||||
|
||||
$numberB = new PhoneNumber();
|
||||
$numberB->setCountryCode(1)->setNationalNumber(6502530000);
|
||||
|
||||
$this->assertNotSame($numberA, $numberB);
|
||||
$this->assertFalse($numberA->equals($numberB));
|
||||
}
|
||||
|
||||
public function testEqualWithPreferredDomesticCarrierCodeSetToDefault()
|
||||
{
|
||||
$numberA = new PhoneNumber();
|
||||
$numberA->setCountryCode(1)->setNationalNumber(6502530000)->setPreferredDomesticCarrierCode("");
|
||||
|
||||
$numberB = new PhoneNumber();
|
||||
$numberB->setCountryCode(1)->setNationalNumber(6502530000)->setPreferredDomesticCarrierCode("");
|
||||
|
||||
$this->assertEquals($numberA, $numberB);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,435 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\core;
|
||||
|
||||
use libphonenumber\CountryCodeToRegionCodeMapForTesting;
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use libphonenumber\RegionCode;
|
||||
use libphonenumber\ShortNumberCost;
|
||||
use libphonenumber\ShortNumberInfo;
|
||||
|
||||
class ShortNumberInfoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private static $plusSymbol;
|
||||
/**
|
||||
* @var PhoneNumberUtil
|
||||
*/
|
||||
protected $phoneUtil;
|
||||
/**
|
||||
* @var ShortNumberInfo
|
||||
*/
|
||||
private $shortInfo;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
self::$plusSymbol = pack('H*', 'efbc8b');
|
||||
|
||||
PhoneNumberUtil::resetInstance();
|
||||
ShortNumberInfo::resetInstance();
|
||||
$this->phoneUtil = PhoneNumberUtil::getInstance(
|
||||
PhoneNumberUtilTest::TEST_META_DATA_FILE_PREFIX,
|
||||
CountryCodeToRegionCodeMapForTesting::$countryCodeToRegionCodeMapForTesting
|
||||
);
|
||||
$this->shortInfo = ShortNumberInfo::getInstance();
|
||||
}
|
||||
|
||||
public function testIsPossibleShortNumber()
|
||||
{
|
||||
$possibleNumber = new PhoneNumber();
|
||||
$possibleNumber->setCountryCode(33)->setNationalNumber(123456);
|
||||
|
||||
$this->assertTrue($this->shortInfo->isPossibleShortNumber($possibleNumber));
|
||||
$this->assertTrue($this->shortInfo->isPossibleShortNumberForRegion($this->parse(123456, RegionCode::FR), RegionCode::FR));
|
||||
|
||||
$impossibleNumber = new PhoneNumber();
|
||||
$impossibleNumber->setCountryCode(33)->setNationalNumber(9);
|
||||
$this->assertFalse($this->shortInfo->isPossibleShortNumber($impossibleNumber));
|
||||
|
||||
// Note that GB and GG share the country calling code 44, and that this number is possible but
|
||||
// not valid.
|
||||
$gbNumber = new PhoneNumber();
|
||||
$gbNumber->setCountryCode(44)->setNationalNumber(11001);
|
||||
$this->assertTrue($this->shortInfo->isPossibleShortNumber($gbNumber));
|
||||
}
|
||||
|
||||
public function testIsValidShortNumber()
|
||||
{
|
||||
$phoneNumberObj = new PhoneNumber();
|
||||
$phoneNumberObj->setCountryCode(33)->setNationalNumber(1010);
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumber($phoneNumberObj));
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse(1010, RegionCode::FR), RegionCode::FR));
|
||||
|
||||
$phoneNumberObj = new PhoneNumber();
|
||||
$phoneNumberObj->setCountryCode(33)->setNationalNumber(123456);
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumber($phoneNumberObj));
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumberForRegion($this->parse(123456, RegionCode::FR), RegionCode::FR));
|
||||
|
||||
// Note that GB and GG share the country calling code 44
|
||||
$phoneNumberObj = new PhoneNumber();
|
||||
$phoneNumberObj->setCountryCode(44)->setNationalNumber(18001);
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumber($phoneNumberObj));
|
||||
}
|
||||
|
||||
public function testGetExpectedCost()
|
||||
{
|
||||
$premiumRateExample = $this->shortInfo->getExampleShortNumberForCost(
|
||||
RegionCode::FR,
|
||||
ShortNumberCost::PREMIUM_RATE
|
||||
);
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::PREMIUM_RATE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($premiumRateExample, RegionCode::FR), RegionCode::FR)
|
||||
);
|
||||
|
||||
$premiumRateNumber = new PhoneNumber();
|
||||
$premiumRateNumber->setCountryCode(33)->setNationalNumber($premiumRateExample);
|
||||
$this->assertEquals(ShortNumberCost::PREMIUM_RATE, $this->shortInfo->getExpectedCost($premiumRateNumber));
|
||||
|
||||
$standardRateExample = $this->shortInfo->getExampleShortNumberForCost(
|
||||
RegionCode::FR,
|
||||
ShortNumberCost::STANDARD_RATE
|
||||
);
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::STANDARD_RATE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($standardRateExample, RegionCode::FR), RegionCode::FR)
|
||||
);
|
||||
|
||||
$standardRateNumber = new PhoneNumber();
|
||||
$standardRateNumber->setCountryCode(33)->setNationalNumber($standardRateExample);
|
||||
$this->assertEquals(ShortNumberCost::STANDARD_RATE, $this->shortInfo->getExpectedCost($standardRateNumber));
|
||||
|
||||
$tollFreeExample = $this->shortInfo->getExampleShortNumberForCost(RegionCode::FR, ShortNumberCost::TOLL_FREE);
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($tollFreeExample, RegionCode::FR), RegionCode::FR)
|
||||
);
|
||||
$tollFreeNumber = new PhoneNumber();
|
||||
$tollFreeNumber->setCountryCode(33)->setNationalNumber($tollFreeExample);
|
||||
$this->assertEquals(ShortNumberCost::TOLL_FREE, $this->shortInfo->getExpectedCost($tollFreeNumber));
|
||||
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::UNKNOWN_COST,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("12345", RegionCode::FR), RegionCode::FR)
|
||||
);
|
||||
$unknownCostNumber = new PhoneNumber();
|
||||
$unknownCostNumber->setCountryCode(33)->setNationalNumber(12345);
|
||||
$this->assertEquals(ShortNumberCost::UNKNOWN_COST, $this->shortInfo->getExpectedCost($unknownCostNumber));
|
||||
|
||||
// Test that an invalid number may nevertheless have a cost other than UNKNOWN_COST.
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumberForRegion($this->parse("116123", RegionCode::FR), RegionCode::FR));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("116123", RegionCode::FR), RegionCode::FR)
|
||||
);
|
||||
$invalidNumber = new PhoneNumber();
|
||||
$invalidNumber->setCountryCode(33)->setNationalNumber(116123);
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumber($invalidNumber));
|
||||
$this->assertEquals(ShortNumberCost::TOLL_FREE, $this->shortInfo->getExpectedCost($invalidNumber));
|
||||
|
||||
// Test a nonexistent country code.
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::UNKNOWN_COST,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("911", RegionCode::US), RegionCode::ZZ)
|
||||
);
|
||||
$unknownCostNumber->clear();
|
||||
$unknownCostNumber->setCountryCode(123)->setNationalNumber(911);
|
||||
$this->assertEquals(ShortNumberCost::UNKNOWN_COST, $this->shortInfo->getExpectedCost($unknownCostNumber));
|
||||
}
|
||||
|
||||
public function testGetExpectedCostForSharedCountryCallingCode()
|
||||
{
|
||||
// Test some numbers which have different costs in countries sharing the same country calling
|
||||
// code. In Australia, 1234 is premium-rate, 1194 is standard-rate, and 733 is toll-free. These
|
||||
// are not known to be valid numbers in the Christmas Islands.
|
||||
$ambiguousPremiumRateString = "1234";
|
||||
$ambiguousPremiumRateNumber = new PhoneNumber();
|
||||
$ambiguousPremiumRateNumber->setCountryCode(61)->setNationalNumber(1234);
|
||||
$ambiguousStandardRateString = "1194";
|
||||
$ambiguousStandardRateNumber = new PhoneNumber();
|
||||
$ambiguousStandardRateNumber->setCountryCode(61)->setNationalNumber(1194);
|
||||
$ambiguousTollFreeString = "733";
|
||||
$ambiguousTollFreeNumber = new PhoneNumber();
|
||||
$ambiguousTollFreeNumber->setCountryCode(61)->setNationalNumber(733);
|
||||
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumber($ambiguousPremiumRateNumber));
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumber($ambiguousStandardRateNumber));
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumber($ambiguousTollFreeNumber));
|
||||
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse($ambiguousPremiumRateString, RegionCode::AU), RegionCode::AU));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::PREMIUM_RATE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($ambiguousPremiumRateString, RegionCode::AU), RegionCode::AU)
|
||||
);
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumberForRegion($this->parse($ambiguousPremiumRateString, RegionCode::CX), RegionCode::CX));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::UNKNOWN_COST,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($ambiguousPremiumRateString, RegionCode::CX), RegionCode::CX)
|
||||
);
|
||||
// PREMIUM_RATE takes precedence over UNKNOWN_COST.
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::PREMIUM_RATE,
|
||||
$this->shortInfo->getExpectedCost($ambiguousPremiumRateNumber)
|
||||
);
|
||||
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse($ambiguousStandardRateString, RegionCode::AU), RegionCode::AU));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::STANDARD_RATE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($ambiguousStandardRateString, RegionCode::AU), RegionCode::AU)
|
||||
);
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumberForRegion($this->parse($ambiguousStandardRateString, RegionCode::CX), RegionCode::CX));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::UNKNOWN_COST,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($ambiguousStandardRateString, RegionCode::CX), RegionCode::CX)
|
||||
);
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::UNKNOWN_COST,
|
||||
$this->shortInfo->getExpectedCost($ambiguousStandardRateNumber)
|
||||
);
|
||||
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse($ambiguousTollFreeString, RegionCode::AU), RegionCode::AU));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($ambiguousTollFreeString, RegionCode::AU), RegionCode::AU)
|
||||
);
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumberForRegion($this->parse($ambiguousTollFreeString, RegionCode::CX), RegionCode::CX));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::UNKNOWN_COST,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse($ambiguousTollFreeString, RegionCode::CX), RegionCode::CX)
|
||||
);
|
||||
$this->assertEquals(ShortNumberCost::UNKNOWN_COST, $this->shortInfo->getExpectedCost($ambiguousTollFreeNumber));
|
||||
}
|
||||
|
||||
public function testGetExampleShortNumber()
|
||||
{
|
||||
$this->assertEquals("8711", $this->shortInfo->getExampleShortNumber(RegionCode::AM));
|
||||
$this->assertEquals("1010", $this->shortInfo->getExampleShortNumber(RegionCode::FR));
|
||||
$this->assertEquals("", $this->shortInfo->getExampleShortNumber(RegionCode::UN001));
|
||||
$this->assertEquals("", $this->shortInfo->getExampleShortNumber(null));
|
||||
}
|
||||
|
||||
public function testGetExampleShortNumberForCost()
|
||||
{
|
||||
$this->assertEquals(
|
||||
"3010",
|
||||
$this->shortInfo->getExampleShortNumberForCost(RegionCode::FR, ShortNumberCost::TOLL_FREE)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"1023",
|
||||
$this->shortInfo->getExampleShortNumberForCost(RegionCode::FR, ShortNumberCost::STANDARD_RATE)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"42000",
|
||||
$this->shortInfo->getExampleShortNumberForCost(RegionCode::FR, ShortNumberCost::PREMIUM_RATE)
|
||||
);
|
||||
$this->assertEquals(
|
||||
"",
|
||||
$this->shortInfo->getExampleShortNumberForCost(RegionCode::FR, ShortNumberCost::UNKNOWN_COST)
|
||||
);
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_US()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("911", RegionCode::US));
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("112", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberLongNumber_US()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("9116666666", RegionCode::US));
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("1126666666", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("9996666666", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberWithFormatting_US()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("9-1-1", RegionCode::US));
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("1-1-2", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("9-9-9", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberWithPlusSign_US()
|
||||
{
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("+911", RegionCode::US));
|
||||
$this->assertFalse(
|
||||
$this->shortInfo->connectsToEmergencyNumber(self::$plusSymbol . "911", RegionCode::US)
|
||||
);
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber(" +911", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("+112", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("+999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_BR()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("911", RegionCode::BR));
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber("190", RegionCode::BR));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("999", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberLongNumber_BR()
|
||||
{
|
||||
// Brazilian emergency numbers don't work when additional digits are appended.
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("9111", RegionCode::BR));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("1900", RegionCode::BR));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("9996", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_CL()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber('131', RegionCode::CL));
|
||||
$this->assertTrue($this->shortInfo->connectsToEmergencyNumber('133', RegionCode::CL));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberLongNumber_CL()
|
||||
{
|
||||
// Chilean emergency numbers don't work when additional digits are appended.
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber('1313', RegionCode::CL));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber('1330', RegionCode::CL));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_AO()
|
||||
{
|
||||
// Angola doesn't have any metadata for emergency numbers in the test metadata.
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("911", RegionCode::AO));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("222123456", RegionCode::BR));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("923123456", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_ZW()
|
||||
{
|
||||
// Zimbabwe doesn't have any metadata in the test metadata.
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("911", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("01312345", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortInfo->connectsToEmergencyNumber("0711234567", RegionCode::ZW));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_US()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("911", RegionCode::US));
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("112", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberLongNumber_US()
|
||||
{
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("9116666666", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("1126666666", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("9996666666", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberWithFormatting_US()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("9-1-1", RegionCode::US));
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("*911", RegionCode::US));
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("1-1-2", RegionCode::US));
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("*112", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("9-9-9", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("*999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberWithPlusSign_US()
|
||||
{
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("+911", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber(self::$plusSymbol . "911", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber(" +911", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("+112", RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("+999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_BR()
|
||||
{
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("911", RegionCode::BR));
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("190", RegionCode::BR));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("999", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberLongNumber_BR()
|
||||
{
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("9111", RegionCode::BR));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("1900", RegionCode::BR));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("9996", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_AO()
|
||||
{
|
||||
// Angola doesn't have any metadata for emergency numbers in the test metadata.
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("911", RegionCode::AO));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("222123456", RegionCode::AO));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("923123456", RegionCode::AO));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_ZW()
|
||||
{
|
||||
// Zimbabwe doesn't have any metadata in the test metadata.
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("911", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("01312345", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("0711234567", RegionCode::ZW));
|
||||
}
|
||||
|
||||
|
||||
public function testEmergencyNumberForSharedCountryCallingCode()
|
||||
{
|
||||
// Test the emergency number 112, which is valid in both Australia and the Christmas Islands.
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("112", RegionCode::AU));
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse("112", RegionCode::AU), RegionCode::AU));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("112", RegionCode::AU), RegionCode::AU)
|
||||
);
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("112", RegionCode::CX));
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumberForRegion($this->parse("112", RegionCode::CX), RegionCode::CX));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("112", RegionCode::CX), RegionCode::CX)
|
||||
);
|
||||
$sharedEmergencyNumber = new PhoneNumber();
|
||||
$sharedEmergencyNumber->setCountryCode(61)->setNationalNumber(112);
|
||||
$this->assertTrue($this->shortInfo->isValidShortNumber($sharedEmergencyNumber));
|
||||
$this->assertEquals(ShortNumberCost::TOLL_FREE, $this->shortInfo->getExpectedCost($sharedEmergencyNumber));
|
||||
}
|
||||
|
||||
public function testOverlappingNANPANumber()
|
||||
{
|
||||
// 211 is an emergency number in Barbados, while it is a toll-free information line in Canada
|
||||
// and the USA.
|
||||
$this->assertTrue($this->shortInfo->isEmergencyNumber("211", RegionCode::BB));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("211", RegionCode::BB), RegionCode::BB)
|
||||
);
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("211", RegionCode::US));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::UNKNOWN_COST,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("211", RegionCode::US), RegionCode::US)
|
||||
);
|
||||
$this->assertFalse($this->shortInfo->isEmergencyNumber("211", RegionCode::CA));
|
||||
$this->assertEquals(
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
$this->shortInfo->getExpectedCostForRegion($this->parse("211", RegionCode::CA), RegionCode::CA)
|
||||
);
|
||||
}
|
||||
|
||||
public function testCountryCallingCodeIsNotIgnored()
|
||||
{
|
||||
// +46 is the country calling code for Sweden (SE), and 40404 is a valid short number in the US.
|
||||
$this->assertFalse($this->shortInfo->isPossibleShortNumberForRegion($this->parse('+4640404', RegionCode::SE), RegionCode::US));
|
||||
$this->assertFalse($this->shortInfo->isValidShortNumberForRegion($this->parse('+4640404', RegionCode::SE), RegionCode::US));
|
||||
$this->assertEquals(ShortNumberCost::UNKNOWN_COST, $this->shortInfo->getExpectedCostForRegion($this->parse('+4640404', RegionCode::SE), RegionCode::US));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $number
|
||||
* @param string $regionCode
|
||||
* @return PhoneNumber
|
||||
*/
|
||||
private function parse($number, $regionCode)
|
||||
{
|
||||
try {
|
||||
return $this->phoneUtil->parse($number, $regionCode);
|
||||
} catch (NumberParseException $e) {
|
||||
$this->fail("Test input data should always parse correctly: " . $number . " (" . $regionCode . ")");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,156 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\core;
|
||||
|
||||
use libphonenumber\CountryCodeToRegionCodeMapForTesting;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use libphonenumber\RegionCode;
|
||||
use libphonenumber\ShortNumberUtil;
|
||||
|
||||
class ShortNumberUtilTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private static $plusSymbol;
|
||||
/**
|
||||
* @var ShortNumberUtil
|
||||
*/
|
||||
private $shortUtil;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
self::$plusSymbol = pack('H*', 'efbc8b');
|
||||
|
||||
PhoneNumberUtil::resetInstance();
|
||||
$this->shortUtil = new ShortNumberUtil(
|
||||
PhoneNumberUtil::getInstance(
|
||||
PhoneNumberUtilTest::TEST_META_DATA_FILE_PREFIX,
|
||||
CountryCodeToRegionCodeMapForTesting::$countryCodeToRegionCodeMapForTesting
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_US()
|
||||
{
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("911", RegionCode::US));
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("112", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberLongNumber_US()
|
||||
{
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("9116666666", RegionCode::US));
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("1126666666", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("9996666666", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberWithFormatting_US()
|
||||
{
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("9-1-1", RegionCode::US));
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("1-1-2", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("9-9-9", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberWithPlusSign_US()
|
||||
{
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("+911", RegionCode::US));
|
||||
$this->assertFalse(
|
||||
$this->shortUtil->connectsToEmergencyNumber(self::$plusSymbol . "911", RegionCode::US)
|
||||
);
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber(" +911", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("+112", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("+999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_BR()
|
||||
{
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("911", RegionCode::BR));
|
||||
$this->assertTrue($this->shortUtil->connectsToEmergencyNumber("190", RegionCode::BR));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("999", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumberLongNumber_BR()
|
||||
{
|
||||
// Brazilian emergency numbers don't work when additional digits are appended.
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("9111", RegionCode::BR));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("1900", RegionCode::BR));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("9996", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_AO()
|
||||
{
|
||||
// Angola doesn't have any metadata for emergency numbers in the test metadata.
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("911", RegionCode::AO));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("222123456", RegionCode::BR));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("923123456", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testConnectsToEmergencyNumber_ZW()
|
||||
{
|
||||
// Zimbabwe doesn't have any metadata in the test metadata.
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("911", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("01312345", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortUtil->connectsToEmergencyNumber("0711234567", RegionCode::ZW));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_US()
|
||||
{
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("911", RegionCode::US));
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("112", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberLongNumber_US()
|
||||
{
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("9116666666", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("1126666666", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("9996666666", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberWithFormatting_US()
|
||||
{
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("9-1-1", RegionCode::US));
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("*911", RegionCode::US));
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("1-1-2", RegionCode::US));
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("*112", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("9-9-9", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("*999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberWithPlusSign_US()
|
||||
{
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("+911", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber(self::$plusSymbol . "911", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber(" +911", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("+112", RegionCode::US));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("+999", RegionCode::US));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_BR()
|
||||
{
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("911", RegionCode::BR));
|
||||
$this->assertTrue($this->shortUtil->isEmergencyNumber("190", RegionCode::BR));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("999", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumberLongNumber_BR()
|
||||
{
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("9111", RegionCode::BR));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("1900", RegionCode::BR));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("9996", RegionCode::BR));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_AO()
|
||||
{
|
||||
// Angola doesn't have any metadata for emergency numbers in the test metadata.
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("911", RegionCode::AO));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("222123456", RegionCode::AO));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("923123456", RegionCode::AO));
|
||||
}
|
||||
|
||||
public function testIsEmergencyNumber_ZW()
|
||||
{
|
||||
// Zimbabwe doesn't have any metadata in the test metadata.
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("911", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("01312345", RegionCode::ZW));
|
||||
$this->assertFalse($this->shortUtil->isEmergencyNumber("0711234567", RegionCode::ZW));
|
||||
}
|
||||
}
|
@@ -1,182 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{8}',
|
||||
'ExampleNumber' => '12345678',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '-1',
|
||||
1 => '8',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '12345678',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '-1',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '12345678',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '-1',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{8}',
|
||||
'ExampleNumber' => '12345678',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '8',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => '001',
|
||||
'countryCode' => 800,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => true,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,182 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '123456789',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '-1',
|
||||
1 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '123456789',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '-1',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '123456789',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '-1',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '123456789',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => '001',
|
||||
'countryCode' => 979,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'AD',
|
||||
'countryCode' => 376,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,164 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '600\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '600123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'AE',
|
||||
'countryCode' => 971,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,179 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[29]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '2\\d(?:[26-9]\\d|\\d[26-9])\\d{5}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '222123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '9[1-3]\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '923123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'AO',
|
||||
'countryCode' => 244,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0~0',
|
||||
'nationalPrefixForParsing' => '0~0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,299 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-3689]\\d{9,10}',
|
||||
'PossibleNumberPattern' => '\\d{6,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => 6,
|
||||
1 => 7,
|
||||
2 => 8,
|
||||
3 => 9,
|
||||
4 => 10,
|
||||
5 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-3]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{6,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => 6,
|
||||
1 => 7,
|
||||
2 => 8,
|
||||
3 => 9,
|
||||
4 => 10,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '9\\d{10}|[1-3]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
1 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '6(0\\d|10)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'AR',
|
||||
'countryCode' => 54,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0(?:(11|343|3715)15)?',
|
||||
'nationalPrefixTransformRule' => '9$1',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '11',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1[02-9]|[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(9)(11)(\\d{4})(\\d{4})',
|
||||
'format' => '$2 15 $3-$4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '911',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(9)(\\d{4})(\\d{2})(\\d{4})',
|
||||
'format' => '$2 $3-$4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '9(?:1[02-9]|[23])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '0$1 $CC',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[68]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '11',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1[02-9]|[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(9)(11)(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '911',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(9)(\\d{4})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '9(?:1[02-9]|[23])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[68]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,194 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-578]\\d{4,14}',
|
||||
'PossibleNumberPattern' => '\\d{5,15}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
1 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[2378]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '4\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1800\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '190[0126]\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'AU',
|
||||
'countryCode' => 61,
|
||||
'internationalPrefix' => '001[12]',
|
||||
'preferredInternationalPrefix' => '0011',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{1})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[2-478]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'BB',
|
||||
'countryCode' => 1,
|
||||
'internationalPrefix' => '011',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'BR',
|
||||
'countryCode' => 55,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,165 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '(242|8(00|66|77|88)|900)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{7,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
0 => '7',
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3-57]|9[2-5])|4(?:2[237]|51|64|77)|502|636|702)\\d{4}',
|
||||
'PossibleNumberPattern' => '\\d{7,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '242(357|359|457|557)\\d{4}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(00|66|77|88)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'BS',
|
||||
'countryCode' => 1,
|
||||
'internationalPrefix' => '011',
|
||||
'nationalPrefix' => '1',
|
||||
'nationalPrefixForParsing' => '1',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,203 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{5}',
|
||||
'PossibleNumberPattern' => '\\d{6}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '6',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{5}',
|
||||
'PossibleNumberPattern' => '\\d{6}',
|
||||
'ExampleNumber' => '112345',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{5}',
|
||||
'PossibleNumberPattern' => '\\d{6}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'BY',
|
||||
'countryCode' => 375,
|
||||
'internationalPrefix' => '810',
|
||||
'nationalPrefix' => '8',
|
||||
'nationalPrefixForParsing' => '80?|99999',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})',
|
||||
'format' => '$1',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[1-8]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '8 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{3})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[1-8]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '8$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[1-8]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '8 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'CA',
|
||||
'countryCode' => 1,
|
||||
'internationalPrefix' => '011',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'CC',
|
||||
'countryCode' => 61,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,194 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-7]\\d{6,11}|8[0-357-9]\\d{6,9}|9\\d{7,10}',
|
||||
'PossibleNumberPattern' => '\\d{4,12}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[2-9]\\d{10}',
|
||||
'PossibleNumberPattern' => '\\d{11}',
|
||||
'ExampleNumber' => '91234567',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1(?:[38]\\d|4[57]|5[0-35-9]|7[0136-8])\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{11}',
|
||||
'ExampleNumber' => '13123456789',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'CN',
|
||||
'countryCode' => 86,
|
||||
'internationalPrefix' => '',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{5,6})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[3-9]',
|
||||
1 => '[3-9]\\d{2}[19]',
|
||||
2 => '[3-9]\\d{2}(?:10|95)',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '$CC $1',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{8})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'CX',
|
||||
'countryCode' => 61,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,253 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{4,14}',
|
||||
'PossibleNumberPattern' => '\\d{2,14}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => 4,
|
||||
1 => 5,
|
||||
2 => 6,
|
||||
3 => 7,
|
||||
4 => 8,
|
||||
5 => 9,
|
||||
6 => 10,
|
||||
7 => 11,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
0 => '2',
|
||||
1 => '3',
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '(?:[24-6]\\d{2}|3[03-9]\\d|[789](?:0[2-9]|[1-9]\\d))\\d{1,8}',
|
||||
'PossibleNumberPattern' => '\\d{2,14}',
|
||||
'ExampleNumber' => '30123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1(5\\d{9}|7\\d{8}|6[02]\\d{8}|63\\d{7})',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
1 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900([135]\\d{6}|9\\d{7})',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
1 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'DE',
|
||||
'countryCode' => 49,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3,8})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '2|3[3-9]|906|[4-9][1-9]1',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4,11})',
|
||||
'format' => '$1/$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[34]0|[68]9',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '([4-9]\\d)(\\d{2})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[4-9]',
|
||||
1 => '[4-6]|[7-9](?:\\d[1-9]|[1-9]\\d)',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '([4-9]\\d{3})(\\d{2,7})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[4-9]',
|
||||
1 => '[4-6]|[7-9](?:\\d[1-9]|[1-9]\\d)',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{1})(\\d{6})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '800',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3,4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '900',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,177 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '3\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{7}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '3\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{7}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '3\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{7}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'FR',
|
||||
'countryCode' => 33,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{2})(\\d{2})(\\d{2})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '3',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{10}',
|
||||
'PossibleNumberPattern' => '\\d{6,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
0 => '6',
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-6]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{6,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '7[1-57-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '9[018]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(?:4[3-5]|7[0-2])\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '70\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '56\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '76\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'GB',
|
||||
'countryCode' => 44,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[1-59]|[78]0',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '(0$1)',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '6',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '(0$1)',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '7[1-57-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '(0$1)',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '8[47]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '(0$1)',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => true,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'GG',
|
||||
'countryCode' => 44,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,166 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '30\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '30\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '30\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'HU',
|
||||
'countryCode' => 36,
|
||||
'internationalPrefix' => '',
|
||||
'nationalPrefix' => '06',
|
||||
'nationalPrefixForParsing' => '06',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,221 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[0389]\\d{5,10}',
|
||||
'PossibleNumberPattern' => '\\d{6,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '6',
|
||||
1 => '9',
|
||||
2 => '10',
|
||||
3 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '0\\d{9,10}',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
1 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '3\\d{8,9}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
1 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80(?:0\\d{6}|3\\d{3})',
|
||||
'PossibleNumberPattern' => '\\d{6,9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '6',
|
||||
1 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '89(?:2\\d{3}|9\\d{6})',
|
||||
'PossibleNumberPattern' => '\\d{6,9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '6',
|
||||
1 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'IT',
|
||||
'countryCode' => 39,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '0[26]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{4})(\\d{3,4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '0[13-57-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '3',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3,6})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '8',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => true,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,263 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '07\\d{5}|[1-357-9]\\d{3,10}',
|
||||
'PossibleNumberPattern' => '\\d{4,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => 4,
|
||||
1 => 5,
|
||||
2 => 6,
|
||||
3 => 7,
|
||||
4 => 8,
|
||||
5 => 9,
|
||||
6 => 10,
|
||||
7 => 11,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '07\\d{5}|[1-357-9]\\d{3,10}',
|
||||
'PossibleNumberPattern' => '\\d{4,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '07\\d{5}|[1-357-9]\\d{3,10}',
|
||||
'PossibleNumberPattern' => '\\d{4,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '0777[01]\\d{2}',
|
||||
'PossibleNumberPattern' => '\\d{7}',
|
||||
'ExampleNumber' => '0777012',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '7',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[23]\\d{3}',
|
||||
'PossibleNumberPattern' => '\\d{4}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '4',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'JP',
|
||||
'countryCode' => 81,
|
||||
'internationalPrefix' => '010',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[57-9]0',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{2})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[57-9]0',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '111|222|333',
|
||||
1 => '(?:111|222|333)1',
|
||||
2 => '(?:111|222|333)11',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d)(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '222|333',
|
||||
1 => '2221|3332',
|
||||
2 => '22212|3332',
|
||||
3 => '222120|3332',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '077',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})',
|
||||
'format' => '*$1',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => true,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,336 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-7]\\d{3,9}|8\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{4,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => 4,
|
||||
1 => 5,
|
||||
2 => 6,
|
||||
3 => 7,
|
||||
4 => 8,
|
||||
5 => 9,
|
||||
6 => 10,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '(?:2|[34][1-3]|5[1-5]|6[1-4])(?:1\\d{2,3}|[2-9]\\d{6,7})',
|
||||
'PossibleNumberPattern' => '\\d{4,10}',
|
||||
'ExampleNumber' => '22123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1[0-25-9]\\d{7,8}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
'ExampleNumber' => '1023456789',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
1 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '801234567',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '60[2-9]\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '602345678',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '50\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '5012345678',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '70\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '7012345678',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'KR',
|
||||
'countryCode' => 82,
|
||||
'internationalPrefix' => '00(?:[124-68]|[37]\\d{2})',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0(8[1-46-8]|85\\d{2})?',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
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' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1(?:[169][2-8]|[78]|5[1-4])|[68]0|[3-6][1-9][2-9]',
|
||||
1 => '1(?:[169][2-8]|[78]|5(?:[1-3]|4[56]))|[68]0|[3-6][1-9][2-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d)(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '131',
|
||||
1 => '1312',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{2})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '131',
|
||||
1 => '131[13-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '13[2-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{2})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3-$4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '30',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{4})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '2(?:[26]|3[0-467])',
|
||||
1 => '2(?:[26]|3(?:01|1[45]|2[17-9]|39|4|6[67]|7[078]))',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '2(?:3[0-35-9]|[457-9])',
|
||||
1 => '2(?:3(?:0[02-9]|1[0-36-9]|2[02-6]|3[0-8]|6[0-589]|7[1-69]|[589])|[457-9])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{3})',
|
||||
'format' => '$1-$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '21[0-46-9]',
|
||||
1 => '21(?:[0-247-9]|3[124]|6[1269])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
9 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{4})',
|
||||
'format' => '$1-$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '21[36]',
|
||||
1 => '21(?:3[035-9]|6[03-578])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
10 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{3})',
|
||||
'format' => '$1-$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[3-6][1-9]1',
|
||||
1 => '[3-6][1-9]1(?:[0-46-9])',
|
||||
2 => '[3-6][1-9]1(?:[0-247-9]|3[124]|6[1269])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
11 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})',
|
||||
'format' => '$1-$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[3-6][1-9]1',
|
||||
1 => '[3-6][1-9]1[36]',
|
||||
2 => '[3-6][1-9]1(?:3[035-9]|6[03-578])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,291 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{9,10}',
|
||||
'PossibleNumberPattern' => '\\d{7,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
1 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
0 => '7',
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[2-9]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{7,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1\\d{10}',
|
||||
'PossibleNumberPattern' => '\\d{11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'MX',
|
||||
'countryCode' => 52,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '01',
|
||||
'nationalPrefixForParsing' => '01|04[45](\\d{10})',
|
||||
'nationalPrefixTransformRule' => '1$1',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[89]00',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '33|55|81',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(1)(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '045 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1(?:33|55|81)',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(1)(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '045 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[89]00',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '33|55|81',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[2467]|3[0-24-9]|5[0-46-9]|8[2-9]|9[1-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(1)(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1(?:33|55|81)',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(1)(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1(?:[124579]|3[0-24-9]|5[0-46-9]|8[02-9])',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,212 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[289]\\d{7,9}|[3-7]\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{7,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '7',
|
||||
1 => '8',
|
||||
2 => 9,
|
||||
3 => 10,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '24099\\d{3}|(?:3[2-79]|[479][2-689]|6[235-9])\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{7,8}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '7',
|
||||
1 => '8',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '2(?:[027]\\d{7}|9\\d{6,7}|1(?:0\\d{5,7}|[12]\\d{5,6}|[3-9]\\d{5})|4[1-9]\\d{6}|8\\d{7,8})',
|
||||
'PossibleNumberPattern' => '\\d{8,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => 8,
|
||||
1 => 9,
|
||||
2 => 10,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{6,7}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
1 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{6,7}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
1 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'NZ',
|
||||
'countryCode' => 64,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '24|[34679]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{3})(\\d{3,5})',
|
||||
'format' => '$1-$2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '2[179]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[89]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,175 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '(?:5[01]|6[069]|7[289]|88)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '70\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'PL',
|
||||
'countryCode' => 48,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,180 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[268]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '262\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '262161234',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '6(?:9[23]|47)\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '692123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '801234567',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(?:1[01]|2[0156]|84|9[0-37-9])\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '810123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'RE',
|
||||
'countryCode' => 262,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '([268]\\d{2})(\\d{2})(\\d{2})(\\d{2})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingDigits' => '262|6(?:9[23]|47)|8',
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'SE',
|
||||
'countryCode' => 46,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,206 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[13689]\\d{7,10}',
|
||||
'PossibleNumberPattern' => '\\d{8}|\\d{10,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '8',
|
||||
1 => '10',
|
||||
2 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[36]\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{8}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '8',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[89]\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{8}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '8',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1?800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
1 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{11}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '11',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'SG',
|
||||
'countryCode' => 65,
|
||||
'internationalPrefix' => '0[0-3][0-9]',
|
||||
'nationalPrefixForParsing' => '777777',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[369]|8[1-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1[89]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '800',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => false,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,203 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[13-689]\\d{9}|2[0-35-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{7}(?:\\d{3})?',
|
||||
'ExampleNumber' => '1234567890',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '10',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[13-689]\\d{9}|2[0-35-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{7}(?:\\d{3})?',
|
||||
'ExampleNumber' => '1234567890',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[13-689]\\d{9}|2[0-35-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{7}(?:\\d{3})?',
|
||||
'ExampleNumber' => '1234567890',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(?:00|66|77|88)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '1234567890',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '1234567890',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '1234567890',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'US',
|
||||
'countryCode' => 1,
|
||||
'internationalPrefix' => '011',
|
||||
'nationalPrefix' => '1',
|
||||
'preferredExtnPrefix' => ' extn. ',
|
||||
'nationalPrefixForParsing' => '1',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
'nationalPrefixOptionalWhenFormatting' => true,
|
||||
),
|
||||
),
|
||||
'mainCountryForCode' => true,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => true,
|
||||
);
|
@@ -1,169 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[268]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => '9',
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '2696[0-4]\\d{4}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '269601234',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '639\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '639123456',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '801234567',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'PossibleLength' =>
|
||||
array (
|
||||
0 => -1,
|
||||
),
|
||||
'PossibleLengthLocalOnly' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
'id' => 'YT',
|
||||
'countryCode' => 262,
|
||||
'internationalPrefix' => '00',
|
||||
'nationalPrefix' => '0',
|
||||
'nationalPrefixForParsing' => '0',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingDigits' => '269|639',
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -1,205 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\geocoding;
|
||||
|
||||
use libphonenumber\geocoding\PhoneNumberOfflineGeocoder;
|
||||
use libphonenumber\PhoneNumber;
|
||||
|
||||
class PhoneNumberOfflineGeocoderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
const TEST_META_DATA_FILE_PREFIX = "/../../../Tests/libphonenumber/Tests/prefixmapper/data/";
|
||||
private static $KO_Number1;
|
||||
private static $KO_Number2;
|
||||
private static $KO_Number3;
|
||||
private static $KO_InvalidNumber;
|
||||
private static $KO_Mobile;
|
||||
private static $US_Number1;
|
||||
private static $US_Number2;
|
||||
private static $US_Number3;
|
||||
private static $US_Number4;
|
||||
private static $US_InvalidNumber;
|
||||
private static $NANPA_TollFree;
|
||||
private static $BS_Number1;
|
||||
private static $AU_Number;
|
||||
private static $AR_MobileNumber;
|
||||
private static $numberWithInvalidCountryCode;
|
||||
private static $internationalTollFree;
|
||||
/**
|
||||
* @var PhoneNumberOfflineGeocoder
|
||||
*/
|
||||
protected $geocoder;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$KO_Number1 = new PhoneNumber();
|
||||
self::$KO_Number1->setCountryCode(82)->setNationalNumber(22123456);
|
||||
|
||||
self::$KO_Number2 = new PhoneNumber();
|
||||
self::$KO_Number2->setCountryCode(82)->setNationalNumber(322123456);
|
||||
|
||||
self::$KO_Number3 = new PhoneNumber();
|
||||
self::$KO_Number3->setCountryCode(82)->setNationalNumber(6421234567);
|
||||
|
||||
self::$KO_InvalidNumber = new PhoneNumber();
|
||||
self::$KO_InvalidNumber->setCountryCode(82)->setNationalNumber(1234);
|
||||
|
||||
self::$KO_Mobile = new PhoneNumber();
|
||||
self::$KO_Mobile->setCountryCode(82)->setNationalNumber(101234567);
|
||||
|
||||
self::$US_Number1 = new PhoneNumber();
|
||||
self::$US_Number1->setCountryCode(1)->setNationalNumber(6502530000);
|
||||
|
||||
self::$US_Number2 = new PhoneNumber();
|
||||
self::$US_Number2->setCountryCode(1)->setNationalNumber(6509600000);
|
||||
|
||||
self::$US_Number3 = new PhoneNumber();
|
||||
self::$US_Number3->setCountryCode(1)->setNationalNumber(2128120000);
|
||||
|
||||
self::$US_Number4 = new PhoneNumber();
|
||||
self::$US_Number4->setCountryCode(1)->setNationalNumber(6174240000);
|
||||
|
||||
self::$US_InvalidNumber = new PhoneNumber();
|
||||
self::$US_InvalidNumber->setCountryCode(1)->setNationalNumber(123456789);
|
||||
|
||||
self::$NANPA_TollFree = new PhoneNumber();
|
||||
self::$NANPA_TollFree->setCountryCode(1)->setNationalNumber(8002431234);
|
||||
|
||||
self::$BS_Number1 = new PhoneNumber();
|
||||
self::$BS_Number1->setCountryCode(1)->setNationalNumber(2423651234);
|
||||
|
||||
self::$AU_Number = new PhoneNumber();
|
||||
self::$AU_Number->setCountryCode(61)->setNationalNumber(236618300);
|
||||
|
||||
self::$AR_MobileNumber = new PhoneNumber();
|
||||
self::$AR_MobileNumber->setCountryCode(54)->setNationalNumber(92214000000);
|
||||
|
||||
self::$numberWithInvalidCountryCode = new PhoneNumber();
|
||||
self::$numberWithInvalidCountryCode->setCountryCode(999)->setNationalNumber(2423651234);
|
||||
|
||||
self::$internationalTollFree = new PhoneNumber();
|
||||
self::$internationalTollFree->setCountryCode(800)->setNationalNumber(12345678);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberOfflineGeocoder::resetInstance();
|
||||
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance(self::TEST_META_DATA_FILE_PREFIX);
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumberWithNoDataFile()
|
||||
{
|
||||
// No data file containing mappings for US numbers is available in Chinese for the unittests. As
|
||||
// a result, the country name of United States in simplified Chinese is returned.
|
||||
|
||||
$this->assertEquals(
|
||||
pack('H*', 'e7be8e') . pack('H*', 'e59bbd'),
|
||||
$this->geocoder->getDescriptionForNumber(self::$US_Number1, "zh_CN")
|
||||
);
|
||||
$this->assertEquals("Bahamas", $this->geocoder->getDescriptionForNumber(self::$BS_Number1, "en_US"));
|
||||
$this->assertEquals("Australia", $this->geocoder->getDescriptionForNumber(self::$AU_Number, "en_US"));
|
||||
$this->assertEquals("", $this->geocoder->getDescriptionForNumber(self::$numberWithInvalidCountryCode, "en_US"));
|
||||
$this->assertEquals("", $this->geocoder->getDescriptionForNumber(self::$internationalTollFree, "en_US"));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumberWithMissingPrefix()
|
||||
{
|
||||
// Test that the name of the country is returned when the number passed in is valid but not
|
||||
// covered by the geocoding data file.
|
||||
|
||||
$this->assertEquals("United States", $this->geocoder->getDescriptionForNumber(self::$US_Number4, "en_US"));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumberBelongingToMultipleCountriesIsEmpty()
|
||||
{
|
||||
// Test that nothing is returned when the number passed in is valid but not
|
||||
// covered by the geocoding data file and belongs to multiple countries
|
||||
$this->assertEquals("", $this->geocoder->getDescriptionForNumber(self::$NANPA_TollFree, 'en_US'));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumber_en_US()
|
||||
{
|
||||
$ca = $this->geocoder->getDescriptionForNumber(self::$US_Number1, "en_US");
|
||||
$this->assertEquals("CA", $ca);
|
||||
$this->assertEquals("Mountain View, CA", $this->geocoder->getDescriptionForNumber(self::$US_Number2, "en_US"));
|
||||
$this->assertEquals("New York, NY", $this->geocoder->getDescriptionForNumber(self::$US_Number3, "en_US"));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForKoreanNumber()
|
||||
{
|
||||
$this->assertEquals("Seoul", $this->geocoder->getDescriptionForNumber(self::$KO_Number1, "en"));
|
||||
$this->assertEquals("Incheon", $this->geocoder->getDescriptionForNumber(self::$KO_Number2, "en"));
|
||||
$this->assertEquals("Jeju", $this->geocoder->getDescriptionForNumber(self::$KO_Number3, "en"));
|
||||
|
||||
$this->assertEquals(
|
||||
pack('H*', 'ec849c') . pack('H*', 'ec9ab8'),
|
||||
$this->geocoder->getDescriptionForNumber(self::$KO_Number1, "ko")
|
||||
);
|
||||
$this->assertEquals(
|
||||
pack('H*', 'ec9db8') . pack('H*', 'ecb29c'),
|
||||
$this->geocoder->getDescriptionForNumber(self::$KO_Number2, "ko")
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetDescriptionForArgentinianMobileNumber()
|
||||
{
|
||||
$this->assertEquals("La Plata", $this->geocoder->getDescriptionForNumber(self::$AR_MobileNumber, "en"));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForFallBack()
|
||||
{
|
||||
// No fallback, as the location name for the given phone number is available in the requested
|
||||
// language.
|
||||
|
||||
$this->assertEquals("Kalifornien", $this->geocoder->getDescriptionForNumber(self::$US_Number1, "de"));
|
||||
|
||||
// German falls back to English.
|
||||
$this->assertEquals("New York, NY", $this->geocoder->getDescriptionForNumber(self::$US_Number3, "de"));
|
||||
|
||||
// Italian fals back to English.
|
||||
$this->assertEquals("CA", $this->geocoder->getDescriptionForNumber(self::$US_Number1, "it"));
|
||||
|
||||
// Korean doesn't fall back to English. -
|
||||
$this->assertEquals(
|
||||
pack('H*', 'eb8c80') . pack('H*', 'ed959c') . pack('H*', 'ebafbc') . pack('H*', 'eab5ad'),
|
||||
$this->geocoder->getDescriptionForNumber(self::$KO_Number3, "ko")
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumberWithUserRegion()
|
||||
{
|
||||
// User in Italy, American number. We should just show United States, in Spanish, and not more
|
||||
// detailed information.
|
||||
$this->assertEquals(
|
||||
"Estados Unidos",
|
||||
$this->geocoder->getDescriptionForNumber(self::$US_Number1, "es_ES", "IT")
|
||||
);
|
||||
|
||||
// Unknown region - should just show country name.
|
||||
$this->assertEquals(
|
||||
"Estados Unidos",
|
||||
$this->geocoder->getDescriptionForNumber(self::$US_Number1, "es_ES", "ZZ")
|
||||
);
|
||||
|
||||
// User in the States, language German, should show detailed data.
|
||||
$this->assertEquals("Kalifornien", $this->geocoder->getDescriptionForNumber(self::$US_Number1, "de", "US"));
|
||||
|
||||
// User in the States, language French, no data for French, so we fallback to English detailed
|
||||
// data.
|
||||
$this->assertEquals("CA", $this->geocoder->getDescriptionForNumber(self::$US_Number1, "fr", "US"));
|
||||
|
||||
// Invalid number - return an empty string.
|
||||
$this->assertEquals("", $this->geocoder->getDescriptionForNumber(self::$US_InvalidNumber, "en", "US"));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForInvalidNumber()
|
||||
{
|
||||
$this->assertEquals("", $this->geocoder->getDescriptionForNumber(self::$KO_InvalidNumber, "en"));
|
||||
$this->assertEquals("", $this->geocoder->getDescriptionForNumber(self::$US_InvalidNumber, "en"));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNonGeographicalNumberWithGeocodingPrefix()
|
||||
{
|
||||
// We have a geocoding prefix, but we shouldn't use it since this is not geographical.
|
||||
$this->assertEquals("South Korea", $this->geocoder->getDescriptionForNumber(self::$KO_Mobile, 'en'));
|
||||
}
|
||||
}
|
@@ -1,78 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\prefixmapper;
|
||||
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\prefixmapper\PrefixFileReader;
|
||||
|
||||
class PrefixFileReaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
const TEST_META_DATA_FILE_PREFIX = "/data/";
|
||||
private static $KO_NUMBER;
|
||||
private static $US_NUMBER1;
|
||||
private static $US_NUMBER2;
|
||||
private static $US_NUMBER3;
|
||||
private static $SE_NUMBER;
|
||||
/**
|
||||
* @var PrefixFileReader
|
||||
*/
|
||||
protected $reader;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$KO_NUMBER = new PhoneNumber();
|
||||
self::$KO_NUMBER->setCountryCode(82)->setNationalNumber(22123456);
|
||||
|
||||
self::$US_NUMBER1 = new PhoneNumber();
|
||||
self::$US_NUMBER1->setCountryCode(1)->setNationalNumber(6502530000);
|
||||
|
||||
self::$US_NUMBER2 = new PhoneNumber();
|
||||
self::$US_NUMBER2->setCountryCode(1)->setNationalNumber(2128120000);
|
||||
|
||||
self::$US_NUMBER3 = new PhoneNumber();
|
||||
self::$US_NUMBER3->setCountryCode(1)->setNationalNumber(6174240000);
|
||||
|
||||
self::$SE_NUMBER = new PhoneNumber();
|
||||
self::$SE_NUMBER->setCountryCode(46)->setNationalNumber(81234567);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->reader = new PrefixFileReader(__DIR__ . DIRECTORY_SEPARATOR . self::TEST_META_DATA_FILE_PREFIX);
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumberWithMapping()
|
||||
{
|
||||
$this->assertEquals("Kalifornien", $this->reader->getDescriptionForNumber(self::$US_NUMBER1, "de", "", "CH"));
|
||||
$this->assertEquals("CA", $this->reader->getDescriptionForNumber(self::$US_NUMBER1, "en", "", "AU"));
|
||||
$this->assertEquals(
|
||||
pack('H*', 'ec849c') . pack('H*', 'ec9ab8'),
|
||||
$this->reader->getDescriptionForNumber(self::$KO_NUMBER, "ko", "", "")
|
||||
);
|
||||
$this->assertEquals("Seoul", $this->reader->getDescriptionForNumber(self::$KO_NUMBER, "en", "", ""));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumberWithMissingMapping()
|
||||
{
|
||||
$this->assertEquals("", $this->reader->getDescriptionForNumber(self::$US_NUMBER3, "en", "", ""));
|
||||
}
|
||||
|
||||
public function testGetDescriptionUsingFallbackLanguage()
|
||||
{
|
||||
// Mapping file exists but the number isn't present, causing it to fallback.
|
||||
$this->assertEquals("New York, NY", $this->reader->getDescriptionForNumber(self::$US_NUMBER2, "de", "", "CH"));
|
||||
// No mapping file exists, causing it to fallback.
|
||||
$this->assertEquals("New York, NY", $this->reader->getDescriptionForNumber(self::$US_NUMBER2, "sv", "", ""));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNonFallbackLanguage()
|
||||
{
|
||||
$this->assertEquals("", $this->reader->getDescriptionForNumber(self::$US_NUMBER2, "ko", "", ""));
|
||||
}
|
||||
|
||||
public function testGetDescriptionForNumberWithoutMappingFile()
|
||||
{
|
||||
$this->assertEquals("", $this->reader->getDescriptionForNumber(self::$SE_NUMBER, "sv", "", ""));
|
||||
$this->assertEquals("", $this->reader->getDescriptionForNumber(self::$SE_NUMBER, "en", "", ""));
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
'de' =>
|
||||
array (
|
||||
0 => 1201,
|
||||
1 => 1650,
|
||||
),
|
||||
'en' =>
|
||||
array (
|
||||
0 => 1201,
|
||||
1 => 1212,
|
||||
2 => 1617,
|
||||
3 => 1650,
|
||||
4 => 1989,
|
||||
5 => 54,
|
||||
6 => 82,
|
||||
),
|
||||
'ko' =>
|
||||
array (
|
||||
0 => 82,
|
||||
),
|
||||
);
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1201 => 'New Jersey',
|
||||
);
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1650 => 'Kalifornien',
|
||||
);
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1201 => 'NJ',
|
||||
);
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1212 => 'NY',
|
||||
1212812 => 'New York, NY',
|
||||
);
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1617423 => 'Boston, MA',
|
||||
);
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1650 => 'CA',
|
||||
1650960 => 'Mountain View, CA',
|
||||
);
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1989 => 'MA',
|
||||
);
|
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
542214 => 'La Plata',
|
||||
);
|
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
8210 => 'Mobile prefix, should not be geocoded.',
|
||||
822 => 'Seoul',
|
||||
8231 => 'Gyeonggi',
|
||||
8232 => 'Incheon',
|
||||
8233 => 'Gangwon',
|
||||
8241 => 'Chungnam',
|
||||
8242 => 'Daejeon',
|
||||
8243 => 'Chungbuk',
|
||||
8251 => 'Busan',
|
||||
8252 => 'Ulsan',
|
||||
8253 => 'Daegu',
|
||||
8254 => 'Gyeongbuk',
|
||||
8255 => 'Gyeongnam',
|
||||
8261 => 'Jeonnam',
|
||||
8262 => 'Gwangju',
|
||||
8263 => 'Jeonbuk',
|
||||
8264 => 'Jeju',
|
||||
);
|
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
822 => '서울',
|
||||
8231 => '경기',
|
||||
8232 => '인천',
|
||||
8233 => '강원',
|
||||
8241 => '충남',
|
||||
8242 => '대전',
|
||||
8243 => '충북',
|
||||
8251 => '부산',
|
||||
8252 => '울산',
|
||||
8253 => '대구',
|
||||
8254 => '경북',
|
||||
8255 => '경남',
|
||||
8261 => '전남',
|
||||
8262 => '광주',
|
||||
8263 => '전북',
|
||||
);
|
@@ -1,123 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\timezone;
|
||||
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\prefixmapper\PrefixTimeZonesMap;
|
||||
|
||||
class PrefixTimeZonesMapTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
// US time zones
|
||||
const CHICAGO_TZ = "America/Chicago";
|
||||
const DENVER_TZ = "America/Denver";
|
||||
const LOS_ANGELES_TZ = "America/Los_Angeles";
|
||||
const NEW_YORK_TZ = "America/New_York";
|
||||
|
||||
// Russian time zones
|
||||
const IRKUTSK_TZ = "Asia/Irkutsk";
|
||||
const MOSCOW_TZ = "Europe/Moscow";
|
||||
const VLADIVOSTOK_TZ = "Asia/Vladivostok";
|
||||
const YEKATERINBURG_TZ = "Asia/Yekaterinburg";
|
||||
/**
|
||||
* @var PrefixTimeZonesMap
|
||||
*/
|
||||
private static $prefixTimeZonesMapForUS;
|
||||
/**
|
||||
* @var PrefixTimeZonesMap
|
||||
*/
|
||||
private static $prefixTimeZonesMapForRU;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
$sortedMapForUS = array();
|
||||
$sortedMapForUS[1] = self::NEW_YORK_TZ . "&" . self::CHICAGO_TZ . "&" . self::LOS_ANGELES_TZ . "&" . self::DENVER_TZ;
|
||||
$sortedMapForUS[1201] = self::NEW_YORK_TZ;
|
||||
$sortedMapForUS[1205] = self::CHICAGO_TZ;
|
||||
$sortedMapForUS[1208292] = self::LOS_ANGELES_TZ;
|
||||
$sortedMapForUS[1208234] = self::DENVER_TZ;
|
||||
$sortedMapForUS[1541367] = self::LOS_ANGELES_TZ;
|
||||
$sortedMapForUS[1423843] = self::NEW_YORK_TZ;
|
||||
$sortedMapForUS[1402721] = self::CHICAGO_TZ;
|
||||
$sortedMapForUS[1208888] = self::DENVER_TZ;
|
||||
|
||||
self::$prefixTimeZonesMapForUS = new PrefixTimeZonesMap($sortedMapForUS);
|
||||
|
||||
$sortedMapForRU = array();
|
||||
$sortedMapForRU[7421] = self::VLADIVOSTOK_TZ;
|
||||
$sortedMapForRU[7879] = self::MOSCOW_TZ;
|
||||
$sortedMapForRU[7342] = self::YEKATERINBURG_TZ;
|
||||
$sortedMapForRU[7395] = self::IRKUTSK_TZ;
|
||||
|
||||
self::$prefixTimeZonesMapForRU = new PrefixTimeZonesMap($sortedMapForRU);
|
||||
}
|
||||
|
||||
public function testLookupTimeZonesForNumberCountryLevel_US()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(1)->setNationalNumber(1000000000);
|
||||
|
||||
$this->assertEquals(
|
||||
array(
|
||||
self::NEW_YORK_TZ,
|
||||
self::CHICAGO_TZ,
|
||||
self::LOS_ANGELES_TZ,
|
||||
self::DENVER_TZ,
|
||||
),
|
||||
self::$prefixTimeZonesMapForUS->lookupTimeZonesForNumber($number)
|
||||
);
|
||||
}
|
||||
|
||||
public function testLookupTimeZonesForNumber_ValidNumber_Chicago()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(1)->setNationalNumber(2051235458);
|
||||
|
||||
$this->assertEquals(array(self::CHICAGO_TZ), self::$prefixTimeZonesMapForUS->lookupTimeZonesForNumber($number));
|
||||
}
|
||||
|
||||
public function testLookupTimeZonesForNumber_LA()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(1)->setNationalNumber(2082924565);
|
||||
|
||||
$this->assertEquals(array(self::LOS_ANGELES_TZ), self::$prefixTimeZonesMapForUS->lookupTimeZonesForNumber($number));
|
||||
}
|
||||
|
||||
public function testLookupTimeZonesForNumber_NY()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(1)->setNationalNumber(2016641234);
|
||||
|
||||
$this->assertEquals(array(self::NEW_YORK_TZ), self::$prefixTimeZonesMapForUS->lookupTimeZonesForNumber($number));
|
||||
}
|
||||
|
||||
public function testLookupTimeZonesForNumber_CH()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(41)->setNationalNumber(446681300);
|
||||
|
||||
$this->assertEquals(array(), self::$prefixTimeZonesMapForUS->lookupTimeZonesForNumber($number));
|
||||
}
|
||||
|
||||
public function testLookupTimeZonesForNumber_RU()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(7)->setNationalNumber(87945154);
|
||||
|
||||
$this->assertEquals(array(self::MOSCOW_TZ), self::$prefixTimeZonesMapForRU->lookupTimeZonesForNumber($number));
|
||||
|
||||
$number->setNationalNumber(421548578);
|
||||
$this->assertEquals(array(self::VLADIVOSTOK_TZ), self::$prefixTimeZonesMapForRU->lookupTimeZonesForNumber($number));
|
||||
|
||||
$number->setNationalNumber(342457897);
|
||||
$this->assertEquals(array(self::YEKATERINBURG_TZ), self::$prefixTimeZonesMapForRU->lookupTimeZonesForNumber($number));
|
||||
|
||||
// A mobile number
|
||||
$number->setNationalNumber(9342457897);
|
||||
$this->assertEquals(array(), self::$prefixTimeZonesMapForRU->lookupTimeZonesForNumber($number));
|
||||
|
||||
// An invalid number (too short)
|
||||
$number->setNationalNumber(3951);
|
||||
$this->assertEquals(array(self::IRKUTSK_TZ), self::$prefixTimeZonesMapForRU->lookupTimeZonesForNumber($number));
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\Tests\timezone;
|
||||
|
||||
use libphonenumber\PhoneNumber;
|
||||
use libphonenumber\PhoneNumberToTimeZonesMapper;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
|
||||
class UKTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
PhoneNumberUtil::resetInstance();
|
||||
}
|
||||
|
||||
public function testGBNumber()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(44)->setNationalNumber(1614960000);
|
||||
|
||||
$timeZone = PhoneNumberToTimeZonesMapper::getInstance();
|
||||
$this->assertEquals(array("Europe/London"), $timeZone->getTimeZonesForNumber($number));
|
||||
}
|
||||
|
||||
public function testNonGeocodableNumber()
|
||||
{
|
||||
$number = new PhoneNumber();
|
||||
$number->setCountryCode(44)->setNationalNumber(8001111);
|
||||
|
||||
$timeZone = PhoneNumberToTimeZonesMapper::getInstance();
|
||||
$this->assertEquals(array("Europe/London"), $timeZone->getTimeZonesForNumber($number));
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1 => 'America/New_York&America/Chicago&America/Winnipeg&America/Los_Angeles',
|
||||
1201 => 'America/New_York',
|
||||
1212812 => 'America/New_York',
|
||||
1234 => 'America/New_York',
|
||||
1604 => 'America/Winnipeg',
|
||||
1617423 => 'America/Chicago',
|
||||
1650960 => 'America/Los_Angeles',
|
||||
1989 => 'Ameriac/Los_Angeles',
|
||||
612 => 'Australia/Sydney',
|
||||
82 => 'Asia/Seoul',
|
||||
);
|
221
vendor/giggsey/libphonenumber-for-php/build.xml
vendored
221
vendor/giggsey/libphonenumber-for-php/build.xml
vendored
@@ -1,221 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="libphonenumber-for-php" default="test">
|
||||
|
||||
<property name="build.script" value="build/build.php"/>
|
||||
|
||||
<property name="git.url" value="https://github.com/googlei18n/libphonenumber.git"/>
|
||||
<property name="git.path" value="libphonenumber-data-dir"/>
|
||||
|
||||
<loadfile property="metadata.version" file="METADATA-VERSION.txt">
|
||||
<filterchain>
|
||||
<striplinecomments>
|
||||
<comment value="#" />
|
||||
</striplinecomments>
|
||||
<striplinebreaks />
|
||||
</filterchain>
|
||||
</loadfile>
|
||||
|
||||
<property name="data.testCoreData" value="Tests/libphonenumber/Tests/core/data/"/>
|
||||
<property name="data.testPrefixMapperData" value="Tests/libphonenumber/Tests/prefixmapper/data/"/>
|
||||
<property name="data.testCarrierData" value="Tests/libphonenumber/Tests/carrier/data/"/>
|
||||
<property name="data.testTimezoneData" value="Tests/libphonenumber/Tests/timezone/data/"/>
|
||||
|
||||
<property name="data.coreData" value="src/libphonenumber/data/"/>
|
||||
<property name="data.carrierData" value="src/libphonenumber/carrier/data/"/>
|
||||
<property name="data.geocodingData" value="src/libphonenumber/geocoding/data/"/>
|
||||
<property name="data.timezoneData" value="src/libphonenumber/timezone/data/"/>
|
||||
|
||||
|
||||
<target name="test" description="Run unit tests" depends="compile-test-data">
|
||||
<exec passthru="true" command="vendor/bin/phpunit"/>
|
||||
</target>
|
||||
|
||||
<target name="compile-test-data" description="Build Test Data"
|
||||
depends="cleanup-test-data,build-test-metadata,build-geo-test-data,build-carrier-test-data,build-timezones-test-data">
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Build all Data"
|
||||
depends="cleanup-data,compile-test-data,build-phone-metadata,build-short-metadata,build-alternate-metadata,build-carrier-data,build-timezones-data,build-geo-data">
|
||||
</target>
|
||||
|
||||
<target name="cleanup-test-data" description="Cleanup old built test data"
|
||||
depends="delete-test-carrierdata,delete-test-prefixmapper,delete-test-coredata,delete-test-timezone"/>
|
||||
|
||||
<target name="cleanup-data" description="Cleanup built data"
|
||||
depends="cleanup-test-data,delete-coredata,delete-carrierdata,delete-geocoding,delete-timezone"/>
|
||||
|
||||
<target name="delete-test-coredata">
|
||||
<delete dir="${data.testCoreData}"/>
|
||||
<mkdir dir="${data.testCoreData}"/>
|
||||
</target>
|
||||
|
||||
<target name="delete-test-carrierdata">
|
||||
<delete dir="${data.testCarrierData}"/>
|
||||
<mkdir dir="${data.testCarrierData}"/>
|
||||
</target>
|
||||
|
||||
<target name="delete-test-prefixmapper">
|
||||
<delete dir="${data.testPrefixMapperData}"/>
|
||||
<mkdir dir="${data.testPrefixMapperData}"/>
|
||||
</target>
|
||||
|
||||
<target name="delete-test-timezone">
|
||||
<delete dir="${data.testTimezoneData}"/>
|
||||
<mkdir dir="${data.testTimezoneData}"/>
|
||||
</target>
|
||||
|
||||
<target name="delete-coredata">
|
||||
<delete dir="${data.coreData}"/>
|
||||
<mkdir dir="${data.coreData}"/>
|
||||
</target>
|
||||
|
||||
<target name="delete-carrierdata">
|
||||
<delete dir="${data.carrierData}"/>
|
||||
<mkdir dir="${data.carrierData}"/>
|
||||
</target>
|
||||
|
||||
<target name="delete-geocoding">
|
||||
<delete dir="${data.geocodingData}"/>
|
||||
<mkdir dir="${data.geocodingData}"/>
|
||||
</target>
|
||||
|
||||
<target name="delete-timezone">
|
||||
<delete dir="${data.timezoneData}"/>
|
||||
<mkdir dir="${data.timezoneData}"/>
|
||||
</target>
|
||||
|
||||
<target name="git-pull">
|
||||
<available file="${git.path}" type="dir" property="git.path.exists" />
|
||||
<if>
|
||||
<or>
|
||||
<not>
|
||||
<isset property="git.path.exists" />
|
||||
</not>
|
||||
<isfalse value="${git.path.exists}"/>
|
||||
</or>
|
||||
<then>
|
||||
<echo>Cloning repository</echo>
|
||||
<gitclone
|
||||
repository="${git.url}"
|
||||
targetPath="${git.path}"/>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<gitfetch repository="${git.path}" all="true"/>
|
||||
<echo message="Pulling Git project @ ${metadata.version}"/>
|
||||
|
||||
<gitcheckout
|
||||
repository="${git.path}"
|
||||
branchname="${metadata.version}" quiet="false" force="true" />
|
||||
|
||||
<foreach param="filename" absparam="absfilename" target="apply-data-patch">
|
||||
<fileset dir="build/data-patches">
|
||||
<include name="*.patch" />
|
||||
</fileset>
|
||||
</foreach>
|
||||
</target>
|
||||
|
||||
<target name="apply-data-patch">
|
||||
<echo>Applying patch ${filename}</echo>
|
||||
<resolvepath propertyName="fullpath" file="${absfilename}"/>
|
||||
<patch patchfile="${fullpath}" dir="${git.path}/" strip="1" haltonfailure="true" />
|
||||
</target>
|
||||
|
||||
<target name="build-test-metadata" description="Build test Phone Metadata" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="BuildMetadataPHPFromXML"/>
|
||||
<arg value="${git.path}/resources/PhoneNumberMetadataForTesting.xml"/>
|
||||
<arg value="${data.testCoreData}"/>
|
||||
<arg value="PhoneNumberMetadataForTesting"/>
|
||||
<arg value="CountryCodeToRegionCodeMapForTesting"/>
|
||||
<arg value="src/libphonenumber/"/>
|
||||
<arg value="false"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-geo-test-data" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="GeneratePhonePrefixData"/>
|
||||
<arg value="${git.path}/resources/test/geocoding/"/>
|
||||
<arg value="${data.testPrefixMapperData}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-carrier-test-data" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="GeneratePhonePrefixData"/>
|
||||
<arg value="${git.path}/resources/test/carrier/"/>
|
||||
<arg value="${data.testCarrierData}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build-phone-metadata" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="BuildMetadataPHPFromXML"/>
|
||||
<arg value="${git.path}/resources/PhoneNumberMetadata.xml"/>
|
||||
<arg value="${data.coreData}"/>
|
||||
<arg value="PhoneNumberMetadata"/>
|
||||
<arg value="CountryCodeToRegionCodeMap"/>
|
||||
<arg value="src/libphonenumber/"/>
|
||||
<arg value="false"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-short-metadata" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="BuildMetadataPHPFromXML"/>
|
||||
<arg value="${git.path}/resources/ShortNumberMetadata.xml"/>
|
||||
<arg value="${data.coreData}"/>
|
||||
<arg value="ShortNumberMetadata"/>
|
||||
<arg value="ShortNumbersRegionCodeSet"/>
|
||||
<arg value="src/libphonenumber/"/>
|
||||
<arg value="false"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-alternate-metadata" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="BuildMetadataPHPFromXML"/>
|
||||
<arg value="${git.path}/resources/PhoneNumberAlternateFormats.xml"/>
|
||||
<arg value="${data.coreData}"/>
|
||||
<arg value="PhoneNumberAlternateFormats"/>
|
||||
<arg value="AlternateFormatsCountryCodeSet"/>
|
||||
<arg value="src/libphonenumber/"/>
|
||||
<arg value="false"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-carrier-data" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="GeneratePhonePrefixData"/>
|
||||
<arg value="${git.path}/resources/carrier/"/>
|
||||
<arg value="${data.carrierData}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-geo-data" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="GeneratePhonePrefixData"/>
|
||||
<arg value="${git.path}/resources/geocoding/"/>
|
||||
<arg value="${data.geocodingData}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-timezones-data" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="GenerateTimeZonesMapData"/>
|
||||
<arg value="${git.path}/resources/timezones/map_data.txt"/>
|
||||
<arg value="${data.timezoneData}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-timezones-test-data" depends="git-pull">
|
||||
<exec executable="${build.script}" passthru="true">
|
||||
<arg value="GenerateTimeZonesMapData"/>
|
||||
<arg value="${git.path}/resources/test/timezones/map_data.txt"/>
|
||||
<arg value="${data.testTimezoneData}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
</project>
|
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$app = new \libphonenumber\buildtools\BuildApplication();
|
||||
$app->run();
|
@@ -1,13 +0,0 @@
|
||||
diff --git a/resources/PhoneNumberMetadata.xml b/resources/PhoneNumberMetadata.xml
|
||||
index a53b48d..820598c 100644
|
||||
--- a/resources/PhoneNumberMetadata.xml
|
||||
+++ b/resources/PhoneNumberMetadata.xml
|
||||
@@ -19031,7 +19031,7 @@
|
||||
<generalDesc>
|
||||
<nationalNumberPattern>
|
||||
[12]\d{6,8}|
|
||||
- [3-57-9]\d{8}|
|
||||
+ (?:[3-5]|[7-9])\d{8}|
|
||||
6\d{5,8}
|
||||
</nationalNumberPattern>
|
||||
<possibleNumberPattern>\d{6,9}</possibleNumberPattern>
|
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools;
|
||||
|
||||
use libphonenumber\buildtools\Commands\BuildMetadataPHPFromXMLCommand;
|
||||
use libphonenumber\buildtools\Commands\GeneratePhonePrefixDataCommand;
|
||||
use libphonenumber\buildtools\Commands\GenerateTimeZonesMapDataCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
class BuildApplication extends Application
|
||||
{
|
||||
const VERSION = '5';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('libphonenumber Data Builder', self::VERSION);
|
||||
|
||||
$this->addCommands(
|
||||
array(
|
||||
new BuildMetadataPHPFromXMLCommand(),
|
||||
new GeneratePhonePrefixDataCommand(),
|
||||
new GenerateTimeZonesMapDataCommand(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,801 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools;
|
||||
|
||||
use libphonenumber\NumberFormat;
|
||||
use libphonenumber\PhoneMetadata;
|
||||
use libphonenumber\PhoneNumberDesc;
|
||||
|
||||
/**
|
||||
* Library to build phone number metadata from the XML format.
|
||||
*
|
||||
* @author Davide Mendolia
|
||||
*/
|
||||
class BuildMetadataFromXml
|
||||
{
|
||||
// String constants used to fetch the XML nodes and attributes.
|
||||
const CARRIER_CODE_FORMATTING_RULE = "carrierCodeFormattingRule";
|
||||
const COUNTRY_CODE = "countryCode";
|
||||
const EMERGENCY = "emergency";
|
||||
const EXAMPLE_NUMBER = "exampleNumber";
|
||||
const FIXED_LINE = "fixedLine";
|
||||
const FORMAT = "format";
|
||||
const GENERAL_DESC = "generalDesc";
|
||||
const INTERNATIONAL_PREFIX = "internationalPrefix";
|
||||
const INTL_FORMAT = "intlFormat";
|
||||
const LEADING_DIGITS = "leadingDigits";
|
||||
const LEADING_ZERO_POSSIBLE = "leadingZeroPossible";
|
||||
const MOBILE_NUMBER_PORTABLE_REGION = "mobileNumberPortableRegion";
|
||||
const MAIN_COUNTRY_FOR_CODE = "mainCountryForCode";
|
||||
const MOBILE = "mobile";
|
||||
const NATIONAL_NUMBER_PATTERN = "nationalNumberPattern";
|
||||
const NATIONAL_PREFIX = "nationalPrefix";
|
||||
const NATIONAL_PREFIX_FORMATTING_RULE = "nationalPrefixFormattingRule";
|
||||
const NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING = "nationalPrefixOptionalWhenFormatting";
|
||||
const NATIONAL_PREFIX_FOR_PARSING = "nationalPrefixForParsing";
|
||||
const NATIONAL_PREFIX_TRANSFORM_RULE = "nationalPrefixTransformRule";
|
||||
const NO_INTERNATIONAL_DIALLING = "noInternationalDialling";
|
||||
const NUMBER_FORMAT = "numberFormat";
|
||||
const PAGER = "pager";
|
||||
const CARRIER_SPECIFIC = 'carrierSpecific';
|
||||
const PATTERN = "pattern";
|
||||
const PERSONAL_NUMBER = "personalNumber";
|
||||
const POSSIBLE_NUMBER_PATTERN = "possibleNumberPattern";
|
||||
const POSSIBLE_LENGTHS = "possibleLengths";
|
||||
const NATIONAL = "national";
|
||||
const LOCAL_ONLY = "localOnly";
|
||||
const PREFERRED_EXTN_PREFIX = "preferredExtnPrefix";
|
||||
const PREFERRED_INTERNATIONAL_PREFIX = "preferredInternationalPrefix";
|
||||
const PREMIUM_RATE = "premiumRate";
|
||||
const SHARED_COST = "sharedCost";
|
||||
const SHORT_CODE = "shortCode";
|
||||
const STANDARD_RATE = "standardRate";
|
||||
const TOLL_FREE = "tollFree";
|
||||
const UAN = "uan";
|
||||
const VOICEMAIL = "voicemail";
|
||||
const VOIP = "voip";
|
||||
|
||||
private static $phoneNumberDescsWithoutMatchingTypes = array(
|
||||
self::NO_INTERNATIONAL_DIALLING
|
||||
);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param $regex
|
||||
* @param bool $removeWhitespace
|
||||
* @return string
|
||||
*/
|
||||
public static function validateRE($regex, $removeWhitespace = false)
|
||||
{
|
||||
$compressedRegex = $removeWhitespace ? preg_replace('/\\s/', '', $regex) : $regex;
|
||||
// Match regex against an empty string to check the regex is valid
|
||||
if (preg_match('/' . $compressedRegex . '/', '') === false) {
|
||||
throw new \RuntimeException("Regex error: " . preg_last_error());
|
||||
}
|
||||
// We don't ever expect to see | followed by a ) in our metadata - this would be an indication
|
||||
// of a bug. If one wants to make something optional, we prefer ? to using an empty group.
|
||||
$errorIndex = strpos($compressedRegex, '|)');
|
||||
if ($errorIndex !== false) {
|
||||
throw new \RuntimeException("| followed by )");
|
||||
}
|
||||
// return the regex if it is of correct syntax, i.e. compile did not fail with a
|
||||
return $compressedRegex;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $inputXmlFile
|
||||
* @param boolean $liteBuild
|
||||
* @return PhoneMetadata[]
|
||||
*/
|
||||
public static function buildPhoneMetadataCollection($inputXmlFile, $liteBuild)
|
||||
{
|
||||
$document = new \DOMDocument();
|
||||
$document->load($inputXmlFile);
|
||||
$document->normalizeDocument();
|
||||
$territories = $document->getElementsByTagName("territory");
|
||||
$metadataCollection = array();
|
||||
|
||||
$isShortNumberMetadata = strpos($inputXmlFile, 'ShortNumberMetadata');
|
||||
$isAlternateFormatsMetadata = strpos($inputXmlFile, 'PhoneNumberAlternateFormats');
|
||||
|
||||
foreach ($territories as $territoryElement) {
|
||||
/** @var $territoryElement \DOMElement */
|
||||
// For the main metadata file this should always be set, but for other supplementary data
|
||||
// files the country calling code may be all that is needed.
|
||||
if ($territoryElement->hasAttribute("id")) {
|
||||
$regionCode = $territoryElement->getAttribute("id");
|
||||
} else {
|
||||
$regionCode = "";
|
||||
}
|
||||
$metadata = self::loadCountryMetadata($regionCode, $territoryElement, $liteBuild, $isShortNumberMetadata, $isAlternateFormatsMetadata);
|
||||
$metadataCollection[] = $metadata;
|
||||
}
|
||||
return $metadataCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $regionCode
|
||||
* @param \DOMElement $element
|
||||
* @param string $liteBuild
|
||||
* @param string $isShortNumberMetadata
|
||||
* @param string $isAlternateFormatsMetadata
|
||||
* @return PhoneMetadata
|
||||
*/
|
||||
public static function loadCountryMetadata($regionCode, \DOMElement $element, $liteBuild, $isShortNumberMetadata, $isAlternateFormatsMetadata)
|
||||
{
|
||||
$nationalPrefix = self::getNationalPrefix($element);
|
||||
$metadata = self::loadTerritoryTagMetadata($regionCode, $element, $nationalPrefix);
|
||||
$nationalPrefixFormattingRule = self::getNationalPrefixFormattingRuleFromElement($element, $nationalPrefix);
|
||||
|
||||
self::loadAvailableFormats($metadata, $element, $nationalPrefix, $nationalPrefixFormattingRule, $element->hasAttribute(self::NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING));
|
||||
if (!$isAlternateFormatsMetadata) {
|
||||
// The alternate formats metadata does not need most of the patterns to be set.
|
||||
self::setRelevantDescPatterns($metadata, $element, $liteBuild, $isShortNumberMetadata);
|
||||
}
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the national prefix of the provided country element.
|
||||
* @internal
|
||||
* @param \DOMElement $element
|
||||
* @return string
|
||||
*/
|
||||
public static function getNationalPrefix(\DOMElement $element)
|
||||
{
|
||||
return $element->hasAttribute(self::NATIONAL_PREFIX) ? $element->getAttribute(self::NATIONAL_PREFIX) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @internal
|
||||
* @param \DOMElement $element
|
||||
* @param string $nationalPrefix
|
||||
* @return string
|
||||
*/
|
||||
public static function getNationalPrefixFormattingRuleFromElement(\DOMElement $element, $nationalPrefix)
|
||||
{
|
||||
$nationalPrefixFormattingRule = $element->getAttribute(self::NATIONAL_PREFIX_FORMATTING_RULE);
|
||||
// Replace $NP with national prefix and $FG with the first group ($1).
|
||||
$nationalPrefixFormattingRule = str_replace('$NP', $nationalPrefix, $nationalPrefixFormattingRule);
|
||||
$nationalPrefixFormattingRule = str_replace('$FG', '$1', $nationalPrefixFormattingRule);
|
||||
return $nationalPrefixFormattingRule;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @internal
|
||||
* @param string $regionCode
|
||||
* @param \DOMElement $element
|
||||
* @param string $nationalPrefix
|
||||
* @return PhoneMetadata
|
||||
*/
|
||||
public static function loadTerritoryTagMetadata(
|
||||
$regionCode,
|
||||
\DOMElement $element,
|
||||
$nationalPrefix
|
||||
) {
|
||||
$metadata = new PhoneMetadata();
|
||||
$metadata->setId($regionCode);
|
||||
$metadata->setCountryCode((int)$element->getAttribute(self::COUNTRY_CODE));
|
||||
if ($element->hasAttribute(self::LEADING_DIGITS)) {
|
||||
$metadata->setLeadingDigits(self::validateRE($element->getAttribute(self::LEADING_DIGITS)));
|
||||
}
|
||||
$metadata->setInternationalPrefix(self::validateRE($element->getAttribute(self::INTERNATIONAL_PREFIX)));
|
||||
if ($element->hasAttribute(self::PREFERRED_INTERNATIONAL_PREFIX)) {
|
||||
$preferredInternationalPrefix = $element->getAttribute(self::PREFERRED_INTERNATIONAL_PREFIX);
|
||||
$metadata->setPreferredInternationalPrefix($preferredInternationalPrefix);
|
||||
}
|
||||
if ($element->hasAttribute(self::NATIONAL_PREFIX_FOR_PARSING)) {
|
||||
$metadata->setNationalPrefixForParsing(
|
||||
self::validateRE($element->getAttribute(self::NATIONAL_PREFIX_FOR_PARSING), true)
|
||||
);
|
||||
if ($element->hasAttribute(self::NATIONAL_PREFIX_TRANSFORM_RULE)) {
|
||||
$metadata->setNationalPrefixTransformRule(self::validateRE($element->getAttribute(self::NATIONAL_PREFIX_TRANSFORM_RULE)));
|
||||
}
|
||||
}
|
||||
if ($nationalPrefix != '') {
|
||||
$metadata->setNationalPrefix($nationalPrefix);
|
||||
if (!$metadata->hasNationalPrefixForParsing()) {
|
||||
$metadata->setNationalPrefixForParsing($nationalPrefix);
|
||||
}
|
||||
}
|
||||
if ($element->hasAttribute(self::PREFERRED_EXTN_PREFIX)) {
|
||||
$metadata->setPreferredExtnPrefix($element->getAttribute(self::PREFERRED_EXTN_PREFIX));
|
||||
}
|
||||
if ($element->hasAttribute(self::MAIN_COUNTRY_FOR_CODE)) {
|
||||
$metadata->setMainCountryForCode(true);
|
||||
}
|
||||
if ($element->hasAttribute(self::LEADING_ZERO_POSSIBLE)) {
|
||||
$metadata->setLeadingZeroPossible(true);
|
||||
}
|
||||
if ($element->hasAttribute(self::MOBILE_NUMBER_PORTABLE_REGION)) {
|
||||
$metadata->setMobileNumberPortableRegion(true);
|
||||
}
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the available formats from the provided DOM element. If it does not contain any
|
||||
* nationalPrefixFormattingRule, the one passed-in is retained; similarly for
|
||||
* nationalPrefixOptionalWhenFormatting. The nationalPrefix, nationalPrefixFormattingRule and
|
||||
* nationalPrefixOptionalWhenFormatting values are provided from the parent (territory) element.
|
||||
* @internal
|
||||
* @param PhoneMetadata $metadata
|
||||
* @param \DOMElement $element
|
||||
* @param string $nationalPrefix
|
||||
* @param string $nationalPrefixFormattingRule
|
||||
* @param bool $nationalPrefixOptionalWhenFormatting
|
||||
*/
|
||||
public static function loadAvailableFormats(
|
||||
PhoneMetadata $metadata,
|
||||
\DOMElement $element,
|
||||
$nationalPrefix,
|
||||
$nationalPrefixFormattingRule,
|
||||
$nationalPrefixOptionalWhenFormatting
|
||||
) {
|
||||
$carrierCodeFormattingRule = "";
|
||||
if ($element->hasAttribute(self::CARRIER_CODE_FORMATTING_RULE)) {
|
||||
$carrierCodeFormattingRule = self::validateRE(self::getDomesticCarrierCodeFormattingRuleFromElement($element, $nationalPrefix));
|
||||
}
|
||||
$numberFormatElements = $element->getElementsByTagName(self::NUMBER_FORMAT);
|
||||
$hasExplicitIntlFormatDefined = false;
|
||||
|
||||
$numOfFormatElements = $numberFormatElements->length;
|
||||
if ($numOfFormatElements > 0) {
|
||||
for ($i = 0; $i < $numOfFormatElements; $i++) {
|
||||
/** @var \DOMElement $numberFormatElement */
|
||||
$numberFormatElement = $numberFormatElements->item($i);
|
||||
$format = new NumberFormat();
|
||||
|
||||
if ($numberFormatElement->hasAttribute(self::NATIONAL_PREFIX_FORMATTING_RULE)) {
|
||||
$format->setNationalPrefixFormattingRule(
|
||||
self::getNationalPrefixFormattingRuleFromElement($numberFormatElement, $nationalPrefix)
|
||||
);
|
||||
} else {
|
||||
$format->setNationalPrefixFormattingRule($nationalPrefixFormattingRule);
|
||||
}
|
||||
if ($numberFormatElement->hasAttribute(self::NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING)) {
|
||||
$format->setNationalPrefixOptionalWhenFormatting($numberFormatElement->getAttribute(self::NATIONAL_PREFIX_OPTIONAL_WHEN_FORMATTING) == 'true' ? true : false);
|
||||
} else {
|
||||
$format->setNationalPrefixOptionalWhenFormatting($nationalPrefixOptionalWhenFormatting);
|
||||
}
|
||||
if ($numberFormatElement->hasAttribute(self::CARRIER_CODE_FORMATTING_RULE)) {
|
||||
$format->setDomesticCarrierCodeFormattingRule(
|
||||
self::validateRE(self::getDomesticCarrierCodeFormattingRuleFromElement($numberFormatElement, $nationalPrefix))
|
||||
);
|
||||
} else {
|
||||
$format->setDomesticCarrierCodeFormattingRule($carrierCodeFormattingRule);
|
||||
}
|
||||
self::loadNationalFormat($metadata, $numberFormatElement, $format);
|
||||
$metadata->addNumberFormat($format);
|
||||
|
||||
if (self::loadInternationalFormat($metadata, $numberFormatElement, $format)) {
|
||||
$hasExplicitIntlFormatDefined = true;
|
||||
}
|
||||
}
|
||||
// Only a small number of regions need to specify the intlFormats in the xml. For the majority
|
||||
// of countries the intlNumberFormat metadata is an exact copy of the national NumberFormat
|
||||
// metadata. To minimize the size of the metadata file, we only keep intlNumberFormats that
|
||||
// actually differ in some way to the national formats.
|
||||
if (!$hasExplicitIntlFormatDefined) {
|
||||
$metadata->clearIntlNumberFormat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param \DOMElement $element
|
||||
* @param string $nationalPrefix
|
||||
* @return mixed|string
|
||||
*/
|
||||
public static function getDomesticCarrierCodeFormattingRuleFromElement(\DOMElement $element, $nationalPrefix)
|
||||
{
|
||||
$carrierCodeFormattingRule = $element->getAttribute(self::CARRIER_CODE_FORMATTING_RULE);
|
||||
// Replace $FG with the first group ($1) and $NP with the national prefix.
|
||||
$carrierCodeFormattingRule = str_replace('$NP', $nationalPrefix, $carrierCodeFormattingRule);
|
||||
$carrierCodeFormattingRule = str_replace('$FG', '$1', $carrierCodeFormattingRule);
|
||||
return $carrierCodeFormattingRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the pattern for the national format.
|
||||
*
|
||||
* @internal
|
||||
* @param PhoneMetadata $metadata
|
||||
* @param \DOMElement $numberFormatElement
|
||||
* @param NumberFormat $format
|
||||
* @throws \RuntimeException if multiple or no formats have been encountered.
|
||||
*/
|
||||
public static function loadNationalFormat(
|
||||
PhoneMetadata $metadata,
|
||||
\DOMElement $numberFormatElement,
|
||||
NumberFormat $format
|
||||
) {
|
||||
self::setLeadingDigitsPatterns($numberFormatElement, $format);
|
||||
$format->setPattern(self::validateRE($numberFormatElement->getAttribute(self::PATTERN)));
|
||||
|
||||
$formatPattern = $numberFormatElement->getElementsByTagName(self::FORMAT);
|
||||
if ($formatPattern->length != 1) {
|
||||
$countryId = strlen($metadata->getId()) > 0 ? $metadata->getId() : $metadata->getCountryCode();
|
||||
throw new \RuntimeException("Invalid number of format patterns for country: " . $countryId);
|
||||
}
|
||||
$nationalFormat = $formatPattern->item(0)->firstChild->nodeValue;
|
||||
$format->setFormat($nationalFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param \DOMElement $numberFormatElement
|
||||
* @param NumberFormat $format
|
||||
*/
|
||||
public static function setLeadingDigitsPatterns(\DOMElement $numberFormatElement, NumberFormat $format)
|
||||
{
|
||||
$leadingDigitsPatternNodes = $numberFormatElement->getElementsByTagName(self::LEADING_DIGITS);
|
||||
$numOfLeadingDigitsPatterns = $leadingDigitsPatternNodes->length;
|
||||
if ($numOfLeadingDigitsPatterns > 0) {
|
||||
for ($i = 0; $i < $numOfLeadingDigitsPatterns; $i++) {
|
||||
$format->addLeadingDigitsPattern(self::validateRE($leadingDigitsPatternNodes->item($i)->firstChild->nodeValue, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the pattern for international format. If there is no intlFormat, default to using the
|
||||
* national format. If the intlFormat is set to "NA" the intlFormat should be ignored.
|
||||
*
|
||||
* @internal
|
||||
* @param PhoneMetadata $metadata
|
||||
* @param \DOMElement $numberFormatElement
|
||||
* @param NumberFormat $nationalFormat
|
||||
* @throws \RuntimeException if multiple intlFormats have been encountered.
|
||||
* @return bool whether an international number format is defined.
|
||||
*/
|
||||
public static function loadInternationalFormat(
|
||||
PhoneMetadata $metadata,
|
||||
\DOMElement $numberFormatElement,
|
||||
NumberFormat $nationalFormat
|
||||
) {
|
||||
$intlFormat = new NumberFormat();
|
||||
$intlFormatPattern = $numberFormatElement->getElementsByTagName(self::INTL_FORMAT);
|
||||
$hasExplicitIntlFormatDefined = false;
|
||||
|
||||
if ($intlFormatPattern->length > 1) {
|
||||
$countryId = strlen($metadata->getId()) > 0 ? $metadata->getId() : $metadata->getCountryCode();
|
||||
throw new \RuntimeException("Invalid number of intlFormat patterns for country: " . $countryId);
|
||||
} elseif ($intlFormatPattern->length == 0) {
|
||||
// Default to use the same as the national pattern if none is defined.
|
||||
$intlFormat->mergeFrom($nationalFormat);
|
||||
} else {
|
||||
$intlFormat->setPattern($numberFormatElement->getAttribute(self::PATTERN));
|
||||
self::setLeadingDigitsPatterns($numberFormatElement, $intlFormat);
|
||||
$intlFormatPatternValue = $intlFormatPattern->item(0)->firstChild->nodeValue;
|
||||
if ($intlFormatPatternValue !== "NA") {
|
||||
$intlFormat->setFormat($intlFormatPatternValue);
|
||||
}
|
||||
$hasExplicitIntlFormatDefined = true;
|
||||
}
|
||||
|
||||
if ($intlFormat->hasFormat()) {
|
||||
$metadata->addIntlNumberFormat($intlFormat);
|
||||
}
|
||||
return $hasExplicitIntlFormatDefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param PhoneMetadata $metadata
|
||||
* @param \DOMElement $element
|
||||
* @param bool $liteBuild
|
||||
* @param bool $isShortNumberMetadata
|
||||
*/
|
||||
public static function setRelevantDescPatterns(PhoneMetadata $metadata, \DOMElement $element, $liteBuild, $isShortNumberMetadata)
|
||||
{
|
||||
$generalDesc = self::processPhoneNumberDescElement(null, $element, self::GENERAL_DESC, $liteBuild);
|
||||
$metadata->setGeneralDesc($generalDesc);
|
||||
|
||||
$metadataId = $metadata->getId();
|
||||
// Calculate the possible lengths for the general description. This will be based on the
|
||||
// possible lengths of the child elements.
|
||||
self::setPossibleLengthsGeneralDesc($generalDesc, $metadataId, $element, $isShortNumberMetadata);
|
||||
|
||||
if (!$isShortNumberMetadata) {
|
||||
// Set fields used by regular length phone numbers.
|
||||
$metadata->setFixedLine(self::processPhoneNumberDescElement($generalDesc, $element, self::FIXED_LINE, $liteBuild));
|
||||
$metadata->setMobile(self::processPhoneNumberDescElement($generalDesc, $element, self::MOBILE, $liteBuild));
|
||||
$metadata->setSharedCost(self::processPhoneNumberDescElement($generalDesc, $element, self::SHARED_COST, $liteBuild));
|
||||
$metadata->setVoip(self::processPhoneNumberDescElement($generalDesc, $element, self::VOIP, $liteBuild));
|
||||
$metadata->setPersonalNumber(self::processPhoneNumberDescElement($generalDesc, $element, self::PERSONAL_NUMBER, $liteBuild));
|
||||
$metadata->setPager(self::processPhoneNumberDescElement($generalDesc, $element, self::PAGER, $liteBuild));
|
||||
$metadata->setUan(self::processPhoneNumberDescElement($generalDesc, $element, self::UAN, $liteBuild));
|
||||
$metadata->setVoicemail(self::processPhoneNumberDescElement($generalDesc, $element, self::VOICEMAIL, $liteBuild));
|
||||
$metadata->setNoInternationalDialling(self::processPhoneNumberDescElement($generalDesc, $element, self::NO_INTERNATIONAL_DIALLING, $liteBuild));
|
||||
$metadata->setSameMobileAndFixedLinePattern($metadata->getMobile()->getNationalNumberPattern() === $metadata->getFixedLine()->getNationalNumberPattern());
|
||||
$metadata->setTollFree(self::processPhoneNumberDescElement($generalDesc, $element, self::TOLL_FREE, $liteBuild));
|
||||
$metadata->setPremiumRate(self::processPhoneNumberDescElement($generalDesc, $element, self::PREMIUM_RATE, $liteBuild));
|
||||
} else {
|
||||
// Set fields used by short numbers.
|
||||
$metadata->setStandardRate(self::processPhoneNumberDescElement($generalDesc, $element, self::STANDARD_RATE, $liteBuild));
|
||||
$metadata->setShortCode(self::processPhoneNumberDescElement($generalDesc, $element, self::SHORT_CODE, $liteBuild));
|
||||
$metadata->setCarrierSpecific(self::processPhoneNumberDescElement($generalDesc, $element, self::CARRIER_SPECIFIC, $liteBuild));
|
||||
$metadata->setEmergency(self::processPhoneNumberDescElement($generalDesc, $element, self::EMERGENCY, $liteBuild));
|
||||
$metadata->setTollFree(self::processPhoneNumberDescElement($generalDesc, $element, self::TOLL_FREE, $liteBuild));
|
||||
$metadata->setPremiumRate(self::processPhoneNumberDescElement($generalDesc, $element, self::PREMIUM_RATE, $liteBuild));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a possible length string into a set of the integers that are covered.
|
||||
*
|
||||
* @param string $possibleLengthString a string specifying the possible lengths of phone numbers. Follows
|
||||
* this syntax: ranges or elements are separated by commas, and ranges are specified in
|
||||
* [min-max] notation, inclusive. For example, [3-5],7,9,[11-14] should be parsed to
|
||||
* 3,4,5,7,9,11,12,13,14
|
||||
* @return array
|
||||
*/
|
||||
private static function parsePossibleLengthStringToSet($possibleLengthString)
|
||||
{
|
||||
if (strlen($possibleLengthString) === 0) {
|
||||
throw new \RuntimeException("Empty possibleLength string found.");
|
||||
}
|
||||
|
||||
$lengths = explode(",", $possibleLengthString);
|
||||
$lengthSet = array();
|
||||
|
||||
|
||||
$lengthLength = count($lengths);
|
||||
for ($i = 0; $i < $lengthLength; $i++) {
|
||||
$lengthSubstring = $lengths[$i];
|
||||
if (strlen($lengthSubstring) === 0) {
|
||||
throw new \RuntimeException("Leading, trailing or adjacent commas in possible "
|
||||
. "length string {$possibleLengthString}, these should only separate numbers or ranges.");
|
||||
} elseif (substr($lengthSubstring, 0, 1) === '[') {
|
||||
if (substr($lengthSubstring, -1) !== ']') {
|
||||
throw new \RuntimeException("Missing end of range character in possible length string {$possibleLengthString}.");
|
||||
}
|
||||
|
||||
// Strip the leading and trailing [], and split on the -.
|
||||
$minMax = explode('-', substr($lengthSubstring, 1, -1));
|
||||
if (count($minMax) !== 2) {
|
||||
throw new \RuntimeException("Ranges must have exactly one - character: missing for {$possibleLengthString}.");
|
||||
}
|
||||
$min = (int)$minMax[0];
|
||||
$max = (int)$minMax[1];
|
||||
// We don't even accept [6-7] since we prefer the shorter 6,7 variant; for a range to be in
|
||||
// use the hyphen needs to replace at least one digit.
|
||||
if ($max - $min < 2) {
|
||||
throw new \RuntimeException("The first number in a range should be two or more digits lower than the second. Culprit possibleLength string: {$possibleLengthString}.");
|
||||
}
|
||||
for ($j = $min; $j <= $max; $j++) {
|
||||
if (in_array($j, $lengthSet)) {
|
||||
throw new \RuntimeException("Duplicate length element found ({$j}) in possibleLength string {$possibleLengthString}.");
|
||||
}
|
||||
array_push($lengthSet, $j);
|
||||
}
|
||||
} else {
|
||||
$length = $lengthSubstring;
|
||||
if (in_array($length, $lengthSet)) {
|
||||
throw new \RuntimeException("Duplicate length element found ({$length}) in possibleLength string {$possibleLengthString}.");
|
||||
}
|
||||
if (!is_numeric($length)) {
|
||||
throw new \RuntimeException("For input string \"{$length}\"");
|
||||
}
|
||||
array_push($lengthSet, $length);
|
||||
}
|
||||
}
|
||||
return $lengthSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the possible length present in the metadata and splits them into two sets: one for
|
||||
* full-length numbers, one for local numbers.
|
||||
*
|
||||
*
|
||||
* @param \DOMElement $data One or more phone number descriptions
|
||||
* @param array $lengths An array in which to add possible lengths of full phone numbers
|
||||
* @param array $localOnlyLengths An array in which to add possible lengths of phone numbers only diallable
|
||||
* locally (e.g. within a province)
|
||||
*/
|
||||
private static function populatePossibleLengthSets(\DOMElement $data, &$lengths, &$localOnlyLengths)
|
||||
{
|
||||
$possibleLengths = $data->getElementsByTagName(self::POSSIBLE_LENGTHS);
|
||||
|
||||
for ($i = 0; $i < $possibleLengths->length; $i++) {
|
||||
/** @var \DOMElement $element */
|
||||
$element = $possibleLengths->item($i);
|
||||
$nationalLengths = $element->getAttribute(self::NATIONAL);
|
||||
// We don't add to the phone metadata yet, since we want to sort length elements found under
|
||||
// different nodes first, make sure there are no duplicates between them and that the
|
||||
// localOnly lengths don't overlap with the others.
|
||||
$thisElementLengths = self::parsePossibleLengthStringToSet($nationalLengths);
|
||||
if ($element->hasAttribute(self::LOCAL_ONLY)) {
|
||||
$localLengths = $element->getAttribute(self::LOCAL_ONLY);
|
||||
$thisElementLocalOnlyLengths = self::parsePossibleLengthStringToSet($localLengths);
|
||||
$intersection = array_intersect($thisElementLengths, $thisElementLocalOnlyLengths);
|
||||
if (count($intersection) > 0) {
|
||||
throw new \RuntimeException("Possible length(s) found specified as a normal and local-only length: [" . implode(',', $intersection) . '].');
|
||||
}
|
||||
// We check again when we set these lengths on the metadata itself in setPossibleLengths
|
||||
// that the elements in localOnly are not also in lengths. For e.g. the generalDesc, it
|
||||
// might have a local-only length for one type that is a normal length for another type. We
|
||||
// don't consider this an error, but we do want to remove the local-only lengths.
|
||||
$localOnlyLengths = array_merge($localOnlyLengths, $thisElementLocalOnlyLengths);
|
||||
sort($localOnlyLengths);
|
||||
}
|
||||
// It is okay if at this time we have duplicates, because the same length might be possible
|
||||
// for e.g. fixed-line and for mobile numbers, and this method operates potentially on
|
||||
// multiple phoneNumberDesc XML elements.
|
||||
$lengths = array_merge($lengths, $thisElementLengths);
|
||||
sort($lengths);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets possible lengths in the general description, derived from certain child elements
|
||||
*
|
||||
* @internal
|
||||
* @param PhoneNumberDesc $generalDesc
|
||||
* @param string $metadataId
|
||||
* @param \DOMElement $data
|
||||
* @param bool $isShortNumberMetadata
|
||||
*/
|
||||
public static function setPossibleLengthsGeneralDesc(PhoneNumberDesc $generalDesc, $metadataId, \DOMElement $data, $isShortNumberMetadata)
|
||||
{
|
||||
$lengths = array();
|
||||
$localOnlyLengths = array();
|
||||
// The general description node should *always* be present if metadata for other types is
|
||||
// present, aside from in some unit tests.
|
||||
// (However, for e.g. formatting metadata in PhoneNumberAlternateFormats, no PhoneNumberDesc
|
||||
// elements are present).
|
||||
$generalDescNodes = $data->getElementsByTagName(self::GENERAL_DESC);
|
||||
if ($generalDescNodes->length > 0) {
|
||||
$generalDescNode = $generalDescNodes->item(0);
|
||||
self::populatePossibleLengthSets($generalDescNode, $lengths, $localOnlyLengths);
|
||||
if (count($lengths) > 0 || count($localOnlyLengths) > 0) {
|
||||
// We shouldn't have anything specified at the "general desc" level: we are going to
|
||||
// calculate this ourselves from child elements.
|
||||
throw new \RuntimeException("Found possible lengths specified at general desc: this should be derived from child elements. Affected country: {$metadataId}");
|
||||
}
|
||||
}
|
||||
if (!$isShortNumberMetadata) {
|
||||
// Make a copy here since we want to remove some nodes, but we don't want to do that on our
|
||||
// actual data.
|
||||
/** @var \DOMElement $allDescData */
|
||||
$allDescData = $data->cloneNode(true);
|
||||
foreach (self::$phoneNumberDescsWithoutMatchingTypes as $tag) {
|
||||
$nodesToRemove = $allDescData->getElementsByTagName($tag);
|
||||
if ($nodesToRemove->length > 0) {
|
||||
// We check when we process phone number descriptions that there are only one of each
|
||||
// type, so this is safe to do.
|
||||
$allDescData->removeChild($nodesToRemove->item(0));
|
||||
}
|
||||
}
|
||||
self::populatePossibleLengthSets($allDescData, $lengths, $localOnlyLengths);
|
||||
} else {
|
||||
// For short number metadata, we want to copy the lengths from the "short code" section only.
|
||||
// This is because it's the more detailed validation pattern, it's not a sub-type of short
|
||||
// codes. The other lengths will be checked later to see that they are a sub-set of these
|
||||
// possible lengths.
|
||||
$shortCodeDescList = $data->getElementsByTagName(self::SHORT_CODE);
|
||||
if (count($shortCodeDescList) > 0) {
|
||||
$shortCodeDesc = $shortCodeDescList->item(0);
|
||||
self::populatePossibleLengthSets($shortCodeDesc, $lengths, $localOnlyLengths);
|
||||
}
|
||||
if (count($localOnlyLengths) > 0) {
|
||||
throw new \RuntimeException("Found local-only lengths in short-number metadata");
|
||||
}
|
||||
}
|
||||
self::setPossibleLengths($lengths, $localOnlyLengths, null, $generalDesc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the possible length fields in the metadata from the sets of data passed in. Checks that
|
||||
* the length is covered by the "parent" phone number description element if one is present, and
|
||||
* if the lengths are exactly the same as this, they are not filled in for efficiency reasons.
|
||||
*
|
||||
* @param array $lengths
|
||||
* @param array $localOnlyLengths
|
||||
* @param PhoneNumberDesc $parentDesc
|
||||
* @param PhoneNumberDesc $desc
|
||||
*/
|
||||
private static function setPossibleLengths($lengths, $localOnlyLengths, PhoneNumberDesc $parentDesc = null, PhoneNumberDesc $desc)
|
||||
{
|
||||
$parentDescPossibleLengths = ($parentDesc === null) ? null : $parentDesc->getPossibleLength();
|
||||
$parentDescPossibleLengthLocalOnlys = ($parentDesc === null) ? null : $parentDesc->getPossibleLengthLocalOnly();
|
||||
$descPossibleLengths = array();
|
||||
$descPossibleLengthLocalOnlys = array();
|
||||
|
||||
// Only add the lengths to this sub-type if they aren't exactly the same as the possible
|
||||
// lengths in the general desc (for metadata size reasons).
|
||||
if ($parentDesc === null || !self::arePossibleLengthsEqual($lengths, $parentDesc)) {
|
||||
foreach ($lengths as $length) {
|
||||
if ($parentDesc === null || in_array($length, $parentDescPossibleLengths)) {
|
||||
if (!in_array($length, $descPossibleLengths)) {
|
||||
$descPossibleLengths[] = $length;
|
||||
}
|
||||
} else {
|
||||
// We shouldn't have possible lengths defined in a child element that are not covered by
|
||||
// the general description. We check this here even though the general description is
|
||||
// derived from child elements because it is only derived from a subset, and we need to
|
||||
// ensure *all* child elements have a valid possible length.
|
||||
throw new \RuntimeException("Out-of-range possible length found ({$length}), parent lengths " . implode(',', $parentDesc->getPossibleLength()));
|
||||
}
|
||||
}
|
||||
}
|
||||
// We check that the local-only length isn't also a normal possible length (only relevant for
|
||||
// the general-desc, since within elements such as fixed-line we would throw an exception if we
|
||||
// saw this) before adding it to the collection of possible local-only lengths.
|
||||
foreach ($localOnlyLengths as $length) {
|
||||
if (!in_array($length, $lengths)) {
|
||||
// We check it is covered by either of the possible length sets of the parent
|
||||
// PhoneNumberDesc, because for example 7 might be a valid localOnly length for mobile, but
|
||||
// a valid national length for fixedLine, so the generalDesc would have the 7 removed from
|
||||
// localOnly.
|
||||
if ($parentDesc === null || in_array($length, $parentDescPossibleLengthLocalOnlys) || in_array($length, $parentDescPossibleLengths)) {
|
||||
if (!in_array($length, $descPossibleLengthLocalOnlys)) {
|
||||
$descPossibleLengthLocalOnlys[] = $length;
|
||||
}
|
||||
} else {
|
||||
throw new \RuntimeException("Out-of-range local-only possible length found ({$length}), parent length {$parentDesc->getPossibleLengthLocalOnly()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
$desc->setPossibleLength($descPossibleLengths);
|
||||
$desc->setPossibleLengthLocalOnly($descPossibleLengthLocalOnlys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes a phone number description element from the XML file and returns it as a
|
||||
* PhoneNumberDesc. If the description element is a fixed line or mobile number, the parent
|
||||
* description will be used to fill in the whole element if necessary, or any components that are
|
||||
* missing. For all other types, the parent description will only be used to fill in missing
|
||||
* components if the type has a partial definition. For example, if no "tollFree" element exists,
|
||||
* we assume there are no toll free numbers for that locale, and return a phone number description
|
||||
* with "NA" for both the national and possible number patterns. Note that the parent description
|
||||
* must therefore already be processed before this method is called on any child elements.
|
||||
*
|
||||
* @internal
|
||||
* @param PhoneNumberDesc $parentDesc a generic phone number description that will be used to fill in missing
|
||||
* parts of the description, or null if this is the root node. This must be processed before
|
||||
* this is run on any child elements.
|
||||
* @param \DOMElement $countryElement XML element representing all the country information
|
||||
* @param string $numberType name of the number type, corresponding to the appropriate tag in the XML
|
||||
* file with information about that type
|
||||
* @param bool $liteBuild
|
||||
* @return PhoneNumberDesc complete description of that phone number type
|
||||
*/
|
||||
public static function processPhoneNumberDescElement(
|
||||
PhoneNumberDesc $parentDesc = null,
|
||||
\DOMElement $countryElement,
|
||||
$numberType,
|
||||
$liteBuild
|
||||
) {
|
||||
$phoneNumberDescList = $countryElement->getElementsByTagName($numberType);
|
||||
$numberDesc = new PhoneNumberDesc();
|
||||
if ($phoneNumberDescList->length == 0 && !self::numberTypeShouldAlwaysBeFilledIn($numberType)) {
|
||||
$numberDesc->setNationalNumberPattern("NA");
|
||||
$numberDesc->setPossibleNumberPattern("NA");
|
||||
// -1 will never match a possible phone number length, so is safe to use to ensure this never
|
||||
// matches. We don't leave it empty, since for compression reasons, we use the empty list to
|
||||
// mean that the generalDesc possible lengths apply.
|
||||
$numberDesc->setPossibleLength(array(-1));
|
||||
return $numberDesc;
|
||||
}
|
||||
|
||||
if ($parentDesc != null) {
|
||||
if ($parentDesc->getNationalNumberPattern() !== "") {
|
||||
$numberDesc->setNationalNumberPattern($parentDesc->getNationalNumberPattern());
|
||||
}
|
||||
if ($parentDesc->getPossibleNumberPattern() !== "") {
|
||||
$numberDesc->setPossibleNumberPattern($parentDesc->getPossibleNumberPattern());
|
||||
}
|
||||
if ($parentDesc->getExampleNumber() !== "") {
|
||||
$numberDesc->setExampleNumber($parentDesc->getExampleNumber());
|
||||
}
|
||||
}
|
||||
|
||||
if ($phoneNumberDescList->length > 0) {
|
||||
if ($phoneNumberDescList->length > 1) {
|
||||
throw new \RuntimeException("Multiple elements with type {$numberType} found.");
|
||||
}
|
||||
|
||||
/** @var \DOMElement $element */
|
||||
$element = $phoneNumberDescList->item(0);
|
||||
// Old way of handling possible number lengths. This will be deleted when no data is
|
||||
// represented in this way anymore.
|
||||
$possiblePattern = $element->getElementsByTagName(self::POSSIBLE_NUMBER_PATTERN);
|
||||
if ($possiblePattern->length > 0) {
|
||||
$numberDesc->setPossibleNumberPattern(self::validateRE($possiblePattern->item(0)->firstChild->nodeValue, true));
|
||||
}
|
||||
|
||||
if ($parentDesc != null) {
|
||||
// New way of handling possible number lengths. We don't do this for the general
|
||||
// description, since these tags won't be present; instead we will calculate its values
|
||||
// based on the values for all the other number type descriptions (see
|
||||
// setPossibleLengthsGeneralDesc).
|
||||
$lengths = array();
|
||||
$localOnlyLengths = array();
|
||||
self::populatePossibleLengthSets($element, $lengths, $localOnlyLengths);
|
||||
// NOTE: We don't use the localOnlyLengths for specific number types yet, since they aren't
|
||||
// used in the API and won't be until a method that assesses whether a number is possible
|
||||
// for a certain type or not is available. To ensure size is small, we don't set them
|
||||
// outside the general desc at this time. If we want this data later, the empty set here
|
||||
// should be replaced with the localOnlyLengths set above.
|
||||
self::setPossibleLengths($lengths, array(), $parentDesc, $numberDesc);
|
||||
}
|
||||
|
||||
$validPattern = $element->getElementsByTagName(self::NATIONAL_NUMBER_PATTERN);
|
||||
if ($validPattern->length > 0) {
|
||||
$numberDesc->setNationalNumberPattern(self::validateRE($validPattern->item(0)->firstChild->nodeValue, true));
|
||||
}
|
||||
|
||||
if (!$liteBuild) {
|
||||
$exampleNumber = $element->getElementsByTagName(self::EXAMPLE_NUMBER);
|
||||
if ($exampleNumber->length > 0) {
|
||||
$numberDesc->setExampleNumber($exampleNumber->item(0)->firstChild->nodeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $numberDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param string $numberType
|
||||
* @return bool
|
||||
*/
|
||||
public static function numberTypeShouldAlwaysBeFilledIn($numberType)
|
||||
{
|
||||
return $numberType == self::FIXED_LINE || $numberType == self::MOBILE || $numberType == self::GENERAL_DESC;
|
||||
}
|
||||
|
||||
private static function arePossibleLengthsEqual($possibleLengths, PhoneNumberDesc $desc)
|
||||
{
|
||||
$descPossibleLength = $desc->getPossibleLength();
|
||||
if (count($possibleLengths) != count($descPossibleLength)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Note that both should be sorted already, and we know they are the same length.
|
||||
$i = 0;
|
||||
foreach ($possibleLengths as $length) {
|
||||
if ($length != $descPossibleLength[$i]) {
|
||||
return false;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $metadataCollection PhoneMetadata[]
|
||||
* @return array
|
||||
*/
|
||||
public static function buildCountryCodeToRegionCodeMap($metadataCollection)
|
||||
{
|
||||
$countryCodeToRegionCodeMap = array();
|
||||
|
||||
foreach ($metadataCollection as $metadata) {
|
||||
$regionCode = $metadata->getId();
|
||||
$countryCode = $metadata->getCountryCode();
|
||||
if (array_key_exists($countryCode, $countryCodeToRegionCodeMap)) {
|
||||
if ($metadata->getMainCountryForCode()) {
|
||||
array_unshift($countryCodeToRegionCodeMap[$countryCode], $regionCode);
|
||||
} else {
|
||||
$countryCodeToRegionCodeMap[$countryCode][] = $regionCode;
|
||||
}
|
||||
} else {
|
||||
// For most countries, there will be only one region code for the country calling code.
|
||||
$listWithRegionCode = array();
|
||||
if ($regionCode != '') { // For alternate formats, there are no region codes at all.
|
||||
$listWithRegionCode[] = $regionCode;
|
||||
}
|
||||
$countryCodeToRegionCodeMap[$countryCode] = $listWithRegionCode;
|
||||
}
|
||||
}
|
||||
|
||||
return $countryCodeToRegionCodeMap;
|
||||
}
|
||||
}
|
@@ -1,122 +0,0 @@
|
||||
<?php
|
||||
namespace libphonenumber\buildtools;
|
||||
|
||||
use libphonenumber\PhoneMetadata;
|
||||
|
||||
/**
|
||||
* Tool to convert phone number metadata from the XML format to protocol buffer format.
|
||||
*
|
||||
* @author Davide Mendolia
|
||||
*/
|
||||
class BuildMetadataPHPFromXml
|
||||
{
|
||||
const GENERATION_COMMENT = <<<'EOT'
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
EOT;
|
||||
const MAP_COMMENT = <<<'EOT'
|
||||
// A mapping from a country code to the region codes which denote the
|
||||
// country/region represented by that country code. In the case of multiple
|
||||
// countries sharing a calling code, such as the NANPA countries, the one
|
||||
// indicated with "isMainCountryForCode" in the metadata should be first.
|
||||
|
||||
EOT;
|
||||
const COUNTRY_CODE_SET_COMMENT =
|
||||
" // A set of all country codes for which data is available.\n";
|
||||
const REGION_CODE_SET_COMMENT =
|
||||
" // A set of all region codes for which data is available.\n";
|
||||
|
||||
public function start($inputFile, $outputDir, $filePrefix, $mappingClass, $mappingClassLocation, $liteBuild)
|
||||
{
|
||||
$savePath = $outputDir . $filePrefix;
|
||||
|
||||
$metadataCollection = BuildMetadataFromXml::buildPhoneMetadataCollection($inputFile, $liteBuild);
|
||||
|
||||
$this->writeMetadataToFile($metadataCollection, $savePath);
|
||||
|
||||
|
||||
$countryCodeToRegionCodeMap = BuildMetadataFromXml::buildCountryCodeToRegionCodeMap($metadataCollection);
|
||||
|
||||
// Sort $countryCodeToRegionCodeMap just to have the regions in order
|
||||
|
||||
ksort($countryCodeToRegionCodeMap);
|
||||
|
||||
$this->writeCountryCallingCodeMappingToFile($countryCodeToRegionCodeMap, $mappingClassLocation, $mappingClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $metadataCollection PhoneMetadata[]
|
||||
* @param $filePrefix
|
||||
*/
|
||||
private function writeMetadataToFile($metadataCollection, $filePrefix)
|
||||
{
|
||||
foreach ($metadataCollection as $metadata) {
|
||||
/** @var $phoneMetadata PhoneMetadata */
|
||||
$regionCode = $metadata->getId();
|
||||
// For non-geographical country calling codes (e.g. +800), use the country calling codes
|
||||
// instead of the region code to form the file name.
|
||||
if ($regionCode === '001' || $regionCode == '') {
|
||||
$regionCode = $metadata->getCountryCode();
|
||||
}
|
||||
|
||||
$data = '<?php' . PHP_EOL . self::GENERATION_COMMENT . PHP_EOL . 'return ' . var_export(
|
||||
$metadata->toArray(),
|
||||
true
|
||||
) . ';' . PHP_EOL;
|
||||
|
||||
file_put_contents($filePrefix . "_" . $regionCode . '.php', $data);
|
||||
}
|
||||
}
|
||||
|
||||
private function writeCountryCallingCodeMappingToFile($countryCodeToRegionCodeMap, $outputDir, $mappingClass)
|
||||
{
|
||||
// Find out whether the countryCodeToRegionCodeMap has any region codes or country
|
||||
// calling codes listed in it.
|
||||
$hasRegionCodes = false;
|
||||
foreach ($countryCodeToRegionCodeMap as $key => $listWithRegionCode) {
|
||||
if (count($listWithRegionCode) > 0) {
|
||||
$hasRegionCodes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$hasCountryCodes = (count($countryCodeToRegionCodeMap) > 1);
|
||||
|
||||
$variableName = lcfirst($mappingClass);
|
||||
|
||||
$data = '<?php' . PHP_EOL .
|
||||
self::GENERATION_COMMENT . PHP_EOL .
|
||||
"namespace libphonenumber;" . PHP_EOL .
|
||||
"class {$mappingClass} {" . PHP_EOL .
|
||||
PHP_EOL;
|
||||
|
||||
if ($hasRegionCodes && $hasCountryCodes) {
|
||||
$data .= self::MAP_COMMENT . PHP_EOL;
|
||||
$data .= " public static \${$variableName} = " . var_export(
|
||||
$countryCodeToRegionCodeMap,
|
||||
true
|
||||
) . ";" . PHP_EOL;
|
||||
} elseif ($hasCountryCodes) {
|
||||
$data .= self::COUNTRY_CODE_SET_COMMENT . PHP_EOL;
|
||||
$data .= " public static \${$variableName} = " . var_export(
|
||||
array_keys($countryCodeToRegionCodeMap),
|
||||
true
|
||||
) . ";" . PHP_EOL;
|
||||
} else {
|
||||
$data .= self::REGION_CODE_SET_COMMENT . PHP_EOL;
|
||||
$data .= " public static \${$variableName} = " . var_export(
|
||||
$countryCodeToRegionCodeMap[0],
|
||||
true
|
||||
) . ";" . PHP_EOL;
|
||||
}
|
||||
|
||||
$data .= PHP_EOL .
|
||||
"}" . PHP_EOL;
|
||||
|
||||
file_put_contents($outputDir . $mappingClass . '.php', $data);
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools\Commands;
|
||||
|
||||
use libphonenumber\buildtools\BuildMetadataPHPFromXml;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class BuildMetadataPHPFromXMLCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('BuildMetadataPHPFromXML');
|
||||
$this->setDescription('Generate phone metadata data files');
|
||||
$this->setDefinition(
|
||||
array(
|
||||
new InputArgument('InputFile', InputArgument::REQUIRED, 'The input file containing phone number metadata in XML format.'),
|
||||
new InputArgument('OutputDirectory', InputArgument::REQUIRED, 'The output source directory to store phone number metadata (one file per region) and the country code to region code mapping file'),
|
||||
new InputArgument('DataPrefix', InputArgument::REQUIRED, 'The start of the filename to store the files (e.g. dataPrefix_GB.php'),
|
||||
new InputArgument('MappingClass', InputArgument::REQUIRED, 'The name of the mapping class generated'),
|
||||
new InputArgument('MappingClassLocation', InputArgument::REQUIRED, 'The directory where the mapping class is stored'),
|
||||
new InputArgument('LiteBuild', InputArgument::OPTIONAL, 'Whether to generate the lite-version of the metadata. When set to true, certain metadata will be omitted. AT this moment, example numbers information is omitted', false),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$build = new BuildMetadataPHPFromXml();
|
||||
$build->start(
|
||||
$input->getArgument('InputFile'),
|
||||
$input->getArgument('OutputDirectory'),
|
||||
$input->getArgument('DataPrefix'),
|
||||
$input->getArgument('MappingClass'),
|
||||
$input->getArgument('MappingClassLocation'),
|
||||
($input->getArgument('LiteBuild') == 'true') ? true : false
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools\Commands;
|
||||
|
||||
use libphonenumber\buildtools\GeneratePhonePrefixData;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class GeneratePhonePrefixDataCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('GeneratePhonePrefixData');
|
||||
$this->setDescription('Generate phone prefix data files');
|
||||
$this->setDefinition(
|
||||
array(
|
||||
new InputArgument('InputDirectory', InputArgument::REQUIRED, 'The input directory containing the locale/region.txt files'),
|
||||
new InputArgument('OutputDirectory', InputArgument::REQUIRED, 'The output source directory'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$generatePhonePrefixData = new GeneratePhonePrefixData();
|
||||
$generatePhonePrefixData->start(
|
||||
$input->getArgument('InputDirectory'),
|
||||
$input->getArgument('OutputDirectory'),
|
||||
$output
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools\Commands;
|
||||
|
||||
use libphonenumber\buildtools\GenerateTimeZonesMapData;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class GenerateTimeZonesMapDataCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('GenerateTimeZonesMapData');
|
||||
$this->setDescription('Generate time zone data files');
|
||||
$this->setDefinition(
|
||||
array(
|
||||
new InputArgument('InputFile', InputArgument::REQUIRED, 'The input file containing the timezone map data'),
|
||||
new InputArgument('OutputDirectory', InputArgument::REQUIRED, 'The output directory to save the file'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
new GenerateTimeZonesMapData($input->getArgument('InputFile'), $input->getArgument('OutputDirectory'));
|
||||
}
|
||||
}
|
@@ -1,399 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools;
|
||||
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class GeneratePhonePrefixData
|
||||
{
|
||||
const NANPA_COUNTRY_CODE = 1;
|
||||
const DATA_FILE_EXTENSION = '.txt';
|
||||
const GENERATION_COMMENT = <<<'EOT'
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
EOT;
|
||||
|
||||
public $inputDir;
|
||||
private $filesToIgnore = array('.', '..', '.svn', '.git');
|
||||
private $outputDir;
|
||||
private $englishMaps = array();
|
||||
|
||||
|
||||
public function start($inputDir, $outputDir, OutputInterface $consoleOutput)
|
||||
{
|
||||
$this->inputDir = $inputDir;
|
||||
$this->outputDir = $outputDir;
|
||||
|
||||
$inputOutputMappings = $this->createInputOutputMappings();
|
||||
$availableDataFiles = array();
|
||||
|
||||
$progress = new ProgressBar($consoleOutput, count($inputOutputMappings));
|
||||
|
||||
$progress->start();
|
||||
foreach ($inputOutputMappings as $textFile => $outputFiles) {
|
||||
$mappings = $this->readMappingsFromFile($textFile);
|
||||
|
||||
$language = $this->getLanguageFromTextFile($textFile);
|
||||
|
||||
$this->removeEmptyEnglishMappings($mappings, $language);
|
||||
$this->makeDataFallbackToEnglish($textFile, $mappings);
|
||||
$mappingForFiles = $this->splitMap($mappings, $outputFiles);
|
||||
|
||||
foreach ($mappingForFiles as $outputFile => $value) {
|
||||
$this->writeMappingFile($language, $outputFile, $value);
|
||||
$this->addConfigurationMapping($availableDataFiles, $language, $outputFile);
|
||||
}
|
||||
$progress->advance();
|
||||
}
|
||||
|
||||
$this->writeConfigMap($availableDataFiles);
|
||||
$progress->finish();
|
||||
}
|
||||
|
||||
private function createInputOutputMappings()
|
||||
{
|
||||
$topLevel = scandir($this->inputDir);
|
||||
|
||||
$mappings = array();
|
||||
|
||||
foreach ($topLevel as $languageDirectory) {
|
||||
if (in_array($languageDirectory, $this->filesToIgnore)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fileLocation = $this->inputDir . DIRECTORY_SEPARATOR . $languageDirectory;
|
||||
|
||||
if (is_dir($fileLocation)) {
|
||||
// Will contain files
|
||||
|
||||
$countryCodeFiles = scandir($fileLocation);
|
||||
|
||||
foreach ($countryCodeFiles as $countryCodeFileName) {
|
||||
if (in_array($countryCodeFileName, $this->filesToIgnore)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$outputFiles = $this->createOutputFileNames(
|
||||
$countryCodeFileName,
|
||||
$this->getCountryCodeFromTextFileName($countryCodeFileName),
|
||||
$languageDirectory
|
||||
);
|
||||
|
||||
$mappings[$languageDirectory . DIRECTORY_SEPARATOR . $countryCodeFileName] = $outputFiles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mappings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used by {@code #createInputOutputMappings()} to generate the list of output binary files
|
||||
* from the provided input text file. For the data files expected to be large (currently only
|
||||
* NANPA is supported), this method generates a list containing one output file for each area
|
||||
* code. Otherwise, a single file is added to the list.
|
||||
*/
|
||||
|
||||
private function createOutputFileNames($file, $countryCode, $language)
|
||||
{
|
||||
$outputFiles = array();
|
||||
|
||||
if ($countryCode == self::NANPA_COUNTRY_CODE) {
|
||||
// Fetch the 4-digit prefixes stored in the file.
|
||||
$phonePrefixes = array();
|
||||
|
||||
$this->parseTextFile(
|
||||
$this->getFilePathFromLanguageAndCountryCode($language, $countryCode),
|
||||
function ($prefix, $location) use (&$phonePrefixes) {
|
||||
$shortPrefix = substr($prefix, 0, 4);
|
||||
if (!in_array($shortPrefix, $phonePrefixes)) {
|
||||
$phonePrefixes[] = $shortPrefix;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
foreach ($phonePrefixes as $prefix) {
|
||||
$outputFiles[] = $this->generateFilename($prefix, $language);
|
||||
}
|
||||
} elseif ($countryCode == 86) {
|
||||
|
||||
/*
|
||||
* Reduce memory usage for China numbers
|
||||
* @see https://github.com/giggsey/libphonenumber-for-php/issues/44
|
||||
*/
|
||||
|
||||
// Fetch the 5-digit prefixes stored in the file.
|
||||
$phonePrefixes = array();
|
||||
|
||||
$this->parseTextFile(
|
||||
$this->getFilePathFromLanguageAndCountryCode($language, $countryCode),
|
||||
function ($prefix, $location) use (&$phonePrefixes) {
|
||||
$shortPrefix = substr($prefix, 0, 5);
|
||||
if (!in_array($shortPrefix, $phonePrefixes)) {
|
||||
$phonePrefixes[] = $shortPrefix;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
foreach ($phonePrefixes as $prefix) {
|
||||
$outputFiles[] = $this->generateFilename($prefix, $language);
|
||||
}
|
||||
} else {
|
||||
$outputFiles[] = $this->generateFilename($countryCode, $language);
|
||||
}
|
||||
|
||||
return $outputFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads phone prefix data from the provides file path and invokes the given handler for each
|
||||
* mapping read.
|
||||
*
|
||||
* @param $filePath
|
||||
* @param $handler
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
private function parseTextFile($filePath, \Closure $handler)
|
||||
{
|
||||
if (!file_exists($filePath) || !is_readable($filePath)) {
|
||||
throw new \InvalidArgumentException("File '{$filePath}' does not exist");
|
||||
}
|
||||
|
||||
$data = file($filePath);
|
||||
|
||||
$countryData = array();
|
||||
|
||||
foreach ($data as $line) {
|
||||
// Remove \n
|
||||
$line = str_replace("\n", "", $line);
|
||||
$line = str_replace("\r", "", $line);
|
||||
$line = trim($line);
|
||||
|
||||
if (strlen($line) == 0 || substr($line, 0, 1) == '#') {
|
||||
continue;
|
||||
}
|
||||
if (strpos($line, '|')) {
|
||||
// Valid line
|
||||
$parts = explode('|', $line);
|
||||
|
||||
|
||||
$prefix = $parts[0];
|
||||
$location = $parts[1];
|
||||
|
||||
$handler($prefix, $location);
|
||||
}
|
||||
}
|
||||
|
||||
return $countryData;
|
||||
}
|
||||
|
||||
private function getFilePathFromLanguageAndCountryCode($language, $code)
|
||||
{
|
||||
return $this->getFilePath($language . DIRECTORY_SEPARATOR . $code . self::DATA_FILE_EXTENSION);
|
||||
}
|
||||
|
||||
private function getFilePath($fileName)
|
||||
{
|
||||
$path = $this->inputDir . $fileName;
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
private function generateFilename($prefix, $language)
|
||||
{
|
||||
return $language . DIRECTORY_SEPARATOR . $prefix . self::DATA_FILE_EXTENSION;
|
||||
}
|
||||
|
||||
private function getCountryCodeFromTextFileName($countryCodeFileName)
|
||||
{
|
||||
return str_replace(self::DATA_FILE_EXTENSION, '', $countryCodeFileName);
|
||||
}
|
||||
|
||||
private function readMappingsFromFile($inputFile)
|
||||
{
|
||||
$areaCodeMap = array();
|
||||
|
||||
$this->parseTextFile(
|
||||
$this->inputDir . $inputFile,
|
||||
function ($prefix, $location) use (&$areaCodeMap) {
|
||||
$areaCodeMap[$prefix] = $location;
|
||||
}
|
||||
);
|
||||
|
||||
return $areaCodeMap;
|
||||
}
|
||||
|
||||
private function getLanguageFromTextFile($textFile)
|
||||
{
|
||||
$parts = explode(DIRECTORY_SEPARATOR, $textFile);
|
||||
|
||||
return $parts[0];
|
||||
}
|
||||
|
||||
private function removeEmptyEnglishMappings(&$mappings, $language)
|
||||
{
|
||||
if ($language != "en") {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($mappings as $k => $v) {
|
||||
if ($v == "") {
|
||||
unset($mappings[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compress the provided mappings according to the English data file if any.
|
||||
* @param string $textFile
|
||||
* @param array $mappings
|
||||
*/
|
||||
private function makeDataFallbackToEnglish($textFile, &$mappings)
|
||||
{
|
||||
$englishPath = $this->getEnglishDataPath($textFile);
|
||||
|
||||
if ($textFile == $englishPath || !file_exists($this->getFilePath($englishPath))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$countryCode = substr($textFile, 3, 2);
|
||||
|
||||
if (!array_key_exists($countryCode, $this->englishMaps)) {
|
||||
$englishMap = $this->readMappingsFromFile($englishPath);
|
||||
|
||||
$this->englishMaps[$countryCode] = $englishMap;
|
||||
}
|
||||
|
||||
$this->compressAccordingToEnglishData($this->englishMaps[$countryCode], $mappings);
|
||||
}
|
||||
|
||||
private function getEnglishDataPath($textFile)
|
||||
{
|
||||
return "en" . DIRECTORY_SEPARATOR . substr($textFile, 3, 2) . self::DATA_FILE_EXTENSION;
|
||||
}
|
||||
|
||||
private function compressAccordingToEnglishData($englishMap, &$nonEnglishMap)
|
||||
{
|
||||
foreach ($nonEnglishMap as $prefix => $value) {
|
||||
if (array_key_exists($prefix, $englishMap)) {
|
||||
$englishDescription = $englishMap[$prefix];
|
||||
if ($englishDescription == $value) {
|
||||
if (!$this->hasOverlappingPrefix($prefix, $nonEnglishMap)) {
|
||||
unset($nonEnglishMap[$prefix]);
|
||||
} else {
|
||||
$nonEnglishMap[$prefix] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function hasOverlappingPrefix($number, $mappings)
|
||||
{
|
||||
while (strlen($number) > 0) {
|
||||
$number = substr($number, 0, -1);
|
||||
|
||||
if (array_key_exists($number, $mappings)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function splitMap($mappings, $outputFiles)
|
||||
{
|
||||
$mappingForFiles = array();
|
||||
|
||||
foreach ($mappings as $prefix => $location) {
|
||||
$targetFile = null;
|
||||
|
||||
foreach ($outputFiles as $k => $outputFile) {
|
||||
$outputFilePrefix = $this->getPhonePrefixLanguagePairFromFilename($outputFile)->prefix;
|
||||
if (self::startsWith($prefix, $outputFilePrefix)) {
|
||||
$targetFile = $outputFilePrefix;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!array_key_exists($targetFile, $mappingForFiles)) {
|
||||
$mappingForFiles[$targetFile] = array();
|
||||
}
|
||||
$mappingForFiles[$targetFile][$prefix] = $location;
|
||||
}
|
||||
|
||||
return $mappingForFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the phone prefix and the language code contained in the provided file name.
|
||||
*/
|
||||
private function getPhonePrefixLanguagePairFromFilename($outputFile)
|
||||
{
|
||||
$parts = explode(DIRECTORY_SEPARATOR, $outputFile);
|
||||
|
||||
$returnObj = new \stdClass();
|
||||
$returnObj->language = $parts[0];
|
||||
|
||||
$returnObj->prefix = $this->getCountryCodeFromTextFileName($parts[1]);
|
||||
|
||||
return $returnObj;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @link http://stackoverflow.com/a/834355/403165
|
||||
* @param $haystack
|
||||
* @param $needle
|
||||
* @return bool
|
||||
*/
|
||||
private static function startsWith($haystack, $needle)
|
||||
{
|
||||
return !strncmp($haystack, $needle, strlen($needle));
|
||||
}
|
||||
|
||||
private function writeMappingFile($language, $outputFile, $data)
|
||||
{
|
||||
if (!file_exists($this->outputDir . $language)) {
|
||||
mkdir($this->outputDir . $language);
|
||||
}
|
||||
|
||||
$phpSource = '<?php' . PHP_EOL
|
||||
. self::GENERATION_COMMENT
|
||||
. 'return ' . var_export($data, true) . ';'
|
||||
. PHP_EOL;
|
||||
|
||||
$outputPath = $this->outputDir . $language . DIRECTORY_SEPARATOR . $outputFile . '.php';
|
||||
|
||||
file_put_contents($outputPath, $phpSource);
|
||||
}
|
||||
|
||||
public function addConfigurationMapping(&$availableDataFiles, $language, $prefix)
|
||||
{
|
||||
if (!array_key_exists($language, $availableDataFiles)) {
|
||||
$availableDataFiles[$language] = array();
|
||||
}
|
||||
|
||||
$availableDataFiles[$language][] = $prefix;
|
||||
}
|
||||
|
||||
private function writeConfigMap($availableDataFiles)
|
||||
{
|
||||
$phpSource = '<?php' . PHP_EOL
|
||||
. self::GENERATION_COMMENT
|
||||
. 'return ' . var_export($availableDataFiles, true) . ';'
|
||||
. PHP_EOL;
|
||||
|
||||
$outputPath = $this->outputDir . 'Map.php';
|
||||
|
||||
file_put_contents($outputPath, $phpSource);
|
||||
}
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools;
|
||||
|
||||
use libphonenumber\PhoneNumberToTimeZonesMapper;
|
||||
|
||||
class GenerateTimeZonesMapData
|
||||
{
|
||||
const GENERATION_COMMENT = <<<'EOT'
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
EOT;
|
||||
private $inputTextFile;
|
||||
|
||||
public function __construct($inputFile, $outputDir)
|
||||
{
|
||||
$this->inputTextFile = $inputFile;
|
||||
|
||||
if (!is_readable($this->inputTextFile)) {
|
||||
throw new \RuntimeException("The provided input text file does not exist.");
|
||||
}
|
||||
|
||||
$data = $this->parseTextFile();
|
||||
$this->writeMappingFile($outputDir, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads phone prefix data from the provided input stream and returns a SortedMap with the
|
||||
* prefix to time zones mappings.
|
||||
*/
|
||||
private function parseTextFile()
|
||||
{
|
||||
$data = file($this->inputTextFile);
|
||||
|
||||
$timeZoneMap = array();
|
||||
|
||||
foreach ($data as $line) {
|
||||
// Remove \n
|
||||
$line = str_replace("\n", "", $line);
|
||||
$line = str_replace("\r", "", $line);
|
||||
$line = trim($line);
|
||||
|
||||
if (strlen($line) == 0 || substr($line, 0, 1) == '#') {
|
||||
continue;
|
||||
}
|
||||
if (strpos($line, '|')) {
|
||||
// Valid line
|
||||
$parts = explode('|', $line);
|
||||
|
||||
|
||||
$prefix = $parts[0];
|
||||
$timezone = $parts[1];
|
||||
|
||||
$timeZoneMap[$prefix] = $timezone;
|
||||
}
|
||||
}
|
||||
|
||||
return $timeZoneMap;
|
||||
}
|
||||
|
||||
private function writeMappingFile($outputFile, $data)
|
||||
{
|
||||
$phpSource = '<?php' . PHP_EOL
|
||||
. self::GENERATION_COMMENT
|
||||
. 'return ' . var_export($data, true) . ';'
|
||||
. PHP_EOL;
|
||||
|
||||
$outputPath = $outputFile . DIRECTORY_SEPARATOR . PhoneNumberToTimeZonesMapper::MAPPING_DATA_FILE_NAME;
|
||||
|
||||
file_put_contents($outputPath, $phpSource);
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
# Define version and release number
|
||||
%define version @PACKAGE_VERSION@
|
||||
%define release 1
|
||||
%define php_version 53
|
||||
|
||||
Name: libphonenumber-for-php
|
||||
Version: %{version}
|
||||
Release: %{release}.php%{php_version}%{?dist}
|
||||
Summary: libphonenumber for PHP
|
||||
# See https://github.com/giggsey/libphonenumber-for-php/blob/master/LICENSE
|
||||
License: Apache 2.0
|
||||
Group: Development/Libraries
|
||||
URL: https://github.com/giggsey/libphonenumber-for-php
|
||||
# Get the source files from https://github.com/giggsey/libphonenumber-for-php/tags
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
|
||||
%description
|
||||
A PHP library for parsing, formatting, storing and validating international phone numbers.
|
||||
This library is based on Google's libphonenumber and forked from a version by Davide Mendolia.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%build
|
||||
|
||||
# Clean the buildroot so that it does not contain any stuff from previous builds
|
||||
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
|
||||
|
||||
# Install the extension
|
||||
install -d %{buildroot}
|
||||
|
||||
# Prepare files
|
||||
mkdir -p %{buildroot}/usr/share/php
|
||||
cp -a src/libphonenumber/ %{buildroot}/usr/share/php
|
||||
|
||||
%clean
|
||||
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
/usr/share/php/libphonenumber
|
||||
|
||||
%changelog
|
||||
* Wed Apr 16 2014 Adrian Siminiceanu <adrian.siminiceanu@gmail.com>
|
||||
- Initial spec file
|
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="./Tests/bootstrap.php"
|
||||
colors="true">
|
||||
|
||||
<testsuites>
|
||||
<testsuite>
|
||||
<directory>./Tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">./src/</directory>
|
||||
<exclude>
|
||||
<!-- Exclude data directories, and files -->
|
||||
<directory suffix=".php">./src/libphonenumber/data/</directory>
|
||||
<directory suffix=".php">./src/libphonenumber/carrier/data/</directory>
|
||||
<directory suffix=".php">./src/libphonenumber/geocoding/data/</directory>
|
||||
<directory suffix=".php">./src/libphonenumber/timezone/data/</directory>
|
||||
<file>./src/libphonenumber/AlternateFormatsCountryCodeSet.php</file>
|
||||
<file>./src/libphonenumber/CountryCodeToRegionCodeMap.php</file>
|
||||
<file>./src/libphonenumber/CountryCodeToRegionCodeMapForTesting.php</file>
|
||||
<file>./src/libphonenumber/RegionCode.php</file>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
</phpunit>
|
||||
|
@@ -1,7 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
* This file has been @generated by a phing task by {@link BuildMetadataPHPFromXml}.
|
||||
* See [README.md](README.md#generating-data) for more information.
|
||||
*
|
||||
* Pull requests changing data in these files will not be accepted. See the
|
||||
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
|
||||
* metadata changes.
|
||||
*
|
||||
* Do not modify this file directly!
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -1,7 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
* This file has been @generated by a phing task by {@link BuildMetadataPHPFromXml}.
|
||||
* See [README.md](README.md#generating-data) for more information.
|
||||
*
|
||||
* Pull requests changing data in these files will not be accepted. See the
|
||||
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
|
||||
* metadata changes.
|
||||
*
|
||||
* Do not modify this file directly!
|
||||
*/
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user