update v1.0.3.3
This commit is contained in:
5
vendor/giggsey/libphonenumber-for-php/.gitignore
vendored
Normal file
5
vendor/giggsey/libphonenumber-for-php/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
vendor/
|
||||
composer.phar
|
||||
composer.lock
|
||||
libphonenumber-data-dir/
|
||||
build/logs/
|
32
vendor/giggsey/libphonenumber-for-php/.travis.yml
vendored
Normal file
32
vendor/giggsey/libphonenumber-for-php/.travis.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: 7
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
- 7
|
||||
|
||||
before_script:
|
||||
- wget http://getcomposer.org/composer.phar
|
||||
- php composer.phar install --no-interaction
|
||||
- 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"
|
177
vendor/giggsey/libphonenumber-for-php/LICENSE
vendored
Normal file
177
vendor/giggsey/libphonenumber-for-php/LICENSE
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
5
vendor/giggsey/libphonenumber-for-php/METADATA-VERSION.txt
vendored
Normal file
5
vendor/giggsey/libphonenumber-for-php/METADATA-VERSION.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# This file specifies the revision of the metadata to build from
|
||||
# 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.1.0
|
232
vendor/giggsey/libphonenumber-for-php/README.md
vendored
Normal file
232
vendor/giggsey/libphonenumber-for-php/README.md
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
# libphonenumber for PHP [](https://travis-ci.org/giggsey/libphonenumber-for-php) [](https://coveralls.io/r/giggsey/libphonenumber-for-php?branch=master)
|
||||
|
||||
[](https://packagist.org/packages/giggsey/libphonenumber-for-php)
|
||||
[](https://packagist.org/packages/giggsey/libphonenumber-for-php)
|
||||
[](https://packagist.org/packages/giggsey/libphonenumber-for-php)
|
||||
|
||||
## What is it?
|
||||
A PHP library for parsing, formatting, storing and validating international phone numbers. This library is based on Google's [libphonenumber](https://github.com/googlei18n/libphonenumber).
|
||||
|
||||
|
||||
# Highlights of functionality
|
||||
* Parsing/formatting/validating phone numbers for all countries/regions of the world.
|
||||
* `getNumberType` - gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP and Personal Numbers (whenever feasible).
|
||||
* `isNumberMatch` - gets a confidence level on whether two numbers could be the same.
|
||||
* `getExampleNumber`/`getExampleNumberByType` - provides valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed.
|
||||
* `isValidNumber` - full validation of a phone number for a region using length and prefix information.
|
||||
* PhoneNumberOfflineGeocoder - provides geographical information related to a phone number.
|
||||
* PhoneNumberToTimeZonesMapper - provides timezone information related to a phone number.
|
||||
* PhoneNumberToCarrierMapper - provides carrier information related to a phone number.
|
||||
|
||||
## Installation
|
||||
|
||||
The library can be installed via [composer](http://getcomposer.org/). You can also use any other [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) compliant autoloader.
|
||||
|
||||
The PECL [mbstring](http://php.net/mbstring) extension is required for this library to be used.
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"giggsey/libphonenumber-for-php": "~7.0"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
This does mean that this project will not follow [Semantic Versioning](http://semver.org/), but instead Google's version policy. As a result, jumps in major versions may not actually contain any backwards
|
||||
incompatible changes. Please read the release notes for such releases.
|
||||
|
||||
|
||||
## Online Demo
|
||||
An [online demo](http://giggsey.com/libphonenumber/) is available, and the source can be found at [giggsey/libphonenumber-example](https://github.com/giggsey/libphonenumber-example).
|
||||
|
||||
## Quick Examples
|
||||
Let's say you have a string representing a phone number from Switzerland. This is how you parse/normalize it into a PhoneNumber object:
|
||||
|
||||
```php
|
||||
$swissNumberStr = "044 668 18 00";
|
||||
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
|
||||
try {
|
||||
$swissNumberProto = $phoneUtil->parse($swissNumberStr, "CH");
|
||||
var_dump($swissNumberProto);
|
||||
} catch (\libphonenumber\NumberParseException $e) {
|
||||
var_dump($e);
|
||||
}
|
||||
```
|
||||
|
||||
At this point, swissNumberProto contains:
|
||||
|
||||
class libphonenumber\PhoneNumber#9 (7) {
|
||||
private $countryCode =>
|
||||
int(41)
|
||||
private $nationalNumber =>
|
||||
double(446681800)
|
||||
private $extension =>
|
||||
NULL
|
||||
private $italianLeadingZero =>
|
||||
NULL
|
||||
private $rawInput =>
|
||||
NULL
|
||||
private $countryCodeSource =>
|
||||
NULL
|
||||
private $preferredDomesticCarrierCode =>
|
||||
NULL
|
||||
}
|
||||
|
||||
Now let us validate whether the number is valid:
|
||||
|
||||
```php
|
||||
$isValid = $phoneUtil->isValidNumber($swissNumberProto);
|
||||
var_dump($isValid); // true
|
||||
```
|
||||
|
||||
There are a few formats supported by the formatting method, as illustrated below:
|
||||
|
||||
```php
|
||||
// Produces "+41446681800"
|
||||
echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::E164);
|
||||
|
||||
// Produces "044 668 18 00"
|
||||
echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::NATIONAL);
|
||||
|
||||
// Produces "+41 44 668 18 00"
|
||||
echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL);
|
||||
```
|
||||
|
||||
You could also choose to format the number in the way it is dialled from another country:
|
||||
|
||||
```php
|
||||
// Produces "011 41 44 668 1800", the number when it is dialled in the United States.
|
||||
echo $phoneUtil->formatOutOfCountryCallingNumber($swissNumberProto, "US");
|
||||
|
||||
// Produces "00 41 44 668 18 00", the number when it is dialled in Great Britain.
|
||||
echo $phoneUtil->formatOutOfCountryCallingNumber($swissNumberProto, "GB");
|
||||
```
|
||||
|
||||
### Geocoder
|
||||
|
||||
The PECL [intl](http://php.net/intl) extension is required for the geocoder to be used.
|
||||
|
||||
```php
|
||||
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
|
||||
|
||||
$swissNumberProto = $phoneUtil->parse("044 668 18 00", "CH");
|
||||
$usNumberProto = $phoneUtil->parse("+1 650 253 0000", "US");
|
||||
$gbNumberProto = $phoneUtil->parse("0161 496 0000", "GB");
|
||||
|
||||
$geocoder = \libphonenumber\geocoding\PhoneNumberOfflineGeocoder::getInstance();
|
||||
|
||||
// Outputs "Zurich"
|
||||
echo $geocoder->getDescriptionForNumber($swissNumberProto, "en_US");
|
||||
|
||||
// Outputs "Zürich"
|
||||
echo $geocoder->getDescriptionForNumber($swissNumberProto, "de_DE");
|
||||
|
||||
// Outputs "Zurigo"
|
||||
echo $geocoder->getDescriptionForNumber($swissNumberProto, "it_IT");
|
||||
|
||||
|
||||
// Outputs "Mountain View, CA"
|
||||
echo $geocoder->getDescriptionForNumber($usNumberProto, "en_US");
|
||||
|
||||
// Outputs "Mountain View, CA"
|
||||
echo $geocoder->getDescriptionForNumber($usNumberProto, "de_DE");
|
||||
|
||||
// Outputs "미국" (Korean for United States)
|
||||
echo $geocoder->getDescriptionForNumber($usNumberProto, "ko-KR");
|
||||
|
||||
// Outputs "Manchester"
|
||||
echo $geocoder->getDescriptionForNumber($gbNumberProto, "en_GB");
|
||||
|
||||
// Outputs "영국" (Korean for United Kingdom)
|
||||
echo $geocoder->getDescriptionForNumber($gbNumberProto, "ko-KR");
|
||||
```
|
||||
|
||||
### ShortNumberInfo
|
||||
|
||||
```php
|
||||
$shortNumberInfo = \libphonenumber\ShortNumberInfo::getInstance();
|
||||
|
||||
// true
|
||||
var_dump($shortNumberInfo->isEmergencyNumber("999", "GB"));
|
||||
|
||||
// true
|
||||
var_dump($shortNumberInfo->connectsToEmergencyNumber("999", "GB"));
|
||||
|
||||
// false
|
||||
var_dump($shortNumberInfo->connectsToEmergencyNumber("911", "GB"));
|
||||
|
||||
// true
|
||||
var_dump($shortNumberInfo->isEmergencyNumber("911", "US"));
|
||||
|
||||
// true
|
||||
var_dump($shortNumberInfo->connectsToEmergencyNumber("911", "US"));
|
||||
|
||||
// false
|
||||
var_dump($shortNumberInfo->isEmergencyNumber("911123", "US"));
|
||||
|
||||
// true
|
||||
var_dump($shortNumberInfo->connectsToEmergencyNumber("911123", "US"));
|
||||
```
|
||||
|
||||
### Mapping Phone Numbers to carrier
|
||||
|
||||
The PECL [intl](http://php.net/intl) extension is required for the carrier mapper to be used.
|
||||
|
||||
```php
|
||||
|
||||
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
|
||||
$swissNumberProto = $phoneUtil->parse("798765432", "CH");
|
||||
|
||||
$carrierMapper = \libphonenumber\PhoneNumberToCarrierMapper::getInstance();
|
||||
// Outputs "Swisscom"
|
||||
echo $carrierMapper->getNameForNumber($swissNumberProto, "en");
|
||||
```
|
||||
|
||||
### Mapping Phone Numbers to TimeZones
|
||||
|
||||
```php
|
||||
|
||||
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
|
||||
$swissNumberProto = $phoneUtil->parse("798765432", "CH");
|
||||
|
||||
$timeZoneMapper = \libphonenumber\PhoneNumberToTimeZonesMapper::getInstance();
|
||||
// returns array("Europe/Zurich")
|
||||
$timeZones = $timeZoneMapper->getTimeZonesForNumber($swissNumberProto);
|
||||
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
#### Problems with Invalid Numbers?
|
||||
|
||||
This library uses phone number metadata from Google's [libphonenumber](https://github.com/googlei18n/libphonenumber). If this library is working as intended, it should provide the same result as the Java version of Google's project.
|
||||
|
||||
If you believe that a phone number is returning an incorrect result, first test it with [libphonenumber](https://github.com/googlei18n/libphonenumber) via their [Online Demo](https://libphonenumber.appspot.com/). If that returns the same result as this project, and you feel it is in error, raise it as an Issue with the libphonenumber project.
|
||||
|
||||
If Google's [Online Demo](https://libphonenumber.appspot.com/) gives a different result to the [libphonenumber-for-php demo](http://giggsey.com/libphonenumber/), then please raise an Issue here.
|
||||
|
||||
## Generating data
|
||||
|
||||
Phing is used to 'compile' the metadata.
|
||||
|
||||
Ensure you have all the dev composer dependencies installed, then run
|
||||
|
||||
```bash
|
||||
vendor/bin/phing compile
|
||||
```
|
||||
|
||||
This compile process clones the [libphonenumber](https://github.com/googlei18n/libphonenumber) project at the version specified in [METADATA-VERSION.txt](METADATA-VERSION.txt).
|
||||
|
||||
## Integration with frameworks
|
||||
|
||||
Other packages exist that integrate libphonenumber-for-php into frameworks.
|
||||
|
||||
These packages are supplied by third parties, and their quality can not be guaranteed.
|
||||
|
||||
- Symfony: [PhoneNumberBundle](https://github.com/misd-service-development/phone-number-bundle)
|
||||
- Laravel: [Laravel Phone](https://github.com/Propaganistas/Laravel-Phone)
|
||||
|
4
vendor/giggsey/libphonenumber-for-php/Tests/bootstrap.php
vendored
Normal file
4
vendor/giggsey/libphonenumber-for-php/Tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
ini_set('memory_limit', '1024M');
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
44
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/CodeCoverageTest.php
vendored
Normal file
44
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/CodeCoverageTest.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
30
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue14Test.php
vendored
Normal file
30
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue14Test.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
41
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue17Test.php
vendored
Normal file
41
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue17Test.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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()
|
||||
{
|
||||
if(!extension_loaded('intl')) {
|
||||
$this->markTestSkipped('The intl extension must be installed');
|
||||
}
|
||||
|
||||
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'));
|
||||
}
|
||||
}
|
50
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue21Test.php
vendored
Normal file
50
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue21Test.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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'));
|
||||
}
|
||||
}
|
43
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue23Test.php
vendored
Normal file
43
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue23Test.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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();
|
||||
|
||||
if(extension_loaded('intl')) {
|
||||
$this->geocoder = PhoneNumberOfflineGeocoder::getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
public function testTKGeoLocation()
|
||||
{
|
||||
$number = '+6903010';
|
||||
|
||||
$phoneNumber = $this->phoneUtil->parse($number, RegionCode::ZZ);
|
||||
|
||||
$this->assertEquals('TK', $this->phoneUtil->getRegionCodeForNumber($phoneNumber));
|
||||
|
||||
if($this->geocoder instanceof PhoneNumberOfflineGeocoder) {
|
||||
$this->assertEquals('Tokelau', $this->geocoder->getDescriptionForNumber($phoneNumber, 'en'));
|
||||
}
|
||||
}
|
||||
}
|
28
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue34Test.php
vendored
Normal file
28
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue34Test.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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"));
|
||||
}
|
||||
}
|
51
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue35Test.php
vendored
Normal file
51
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue35Test.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
41
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue36Test.php
vendored
Normal file
41
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue36Test.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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()
|
||||
{
|
||||
if(!extension_loaded('intl')) {
|
||||
$this->markTestSkipped('The intl extension must be installed');
|
||||
}
|
||||
|
||||
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'));
|
||||
}
|
||||
}
|
30
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue3Test.php
vendored
Normal file
30
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue3Test.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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));
|
||||
|
||||
}
|
||||
}
|
82
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue44Test.php
vendored
Normal file
82
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue44Test.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?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()
|
||||
{
|
||||
if(!extension_loaded('intl')) {
|
||||
$this->markTestSkipped('The intl extension must be installed');
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
30
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue4Test.php
vendored
Normal file
30
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue4Test.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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));
|
||||
|
||||
}
|
||||
}
|
32
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue64Test.php
vendored
Normal file
32
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue64Test.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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'));
|
||||
}
|
||||
}
|
40
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue68Test.php
vendored
Normal file
40
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue68Test.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
21
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue76Test.php
vendored
Normal file
21
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/Issue76Test.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
321
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/LocaleTest.php
vendored
Normal file
321
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/LocaleTest.php
vendored
Normal file
@@ -0,0 +1,321 @@
|
||||
<?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()
|
||||
{
|
||||
if(!extension_loaded('intl')) {
|
||||
$this->markTestSkipped('The intl extension must be installed');
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
* Bad country codes were removed, and names updated to match my Windows 7 Locale settings (these might be different
|
||||
* on different operating systems and other Locales).
|
||||
*
|
||||
* @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 and 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 and 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' => 'Saint Helena',
|
||||
'KN' => 'Saint Kitts and Nevis',
|
||||
'LC' => 'Saint Lucia',
|
||||
'PM' => 'Saint Pierre and Miquelon',
|
||||
'VC' => 'Saint Vincent and the Grenadines',
|
||||
'WS' => 'Samoa',
|
||||
'SM' => 'San Marino',
|
||||
'ST' => 'São Tomé and 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 and 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 and Tobago',
|
||||
'TN' => 'Tunisia',
|
||||
'TR' => 'Turkey',
|
||||
'TM' => 'Turkmenistan',
|
||||
'TC' => 'Turks and 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 and Futuna',
|
||||
'EH' => 'Western Sahara',
|
||||
'YE' => 'Yemen',
|
||||
'ZM' => 'Zambia',
|
||||
'ZW' => 'Zimbabwe',
|
||||
);
|
||||
}
|
||||
}
|
188
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/UKNumbersTest.php
vendored
Normal file
188
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/Issues/UKNumbersTest.php
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
<?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");
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,143 @@
|
||||
<?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()
|
||||
{
|
||||
if(!extension_loaded('intl')) {
|
||||
$this->markTestSkipped('The intl extension must be installed');
|
||||
}
|
||||
|
||||
$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"));
|
||||
|
||||
}
|
||||
}
|
18
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/Map.php
vendored
Normal file
18
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/Map.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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,
|
||||
),
|
||||
);
|
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/en/1650.php
vendored
Normal file
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/en/1650.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1650212 => 'US carrier',
|
||||
1650213 => 'US carrier2',
|
||||
);
|
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/en/244.php
vendored
Normal file
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/en/244.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?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',
|
||||
);
|
11
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/en/44.php
vendored
Normal file
11
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/en/44.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
4411 => 'British fixed line carrier',
|
||||
4473 => 'British carrier',
|
||||
44760 => 'British pager',
|
||||
);
|
9
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/sv/44.php
vendored
Normal file
9
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/carrier/data/sv/44.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
4473 => 'Brittisk operatör',
|
||||
);
|
337
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/ExampleNumbersTest.php
vendored
Normal file
337
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/ExampleNumbersTest.php
vendored
Normal file
@@ -0,0 +1,337 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 testEveryRegionHasExampleNumber($regionCode)
|
||||
{
|
||||
$exampleNumber = $this->phoneNumberUtil->getExampleNumber($regionCode);
|
||||
$this->assertNotNull($exampleNumber, "None 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 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);
|
||||
}
|
||||
|
||||
$costArray = array(
|
||||
ShortNumberCost::PREMIUM_RATE,
|
||||
ShortNumberCost::STANDARD_RATE,
|
||||
ShortNumberCost::TOLL_FREE,
|
||||
ShortNumberCost::UNKNOWN_COST
|
||||
);
|
||||
|
||||
foreach ($costArray as $cost) {
|
||||
$exampleShortNumber = $this->shortNumberInfo->getExampleShortNumberForCost($regionCode, $cost);
|
||||
if ($exampleShortNumber != '') {
|
||||
$this->assertEquals(
|
||||
$cost,
|
||||
$this->shortNumberInfo->getExpectedCostForRegion($this->phoneNumberUtil->parse($exampleShortNumber, $regionCode), $regionCode),
|
||||
"Wrong cost for " . (string)$phoneNumber
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/IntlTest.php
vendored
Normal file
37
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/IntlTest.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
<?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());
|
||||
}
|
||||
}
|
||||
}
|
99
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/PhoneNumberTest.php
vendored
Normal file
99
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/PhoneNumberTest.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
3314
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/PhoneNumberUtilTest.php
vendored
Normal file
3314
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/PhoneNumberUtilTest.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
435
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/ShortNumberInfoTest.php
vendored
Normal file
435
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/ShortNumberInfoTest.php
vendored
Normal file
@@ -0,0 +1,435 @@
|
||||
<?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::UNKNOWN_COST,
|
||||
$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 . ")");
|
||||
}
|
||||
}
|
||||
}
|
157
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/ShortNumberUtilTest.php
vendored
Normal file
157
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/core/ShortNumberUtilTest.php
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
<?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));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
<?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',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '12345678',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '12345678',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{8}',
|
||||
'ExampleNumber' => '12345678',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => '001',
|
||||
'countryCode' => 800,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => true,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,116 @@
|
||||
<?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',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '123456789',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
'ExampleNumber' => '123456789',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '123456789',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'AD',
|
||||
'countryCode' => 376,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,103 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '600\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '600123456',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'AE',
|
||||
'countryCode' => 971,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,116 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '2\\d(?:[26-9]\\d|\\d[26-9])\\d{5}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '222123456',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '9[1-3]\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '923123456',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,211 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-3]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{6,10}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '9\\d{10}|[1-3]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '6(0\\d|10)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1[02-9]|[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(9)(11)(\\d{4})(\\d{4})',
|
||||
'format' => '$2 15 $3-$4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '911',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
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',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[68]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '11',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1[02-9]|[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(9)(11)(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '911',
|
||||
),
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(9)(\\d{4})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '9(?:1[02-9]|[23])',
|
||||
),
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[68]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,127 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[2378]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '4\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1800\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '190[0126]\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{1})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[2-478]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'BB',
|
||||
'countryCode' => 1,
|
||||
'internationalPrefix' => '011',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'BR',
|
||||
'countryCode' => 55,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,104 @@
|
||||
<?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}',
|
||||
),
|
||||
'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}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '242(357|359|457|557)\\d{4}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(00|66|77|88)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'BS',
|
||||
'countryCode' => 1,
|
||||
'internationalPrefix' => '011',
|
||||
'nationalPrefix' => '1',
|
||||
'nationalPrefixForParsing' => '1',
|
||||
'sameMobileAndFixedLinePattern' => false,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,138 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{5}',
|
||||
'PossibleNumberPattern' => '\\d{6}',
|
||||
'ExampleNumber' => '112345',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{5}',
|
||||
'PossibleNumberPattern' => '\\d{6}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{3})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[1-8]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '8$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[1-8]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '8 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'CA',
|
||||
'countryCode' => 1,
|
||||
'internationalPrefix' => '011',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'CC',
|
||||
'countryCode' => 61,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'CN',
|
||||
'countryCode' => 86,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'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' => '$1',
|
||||
'domesticCarrierCodeFormattingRule' => '$CC $1',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'CX',
|
||||
'countryCode' => 61,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,173 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '(?:[24-6]\\d{2}|3[03-9]\\d|[789](?:[1-9]\\d|0[2-9]))\\d{1,8}',
|
||||
'PossibleNumberPattern' => '\\d{2,14}',
|
||||
'ExampleNumber' => '30123456',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1(5\\d{9}|7\\d{8}|6[02]\\d{8}|63\\d{7})',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900([135]\\d{6}|9\\d{7})',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4,11})',
|
||||
'format' => '$1/$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[34]0|[68]9',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{1})(\\d{6})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '800',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3,4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '900',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,115 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '3\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{7}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '3\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{7}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,148 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-6]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{6,10}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '7[1-57-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '9[018]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(?:4[3-5]|7[0-2])\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '70\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '56\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '76\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '6',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '(0$1)',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{3})(\\d{3})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '7[1-57-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '(0$1)',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '8[47]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '(0$1)',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => true,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'GG',
|
||||
'countryCode' => 44,
|
||||
'internationalPrefix' => '',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,104 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '30\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '30\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'HU',
|
||||
'countryCode' => 36,
|
||||
'internationalPrefix' => '',
|
||||
'nationalPrefix' => '06',
|
||||
'nationalPrefixForParsing' => '06',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,146 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '0\\d{9,10}',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '3\\d{8,9}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80(?:0\\d{6}|3\\d{3})',
|
||||
'PossibleNumberPattern' => '\\d{6,9}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '89(?:2\\d{3}|9\\d{6})',
|
||||
'PossibleNumberPattern' => '\\d{6,9}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{4})(\\d{3,4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '0[13-57-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '3',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3,6})',
|
||||
'format' => '$1 $2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '8',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => true,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,187 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '07\\d{5}|[1-357-9]\\d{3,10}',
|
||||
'PossibleNumberPattern' => '\\d{4,11}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '07\\d{5}|[1-357-9]\\d{3,10}',
|
||||
'PossibleNumberPattern' => '\\d{4,11}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '0777[01]\\d{2}',
|
||||
'PossibleNumberPattern' => '\\d{7}',
|
||||
'ExampleNumber' => '0777012',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[23]\\d{3}',
|
||||
'PossibleNumberPattern' => '\\d{4}',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{2})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '077',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})',
|
||||
'format' => '*$1',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[23]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => true,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,254 @@
|
||||
<?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}',
|
||||
),
|
||||
'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',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1[0-25-9]\\d{7,8}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
'ExampleNumber' => '1023456789',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '801234567',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '60[2-9]\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '602345678',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '50\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '5012345678',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '70\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '7012345678',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d)(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '131',
|
||||
1 => '1312',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '13[2-9]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{2})(\\d{3})(\\d{4})',
|
||||
'format' => '$1-$2-$3-$4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '30',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,211 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[2-9]\\d{9}',
|
||||
'PossibleNumberPattern' => '\\d{7,10}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1\\d{10}',
|
||||
'PossibleNumberPattern' => '\\d{11}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '33|55|81',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[89]00',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '33|55|81',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '01 $1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
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' => '',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'pattern' => '(1)(\\d{2})(\\d{4})(\\d{4})',
|
||||
'format' => '$1 $2 $3 $4',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1(?:33|55|81)',
|
||||
),
|
||||
),
|
||||
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])',
|
||||
),
|
||||
),
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,140 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '24099\\d{3}|(?:3[2-79]|[479][2-689]|6[235-9])\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{7,8}',
|
||||
),
|
||||
'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}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{6,7}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{6,7}',
|
||||
'PossibleNumberPattern' => '\\d{9,10}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d)(\\d{3})(\\d{3,5})',
|
||||
'format' => '$1-$2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '2[179]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '[89]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '0$1',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,114 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[1-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '(?:5[01]|6[069]|7[289]|88)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '70\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,119 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '262\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '262161234',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '6(?:9[23]|47)\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '692123456',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '801234567',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(?:1[01]|2[0156]|84|9[0-37-9])\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '810123456',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingDigits' => '262|6(?:9[23]|47)|8',
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
return array (
|
||||
'generalDesc' =>
|
||||
array (
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'id' => 'SE',
|
||||
'countryCode' => 46,
|
||||
'internationalPrefix' => '00',
|
||||
'sameMobileAndFixedLinePattern' => true,
|
||||
'numberFormat' =>
|
||||
array (
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,139 @@
|
||||
<?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}
|
||||
',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[36]\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{8}',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[89]\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{8}',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1?800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10,11}',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '1900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{11}',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{4})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '1[89]',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
0 => '800',
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
),
|
||||
'mainCountryForCode' => false,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => false,
|
||||
);
|
@@ -0,0 +1,141 @@
|
||||
<?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',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[13-689]\\d{9}|2[0-35-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{7}(?:\\d{3})?',
|
||||
'ExampleNumber' => '1234567890',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '[13-689]\\d{9}|2[0-35-9]\\d{8}',
|
||||
'PossibleNumberPattern' => '\\d{7}(?:\\d{3})?',
|
||||
'ExampleNumber' => '1234567890',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '8(?:00|66|77|88)\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '1234567890',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '900\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '1234567890',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '800\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{10}',
|
||||
'ExampleNumber' => '1234567890',
|
||||
),
|
||||
'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' => '',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'intlNumberFormat' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'pattern' => '(\\d{3})(\\d{3})(\\d{4})',
|
||||
'format' => '$1 $2 $3',
|
||||
'leadingDigitsPatterns' =>
|
||||
array (
|
||||
),
|
||||
'nationalPrefixFormattingRule' => '',
|
||||
'domesticCarrierCodeFormattingRule' => '',
|
||||
),
|
||||
),
|
||||
'mainCountryForCode' => true,
|
||||
'leadingZeroPossible' => false,
|
||||
'mobileNumberPortableRegion' => true,
|
||||
);
|
@@ -0,0 +1,108 @@
|
||||
<?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}',
|
||||
),
|
||||
'fixedLine' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '2696[0-4]\\d{4}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '269601234',
|
||||
),
|
||||
'mobile' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '639\\d{6}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '639123456',
|
||||
),
|
||||
'tollFree' =>
|
||||
array (
|
||||
'NationalNumberPattern' => '80\\d{7}',
|
||||
'PossibleNumberPattern' => '\\d{9}',
|
||||
'ExampleNumber' => '801234567',
|
||||
),
|
||||
'premiumRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'sharedCost' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'personalNumber' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voip' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'pager' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'uan' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'emergency' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'voicemail' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'shortCode' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'standardRate' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'carrierSpecific' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'noInternationalDialling' =>
|
||||
array (
|
||||
'NationalNumberPattern' => 'NA',
|
||||
'PossibleNumberPattern' => 'NA',
|
||||
),
|
||||
'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,
|
||||
);
|
@@ -0,0 +1,201 @@
|
||||
<?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 $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::$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()
|
||||
{
|
||||
if(!extension_loaded('intl')) {
|
||||
$this->markTestSkipped('The intl extension must be installed');
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
<?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", "", ""));
|
||||
}
|
||||
}
|
27
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/Map.php
vendored
Normal file
27
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/Map.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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,
|
||||
),
|
||||
);
|
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1201 => 'New Jersey',
|
||||
);
|
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1650 => 'Kalifornien',
|
||||
);
|
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1201 => 'NJ',
|
||||
);
|
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/1212.php
vendored
Normal file
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/1212.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1212 => 'NY',
|
||||
1212812 => 'New York, NY',
|
||||
);
|
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1617423 => 'Boston, MA',
|
||||
);
|
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/1650.php
vendored
Normal file
10
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/1650.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1650 => 'CA',
|
||||
1650960 => 'Mountain View, CA',
|
||||
);
|
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
1989 => 'MA',
|
||||
);
|
9
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/54.php
vendored
Normal file
9
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/54.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
542214 => 'La Plata',
|
||||
);
|
24
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/82.php
vendored
Normal file
24
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/en/82.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
return array (
|
||||
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',
|
||||
);
|
23
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/ko/82.php
vendored
Normal file
23
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/prefixmapper/data/ko/82.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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 => '전북',
|
||||
);
|
124
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/timezone/PrefixTimeZonesMapTest.php
vendored
Normal file
124
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/timezone/PrefixTimeZonesMapTest.php
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
33
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/timezone/UKTest.php
vendored
Normal file
33
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/timezone/UKTest.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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));
|
||||
}
|
||||
}
|
18
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/timezone/data/map_data.php
vendored
Normal file
18
vendor/giggsey/libphonenumber-for-php/Tests/libphonenumber/Tests/timezone/data/map_data.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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',
|
||||
);
|
203
vendor/giggsey/libphonenumber-for-php/build.xml
vendored
Normal file
203
vendor/giggsey/libphonenumber-for-php/build.xml
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
<?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='results' type='dir' property="git.path.exists"/>
|
||||
<if>
|
||||
<isfalse value="${git.path.exists}"/>
|
||||
<then>
|
||||
<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"/>
|
||||
</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>
|
7
vendor/giggsey/libphonenumber-for-php/build/build.php
vendored
Normal file
7
vendor/giggsey/libphonenumber-for-php/build/build.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$app = new \libphonenumber\buildtools\BuildApplication();
|
||||
$app->run();
|
26
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/BuildApplication.php
vendored
Normal file
26
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/BuildApplication.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
463
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/BuildMetadataFromXml.php
vendored
Normal file
463
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/BuildMetadataFromXml.php
vendored
Normal file
@@ -0,0 +1,463 @@
|
||||
<?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 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";
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private static $liteBuild;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $inputXmlFile
|
||||
* @param boolean $liteBuild
|
||||
* @return PhoneMetadata[]
|
||||
*/
|
||||
public static function buildPhoneMetadataCollection($inputXmlFile, $liteBuild)
|
||||
{
|
||||
self::$liteBuild = $liteBuild;
|
||||
$document = new \DOMDocument();
|
||||
$document->load($inputXmlFile);
|
||||
$territories = $document->getElementsByTagName("territory");
|
||||
$metadataCollection = array();
|
||||
foreach ($territories as $territory) {
|
||||
if ($territory->hasAttribute("id")) {
|
||||
$regionCode = $territory->getAttribute("id");
|
||||
} else {
|
||||
$regionCode = "";
|
||||
}
|
||||
$metadata = self::loadCountryMetadata($regionCode, $territory);
|
||||
$metadataCollection[] = $metadata;
|
||||
}
|
||||
return $metadataCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $regionCode
|
||||
* @param \DOMElement $element
|
||||
* @return PhoneMetadata
|
||||
*/
|
||||
public static function loadCountryMetadata($regionCode, \DOMElement $element)
|
||||
{
|
||||
$nationalPrefix = self::getNationalPrefix($element);
|
||||
$nationalPrefixFormattingRule = self::getNationalPrefixFormattingRuleFromElement($element, $nationalPrefix);
|
||||
$metadata = self::loadTerritoryTagMetadata(
|
||||
$regionCode,
|
||||
$element,
|
||||
$nationalPrefix,
|
||||
$nationalPrefixFormattingRule
|
||||
);
|
||||
|
||||
self::loadAvailableFormats($metadata, $regionCode, $element, $nationalPrefix, $nationalPrefixFormattingRule);
|
||||
self::loadGeneralDesc($metadata, $element);
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the national prefix of the provided country element.
|
||||
* @param \DOMElement $element
|
||||
* @return string
|
||||
*/
|
||||
private static function getNationalPrefix(\DOMElement $element)
|
||||
{
|
||||
return $element->hasAttribute(self::NATIONAL_PREFIX) ? $element->getAttribute(self::NATIONAL_PREFIX) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \DOMElement $element
|
||||
* @param string $nationalPrefix
|
||||
* @return string
|
||||
*/
|
||||
private 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;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $regionCode
|
||||
* @param \DOMElement $element
|
||||
* @param string $nationalPrefix
|
||||
* @param string $nationalPrefixFormattingRule
|
||||
* @return PhoneMetadata
|
||||
*/
|
||||
private static function loadTerritoryTagMetadata(
|
||||
$regionCode,
|
||||
\DOMElement $element,
|
||||
$nationalPrefix,
|
||||
$nationalPrefixFormattingRule
|
||||
) {
|
||||
$metadata = new PhoneMetadata();
|
||||
$metadata->setId($regionCode);
|
||||
$metadata->setCountryCode((int)$element->getAttribute(self::COUNTRY_CODE));
|
||||
if ($element->hasAttribute(self::LEADING_DIGITS)) {
|
||||
$metadata->setLeadingDigits($element->getAttribute(self::LEADING_DIGITS));
|
||||
}
|
||||
$metadata->setInternationalPrefix($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(
|
||||
$element->getAttribute(self::NATIONAL_PREFIX_FOR_PARSING)
|
||||
);
|
||||
if ($element->hasAttribute(self::NATIONAL_PREFIX_TRANSFORM_RULE)) {
|
||||
$metadata->setNationalPrefixTransformRule($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.
|
||||
* @param PhoneMetadata $metadata
|
||||
* @param string $regionCode
|
||||
* @param \DOMElement $element
|
||||
* @param string $nationalPrefix
|
||||
* @param string $nationalPrefixFormattingRule
|
||||
*/
|
||||
private static function loadAvailableFormats(
|
||||
PhoneMetadata $metadata,
|
||||
$regionCode,
|
||||
\DOMElement $element,
|
||||
$nationalPrefix,
|
||||
$nationalPrefixFormattingRule
|
||||
) {
|
||||
|
||||
$carrierCodeFormattingRule = "";
|
||||
if ($element->hasAttribute(self::CARRIER_CODE_FORMATTING_RULE)) {
|
||||
$carrierCodeFormattingRule = self::getDomesticCarrierCodeFormattingRuleFromElement(
|
||||
$element,
|
||||
$nationalPrefix
|
||||
);
|
||||
}
|
||||
$numberFormatElements = $element->getElementsByTagName(self::NUMBER_FORMAT);
|
||||
$hasExplicitIntlFormatDefined = false;
|
||||
|
||||
$numOfFormatElements = $numberFormatElements->length;
|
||||
if ($numOfFormatElements > 0) {
|
||||
for ($i = 0; $i < $numOfFormatElements; $i++) {
|
||||
$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::CARRIER_CODE_FORMATTING_RULE)) {
|
||||
$format->setDomesticCarrierCodeFormattingRule(
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private 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.
|
||||
*
|
||||
* @param PhoneMetadata $metadata
|
||||
* @param \DOMElement $numberFormatElement
|
||||
* @param NumberFormat $format
|
||||
* @throws \RuntimeException if multiple or no formats have been encountered.
|
||||
*/
|
||||
private static function loadNationalFormat(
|
||||
PhoneMetadata $metadata,
|
||||
\DOMElement $numberFormatElement,
|
||||
NumberFormat $format
|
||||
) {
|
||||
self::setLeadingDigitsPatterns($numberFormatElement, $format);
|
||||
$format->setPattern($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);
|
||||
}
|
||||
|
||||
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++) {
|
||||
$elt = $leadingDigitsPatternNodes->item($i);
|
||||
$format->addLeadingDigitsPattern(
|
||||
$elt->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.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
private 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;
|
||||
}
|
||||
|
||||
private static function loadGeneralDesc(PhoneMetadata $metadata, \DOMElement $element)
|
||||
{
|
||||
$generalDesc = new PhoneNumberDesc();
|
||||
$generalDesc = self::processPhoneNumberDescElement($generalDesc, $element, self::GENERAL_DESC);
|
||||
$metadata->setGeneralDesc($generalDesc);
|
||||
$metadata->setFixedLine(self::processPhoneNumberDescElement($generalDesc, $element, self::FIXED_LINE));
|
||||
$metadata->setMobile(self::processPhoneNumberDescElement($generalDesc, $element, self::MOBILE));
|
||||
$metadata->setStandardRate(self::processPhoneNumberDescElement($generalDesc, $element, self::STANDARD_RATE));
|
||||
$metadata->setPremiumRate(self::processPhoneNumberDescElement($generalDesc, $element, self::PREMIUM_RATE));
|
||||
$metadata->setShortCode(self::processPhoneNumberDescElement($generalDesc, $element, self::SHORT_CODE));
|
||||
$metadata->setTollFree(self::processPhoneNumberDescElement($generalDesc, $element, self::TOLL_FREE));
|
||||
$metadata->setSharedCost(self::processPhoneNumberDescElement($generalDesc, $element, self::SHARED_COST));
|
||||
|
||||
|
||||
$metadata->setVoip(self::processPhoneNumberDescElement($generalDesc, $element, self::VOIP));
|
||||
$metadata->setPersonalNumber(
|
||||
self::processPhoneNumberDescElement($generalDesc, $element, self::PERSONAL_NUMBER)
|
||||
);
|
||||
$metadata->setPager(self::processPhoneNumberDescElement($generalDesc, $element, self::PAGER));
|
||||
$metadata->setUan(self::processPhoneNumberDescElement($generalDesc, $element, self::UAN));
|
||||
$metadata->setEmergency(self::processPhoneNumberDescElement($generalDesc, $element, self::EMERGENCY));
|
||||
$metadata->setVoicemail(self::processPhoneNumberDescElement($generalDesc, $element, self::VOICEMAIL));
|
||||
$metadata->setCarrierSpecific(
|
||||
self::processPhoneNumberDescElement($generalDesc, $element, self::CARRIER_SPECIFIC)
|
||||
);
|
||||
|
||||
|
||||
$metadata->setNoInternationalDialling(
|
||||
self::processPhoneNumberDescElement($generalDesc, $element, self::NO_INTERNATIONAL_DIALLING)
|
||||
);
|
||||
$metadata->setSameMobileAndFixedLinePattern(
|
||||
$metadata->getMobile()->getNationalNumberPattern() === $metadata->getFixedLine()->getNationalNumberPattern()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 general
|
||||
* description will be used to fill in the whole element if necessary, or any components that are
|
||||
* missing. For all other types, the general 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.
|
||||
*
|
||||
* @param PhoneNumberDesc $generalDesc generic phone number description that will be used to fill in missing
|
||||
* parts of the description
|
||||
* @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
|
||||
* @return PhoneNumberDesc complete description of that phone number type
|
||||
*/
|
||||
private static function processPhoneNumberDescElement(
|
||||
PhoneNumberDesc $generalDesc,
|
||||
\DOMElement $countryElement,
|
||||
$numberType
|
||||
) {
|
||||
$phoneNumberDescList = $countryElement->getElementsByTagName($numberType);
|
||||
$numberDesc = new PhoneNumberDesc();
|
||||
if ($phoneNumberDescList->length == 0 && !self::isValidNumberType($numberType)) {
|
||||
$numberDesc->setNationalNumberPattern("NA");
|
||||
$numberDesc->setPossibleNumberPattern("NA");
|
||||
return $numberDesc;
|
||||
}
|
||||
$numberDesc->mergeFrom($generalDesc);
|
||||
if ($phoneNumberDescList->length > 0) {
|
||||
$element = $phoneNumberDescList->item(0);
|
||||
$possiblePattern = $element->getElementsByTagName(self::POSSIBLE_NUMBER_PATTERN);
|
||||
if ($possiblePattern->length > 0) {
|
||||
$numberDesc->setPossibleNumberPattern($possiblePattern->item(0)->firstChild->nodeValue);
|
||||
}
|
||||
|
||||
$validPattern = $element->getElementsByTagName(self::NATIONAL_NUMBER_PATTERN);
|
||||
if ($validPattern->length > 0) {
|
||||
$numberDesc->setNationalNumberPattern($validPattern->item(0)->firstChild->nodeValue);
|
||||
}
|
||||
|
||||
if (!self::$liteBuild) {
|
||||
$exampleNumber = $element->getElementsByTagName(self::EXAMPLE_NUMBER);
|
||||
if ($exampleNumber->length > 0) {
|
||||
$numberDesc->setExampleNumber($exampleNumber->item(0)->firstChild->nodeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $numberDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $numberType
|
||||
* @return bool
|
||||
*/
|
||||
private static function isValidNumberType($numberType)
|
||||
{
|
||||
return $numberType == self::FIXED_LINE || $numberType == self::MOBILE || $numberType == self::GENERAL_DESC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
124
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/BuildMetadataPHPFromXml.php
vendored
Normal file
124
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/BuildMetadataPHPFromXml.php
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
<?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
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools\Commands;
|
||||
|
||||
|
||||
use libphonenumber\buildtools\GeneratePhonePrefixData;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Helper\ProgressHelper;
|
||||
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)
|
||||
{
|
||||
/** @var ProgressHelper $progress */
|
||||
$progress = $this->getHelperSet()->get('progress');
|
||||
$generatePhonePrefixData = new GeneratePhonePrefixData();
|
||||
$generatePhonePrefixData->start(
|
||||
$input->getArgument('InputDirectory'),
|
||||
$input->getArgument('OutputDirectory'),
|
||||
$output,
|
||||
$progress
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?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'));
|
||||
}
|
||||
}
|
406
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/GeneratePhonePrefixData.php
vendored
Normal file
406
vendor/giggsey/libphonenumber-for-php/build/libphonenumber/buildtools/GeneratePhonePrefixData.php
vendored
Normal file
@@ -0,0 +1,406 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber\buildtools;
|
||||
|
||||
use Symfony\Component\Console\Helper\ProgressHelper;
|
||||
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();
|
||||
/**
|
||||
* @var OutputInterface
|
||||
*/
|
||||
private static $consoleOutput;
|
||||
|
||||
public function start($inputDir, $outputDir, OutputInterface $consoleOutput, ProgressHelper $progress)
|
||||
{
|
||||
$this->inputDir = $inputDir;
|
||||
$this->outputDir = $outputDir;
|
||||
self::$consoleOutput = $consoleOutput;
|
||||
|
||||
$inputOutputMappings = $this->createInputOutputMappings();
|
||||
$availableDataFiles = array();
|
||||
|
||||
$progress->start($consoleOutput, count($inputOutputMappings));
|
||||
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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
54
vendor/giggsey/libphonenumber-for-php/composer.json
vendored
Normal file
54
vendor/giggsey/libphonenumber-for-php/composer.json
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "giggsey/libphonenumber-for-php",
|
||||
"type": "library",
|
||||
"description": "PHP Port of Google's libphonenumber",
|
||||
"keywords": ["phonenumber", "libphonenumber", "mobile", "validation", "geocoding", "geolocation"],
|
||||
"homepage": "https://github.com/giggsey/libphonenumber-for-php",
|
||||
"license": "Apache-2.0",
|
||||
"support": {
|
||||
"irc": "irc://irc.appliedirc.com/lobby",
|
||||
"source": "https://github.com/giggsey/libphonenumber-for-php",
|
||||
"issues": "https://github.com/giggsey/libphonenumber-for-php/issues"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Joshua Gigg",
|
||||
"email": "giggsey@gmail.com",
|
||||
"homepage": "http://giggsey.com/"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"libphonenumber": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-0": {
|
||||
"libphonenumber\\buildtools": "build/",
|
||||
"libphonenumber\\Tests": "Tests/"
|
||||
}
|
||||
},
|
||||
"archive": {
|
||||
"exclude": ["Tests/", "build/", "/.travis.yml", "/build.xml", "phpunit.xml.dist", "libphonenumber-for-php.spec"]
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phing/phing": "~2.7",
|
||||
"pear/versioncontrol_git": "dev-master",
|
||||
"pear/pear-core-minimal": "^1.9",
|
||||
"pear/pear_exception": "*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"symfony/console": "~2.4",
|
||||
"satooshi/php-coveralls": "~0.6"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "To use the geocoder and carrier mapping"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "7.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
45
vendor/giggsey/libphonenumber-for-php/libphonenumber-for-php.spec
vendored
Normal file
45
vendor/giggsey/libphonenumber-for-php/libphonenumber-for-php.spec
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# 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
|
29
vendor/giggsey/libphonenumber-for-php/phpunit.xml.dist
vendored
Normal file
29
vendor/giggsey/libphonenumber-for-php/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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>
|
||||
|
59
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/AlternateFormatsCountryCodeSet.php
vendored
Normal file
59
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/AlternateFormatsCountryCodeSet.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
namespace libphonenumber;
|
||||
class AlternateFormatsCountryCodeSet {
|
||||
|
||||
// A set of all country codes for which data is available.
|
||||
|
||||
public static $alternateFormatsCountryCodeSet = array (
|
||||
0 => 7,
|
||||
1 => 27,
|
||||
2 => 30,
|
||||
3 => 31,
|
||||
4 => 34,
|
||||
5 => 36,
|
||||
6 => 43,
|
||||
7 => 44,
|
||||
8 => 49,
|
||||
9 => 54,
|
||||
10 => 55,
|
||||
11 => 58,
|
||||
12 => 61,
|
||||
13 => 62,
|
||||
14 => 63,
|
||||
15 => 66,
|
||||
16 => 81,
|
||||
17 => 84,
|
||||
18 => 90,
|
||||
19 => 91,
|
||||
20 => 94,
|
||||
21 => 95,
|
||||
22 => 255,
|
||||
23 => 350,
|
||||
24 => 351,
|
||||
25 => 352,
|
||||
26 => 358,
|
||||
27 => 359,
|
||||
28 => 372,
|
||||
29 => 373,
|
||||
30 => 380,
|
||||
31 => 381,
|
||||
32 => 385,
|
||||
33 => 505,
|
||||
34 => 506,
|
||||
35 => 595,
|
||||
36 => 675,
|
||||
37 => 676,
|
||||
38 => 679,
|
||||
39 => 855,
|
||||
40 => 971,
|
||||
41 => 972,
|
||||
42 => 995,
|
||||
);
|
||||
|
||||
}
|
14
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/CountryCodeSource.php
vendored
Normal file
14
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/CountryCodeSource.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace libphonenumber;
|
||||
|
||||
/**
|
||||
* Country code source from number
|
||||
*/
|
||||
class CountryCodeSource
|
||||
{
|
||||
const FROM_NUMBER_WITH_PLUS_SIGN = 0;
|
||||
const FROM_NUMBER_WITH_IDD = 1;
|
||||
const FROM_NUMBER_WITHOUT_PLUS_SIGN = 2;
|
||||
const FROM_DEFAULT_COUNTRY = 3;
|
||||
}
|
914
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/CountryCodeToRegionCodeMap.php
vendored
Normal file
914
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/CountryCodeToRegionCodeMap.php
vendored
Normal file
@@ -0,0 +1,914 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
namespace libphonenumber;
|
||||
class CountryCodeToRegionCodeMap {
|
||||
|
||||
// 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.
|
||||
|
||||
public static $countryCodeToRegionCodeMap = array (
|
||||
1 =>
|
||||
array (
|
||||
0 => 'US',
|
||||
1 => 'AG',
|
||||
2 => 'AI',
|
||||
3 => 'AS',
|
||||
4 => 'BB',
|
||||
5 => 'BM',
|
||||
6 => 'BS',
|
||||
7 => 'CA',
|
||||
8 => 'DM',
|
||||
9 => 'DO',
|
||||
10 => 'GD',
|
||||
11 => 'GU',
|
||||
12 => 'JM',
|
||||
13 => 'KN',
|
||||
14 => 'KY',
|
||||
15 => 'LC',
|
||||
16 => 'MP',
|
||||
17 => 'MS',
|
||||
18 => 'PR',
|
||||
19 => 'SX',
|
||||
20 => 'TC',
|
||||
21 => 'TT',
|
||||
22 => 'VC',
|
||||
23 => 'VG',
|
||||
24 => 'VI',
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
0 => 'RU',
|
||||
1 => 'KZ',
|
||||
),
|
||||
20 =>
|
||||
array (
|
||||
0 => 'EG',
|
||||
),
|
||||
27 =>
|
||||
array (
|
||||
0 => 'ZA',
|
||||
),
|
||||
30 =>
|
||||
array (
|
||||
0 => 'GR',
|
||||
),
|
||||
31 =>
|
||||
array (
|
||||
0 => 'NL',
|
||||
),
|
||||
32 =>
|
||||
array (
|
||||
0 => 'BE',
|
||||
),
|
||||
33 =>
|
||||
array (
|
||||
0 => 'FR',
|
||||
),
|
||||
34 =>
|
||||
array (
|
||||
0 => 'ES',
|
||||
),
|
||||
36 =>
|
||||
array (
|
||||
0 => 'HU',
|
||||
),
|
||||
39 =>
|
||||
array (
|
||||
0 => 'IT',
|
||||
1 => 'VA',
|
||||
),
|
||||
40 =>
|
||||
array (
|
||||
0 => 'RO',
|
||||
),
|
||||
41 =>
|
||||
array (
|
||||
0 => 'CH',
|
||||
),
|
||||
43 =>
|
||||
array (
|
||||
0 => 'AT',
|
||||
),
|
||||
44 =>
|
||||
array (
|
||||
0 => 'GB',
|
||||
1 => 'GG',
|
||||
2 => 'IM',
|
||||
3 => 'JE',
|
||||
),
|
||||
45 =>
|
||||
array (
|
||||
0 => 'DK',
|
||||
),
|
||||
46 =>
|
||||
array (
|
||||
0 => 'SE',
|
||||
),
|
||||
47 =>
|
||||
array (
|
||||
0 => 'NO',
|
||||
1 => 'SJ',
|
||||
),
|
||||
48 =>
|
||||
array (
|
||||
0 => 'PL',
|
||||
),
|
||||
49 =>
|
||||
array (
|
||||
0 => 'DE',
|
||||
),
|
||||
51 =>
|
||||
array (
|
||||
0 => 'PE',
|
||||
),
|
||||
52 =>
|
||||
array (
|
||||
0 => 'MX',
|
||||
),
|
||||
53 =>
|
||||
array (
|
||||
0 => 'CU',
|
||||
),
|
||||
54 =>
|
||||
array (
|
||||
0 => 'AR',
|
||||
),
|
||||
55 =>
|
||||
array (
|
||||
0 => 'BR',
|
||||
),
|
||||
56 =>
|
||||
array (
|
||||
0 => 'CL',
|
||||
),
|
||||
57 =>
|
||||
array (
|
||||
0 => 'CO',
|
||||
),
|
||||
58 =>
|
||||
array (
|
||||
0 => 'VE',
|
||||
),
|
||||
60 =>
|
||||
array (
|
||||
0 => 'MY',
|
||||
),
|
||||
61 =>
|
||||
array (
|
||||
0 => 'AU',
|
||||
1 => 'CC',
|
||||
2 => 'CX',
|
||||
),
|
||||
62 =>
|
||||
array (
|
||||
0 => 'ID',
|
||||
),
|
||||
63 =>
|
||||
array (
|
||||
0 => 'PH',
|
||||
),
|
||||
64 =>
|
||||
array (
|
||||
0 => 'NZ',
|
||||
),
|
||||
65 =>
|
||||
array (
|
||||
0 => 'SG',
|
||||
),
|
||||
66 =>
|
||||
array (
|
||||
0 => 'TH',
|
||||
),
|
||||
81 =>
|
||||
array (
|
||||
0 => 'JP',
|
||||
),
|
||||
82 =>
|
||||
array (
|
||||
0 => 'KR',
|
||||
),
|
||||
84 =>
|
||||
array (
|
||||
0 => 'VN',
|
||||
),
|
||||
86 =>
|
||||
array (
|
||||
0 => 'CN',
|
||||
),
|
||||
90 =>
|
||||
array (
|
||||
0 => 'TR',
|
||||
),
|
||||
91 =>
|
||||
array (
|
||||
0 => 'IN',
|
||||
),
|
||||
92 =>
|
||||
array (
|
||||
0 => 'PK',
|
||||
),
|
||||
93 =>
|
||||
array (
|
||||
0 => 'AF',
|
||||
),
|
||||
94 =>
|
||||
array (
|
||||
0 => 'LK',
|
||||
),
|
||||
95 =>
|
||||
array (
|
||||
0 => 'MM',
|
||||
),
|
||||
98 =>
|
||||
array (
|
||||
0 => 'IR',
|
||||
),
|
||||
211 =>
|
||||
array (
|
||||
0 => 'SS',
|
||||
),
|
||||
212 =>
|
||||
array (
|
||||
0 => 'MA',
|
||||
1 => 'EH',
|
||||
),
|
||||
213 =>
|
||||
array (
|
||||
0 => 'DZ',
|
||||
),
|
||||
216 =>
|
||||
array (
|
||||
0 => 'TN',
|
||||
),
|
||||
218 =>
|
||||
array (
|
||||
0 => 'LY',
|
||||
),
|
||||
220 =>
|
||||
array (
|
||||
0 => 'GM',
|
||||
),
|
||||
221 =>
|
||||
array (
|
||||
0 => 'SN',
|
||||
),
|
||||
222 =>
|
||||
array (
|
||||
0 => 'MR',
|
||||
),
|
||||
223 =>
|
||||
array (
|
||||
0 => 'ML',
|
||||
),
|
||||
224 =>
|
||||
array (
|
||||
0 => 'GN',
|
||||
),
|
||||
225 =>
|
||||
array (
|
||||
0 => 'CI',
|
||||
),
|
||||
226 =>
|
||||
array (
|
||||
0 => 'BF',
|
||||
),
|
||||
227 =>
|
||||
array (
|
||||
0 => 'NE',
|
||||
),
|
||||
228 =>
|
||||
array (
|
||||
0 => 'TG',
|
||||
),
|
||||
229 =>
|
||||
array (
|
||||
0 => 'BJ',
|
||||
),
|
||||
230 =>
|
||||
array (
|
||||
0 => 'MU',
|
||||
),
|
||||
231 =>
|
||||
array (
|
||||
0 => 'LR',
|
||||
),
|
||||
232 =>
|
||||
array (
|
||||
0 => 'SL',
|
||||
),
|
||||
233 =>
|
||||
array (
|
||||
0 => 'GH',
|
||||
),
|
||||
234 =>
|
||||
array (
|
||||
0 => 'NG',
|
||||
),
|
||||
235 =>
|
||||
array (
|
||||
0 => 'TD',
|
||||
),
|
||||
236 =>
|
||||
array (
|
||||
0 => 'CF',
|
||||
),
|
||||
237 =>
|
||||
array (
|
||||
0 => 'CM',
|
||||
),
|
||||
238 =>
|
||||
array (
|
||||
0 => 'CV',
|
||||
),
|
||||
239 =>
|
||||
array (
|
||||
0 => 'ST',
|
||||
),
|
||||
240 =>
|
||||
array (
|
||||
0 => 'GQ',
|
||||
),
|
||||
241 =>
|
||||
array (
|
||||
0 => 'GA',
|
||||
),
|
||||
242 =>
|
||||
array (
|
||||
0 => 'CG',
|
||||
),
|
||||
243 =>
|
||||
array (
|
||||
0 => 'CD',
|
||||
),
|
||||
244 =>
|
||||
array (
|
||||
0 => 'AO',
|
||||
),
|
||||
245 =>
|
||||
array (
|
||||
0 => 'GW',
|
||||
),
|
||||
246 =>
|
||||
array (
|
||||
0 => 'IO',
|
||||
),
|
||||
247 =>
|
||||
array (
|
||||
0 => 'AC',
|
||||
),
|
||||
248 =>
|
||||
array (
|
||||
0 => 'SC',
|
||||
),
|
||||
249 =>
|
||||
array (
|
||||
0 => 'SD',
|
||||
),
|
||||
250 =>
|
||||
array (
|
||||
0 => 'RW',
|
||||
),
|
||||
251 =>
|
||||
array (
|
||||
0 => 'ET',
|
||||
),
|
||||
252 =>
|
||||
array (
|
||||
0 => 'SO',
|
||||
),
|
||||
253 =>
|
||||
array (
|
||||
0 => 'DJ',
|
||||
),
|
||||
254 =>
|
||||
array (
|
||||
0 => 'KE',
|
||||
),
|
||||
255 =>
|
||||
array (
|
||||
0 => 'TZ',
|
||||
),
|
||||
256 =>
|
||||
array (
|
||||
0 => 'UG',
|
||||
),
|
||||
257 =>
|
||||
array (
|
||||
0 => 'BI',
|
||||
),
|
||||
258 =>
|
||||
array (
|
||||
0 => 'MZ',
|
||||
),
|
||||
260 =>
|
||||
array (
|
||||
0 => 'ZM',
|
||||
),
|
||||
261 =>
|
||||
array (
|
||||
0 => 'MG',
|
||||
),
|
||||
262 =>
|
||||
array (
|
||||
0 => 'RE',
|
||||
1 => 'YT',
|
||||
),
|
||||
263 =>
|
||||
array (
|
||||
0 => 'ZW',
|
||||
),
|
||||
264 =>
|
||||
array (
|
||||
0 => 'NA',
|
||||
),
|
||||
265 =>
|
||||
array (
|
||||
0 => 'MW',
|
||||
),
|
||||
266 =>
|
||||
array (
|
||||
0 => 'LS',
|
||||
),
|
||||
267 =>
|
||||
array (
|
||||
0 => 'BW',
|
||||
),
|
||||
268 =>
|
||||
array (
|
||||
0 => 'SZ',
|
||||
),
|
||||
269 =>
|
||||
array (
|
||||
0 => 'KM',
|
||||
),
|
||||
290 =>
|
||||
array (
|
||||
0 => 'SH',
|
||||
1 => 'TA',
|
||||
),
|
||||
291 =>
|
||||
array (
|
||||
0 => 'ER',
|
||||
),
|
||||
297 =>
|
||||
array (
|
||||
0 => 'AW',
|
||||
),
|
||||
298 =>
|
||||
array (
|
||||
0 => 'FO',
|
||||
),
|
||||
299 =>
|
||||
array (
|
||||
0 => 'GL',
|
||||
),
|
||||
350 =>
|
||||
array (
|
||||
0 => 'GI',
|
||||
),
|
||||
351 =>
|
||||
array (
|
||||
0 => 'PT',
|
||||
),
|
||||
352 =>
|
||||
array (
|
||||
0 => 'LU',
|
||||
),
|
||||
353 =>
|
||||
array (
|
||||
0 => 'IE',
|
||||
),
|
||||
354 =>
|
||||
array (
|
||||
0 => 'IS',
|
||||
),
|
||||
355 =>
|
||||
array (
|
||||
0 => 'AL',
|
||||
),
|
||||
356 =>
|
||||
array (
|
||||
0 => 'MT',
|
||||
),
|
||||
357 =>
|
||||
array (
|
||||
0 => 'CY',
|
||||
),
|
||||
358 =>
|
||||
array (
|
||||
0 => 'FI',
|
||||
1 => 'AX',
|
||||
),
|
||||
359 =>
|
||||
array (
|
||||
0 => 'BG',
|
||||
),
|
||||
370 =>
|
||||
array (
|
||||
0 => 'LT',
|
||||
),
|
||||
371 =>
|
||||
array (
|
||||
0 => 'LV',
|
||||
),
|
||||
372 =>
|
||||
array (
|
||||
0 => 'EE',
|
||||
),
|
||||
373 =>
|
||||
array (
|
||||
0 => 'MD',
|
||||
),
|
||||
374 =>
|
||||
array (
|
||||
0 => 'AM',
|
||||
),
|
||||
375 =>
|
||||
array (
|
||||
0 => 'BY',
|
||||
),
|
||||
376 =>
|
||||
array (
|
||||
0 => 'AD',
|
||||
),
|
||||
377 =>
|
||||
array (
|
||||
0 => 'MC',
|
||||
),
|
||||
378 =>
|
||||
array (
|
||||
0 => 'SM',
|
||||
),
|
||||
380 =>
|
||||
array (
|
||||
0 => 'UA',
|
||||
),
|
||||
381 =>
|
||||
array (
|
||||
0 => 'RS',
|
||||
),
|
||||
382 =>
|
||||
array (
|
||||
0 => 'ME',
|
||||
),
|
||||
385 =>
|
||||
array (
|
||||
0 => 'HR',
|
||||
),
|
||||
386 =>
|
||||
array (
|
||||
0 => 'SI',
|
||||
),
|
||||
387 =>
|
||||
array (
|
||||
0 => 'BA',
|
||||
),
|
||||
389 =>
|
||||
array (
|
||||
0 => 'MK',
|
||||
),
|
||||
420 =>
|
||||
array (
|
||||
0 => 'CZ',
|
||||
),
|
||||
421 =>
|
||||
array (
|
||||
0 => 'SK',
|
||||
),
|
||||
423 =>
|
||||
array (
|
||||
0 => 'LI',
|
||||
),
|
||||
500 =>
|
||||
array (
|
||||
0 => 'FK',
|
||||
),
|
||||
501 =>
|
||||
array (
|
||||
0 => 'BZ',
|
||||
),
|
||||
502 =>
|
||||
array (
|
||||
0 => 'GT',
|
||||
),
|
||||
503 =>
|
||||
array (
|
||||
0 => 'SV',
|
||||
),
|
||||
504 =>
|
||||
array (
|
||||
0 => 'HN',
|
||||
),
|
||||
505 =>
|
||||
array (
|
||||
0 => 'NI',
|
||||
),
|
||||
506 =>
|
||||
array (
|
||||
0 => 'CR',
|
||||
),
|
||||
507 =>
|
||||
array (
|
||||
0 => 'PA',
|
||||
),
|
||||
508 =>
|
||||
array (
|
||||
0 => 'PM',
|
||||
),
|
||||
509 =>
|
||||
array (
|
||||
0 => 'HT',
|
||||
),
|
||||
590 =>
|
||||
array (
|
||||
0 => 'GP',
|
||||
1 => 'BL',
|
||||
2 => 'MF',
|
||||
),
|
||||
591 =>
|
||||
array (
|
||||
0 => 'BO',
|
||||
),
|
||||
592 =>
|
||||
array (
|
||||
0 => 'GY',
|
||||
),
|
||||
593 =>
|
||||
array (
|
||||
0 => 'EC',
|
||||
),
|
||||
594 =>
|
||||
array (
|
||||
0 => 'GF',
|
||||
),
|
||||
595 =>
|
||||
array (
|
||||
0 => 'PY',
|
||||
),
|
||||
596 =>
|
||||
array (
|
||||
0 => 'MQ',
|
||||
),
|
||||
597 =>
|
||||
array (
|
||||
0 => 'SR',
|
||||
),
|
||||
598 =>
|
||||
array (
|
||||
0 => 'UY',
|
||||
),
|
||||
599 =>
|
||||
array (
|
||||
0 => 'CW',
|
||||
1 => 'BQ',
|
||||
),
|
||||
670 =>
|
||||
array (
|
||||
0 => 'TL',
|
||||
),
|
||||
672 =>
|
||||
array (
|
||||
0 => 'NF',
|
||||
),
|
||||
673 =>
|
||||
array (
|
||||
0 => 'BN',
|
||||
),
|
||||
674 =>
|
||||
array (
|
||||
0 => 'NR',
|
||||
),
|
||||
675 =>
|
||||
array (
|
||||
0 => 'PG',
|
||||
),
|
||||
676 =>
|
||||
array (
|
||||
0 => 'TO',
|
||||
),
|
||||
677 =>
|
||||
array (
|
||||
0 => 'SB',
|
||||
),
|
||||
678 =>
|
||||
array (
|
||||
0 => 'VU',
|
||||
),
|
||||
679 =>
|
||||
array (
|
||||
0 => 'FJ',
|
||||
),
|
||||
680 =>
|
||||
array (
|
||||
0 => 'PW',
|
||||
),
|
||||
681 =>
|
||||
array (
|
||||
0 => 'WF',
|
||||
),
|
||||
682 =>
|
||||
array (
|
||||
0 => 'CK',
|
||||
),
|
||||
683 =>
|
||||
array (
|
||||
0 => 'NU',
|
||||
),
|
||||
685 =>
|
||||
array (
|
||||
0 => 'WS',
|
||||
),
|
||||
686 =>
|
||||
array (
|
||||
0 => 'KI',
|
||||
),
|
||||
687 =>
|
||||
array (
|
||||
0 => 'NC',
|
||||
),
|
||||
688 =>
|
||||
array (
|
||||
0 => 'TV',
|
||||
),
|
||||
689 =>
|
||||
array (
|
||||
0 => 'PF',
|
||||
),
|
||||
690 =>
|
||||
array (
|
||||
0 => 'TK',
|
||||
),
|
||||
691 =>
|
||||
array (
|
||||
0 => 'FM',
|
||||
),
|
||||
692 =>
|
||||
array (
|
||||
0 => 'MH',
|
||||
),
|
||||
800 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
808 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
850 =>
|
||||
array (
|
||||
0 => 'KP',
|
||||
),
|
||||
852 =>
|
||||
array (
|
||||
0 => 'HK',
|
||||
),
|
||||
853 =>
|
||||
array (
|
||||
0 => 'MO',
|
||||
),
|
||||
855 =>
|
||||
array (
|
||||
0 => 'KH',
|
||||
),
|
||||
856 =>
|
||||
array (
|
||||
0 => 'LA',
|
||||
),
|
||||
870 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
878 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
880 =>
|
||||
array (
|
||||
0 => 'BD',
|
||||
),
|
||||
881 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
882 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
883 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
886 =>
|
||||
array (
|
||||
0 => 'TW',
|
||||
),
|
||||
888 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
960 =>
|
||||
array (
|
||||
0 => 'MV',
|
||||
),
|
||||
961 =>
|
||||
array (
|
||||
0 => 'LB',
|
||||
),
|
||||
962 =>
|
||||
array (
|
||||
0 => 'JO',
|
||||
),
|
||||
963 =>
|
||||
array (
|
||||
0 => 'SY',
|
||||
),
|
||||
964 =>
|
||||
array (
|
||||
0 => 'IQ',
|
||||
),
|
||||
965 =>
|
||||
array (
|
||||
0 => 'KW',
|
||||
),
|
||||
966 =>
|
||||
array (
|
||||
0 => 'SA',
|
||||
),
|
||||
967 =>
|
||||
array (
|
||||
0 => 'YE',
|
||||
),
|
||||
968 =>
|
||||
array (
|
||||
0 => 'OM',
|
||||
),
|
||||
970 =>
|
||||
array (
|
||||
0 => 'PS',
|
||||
),
|
||||
971 =>
|
||||
array (
|
||||
0 => 'AE',
|
||||
),
|
||||
972 =>
|
||||
array (
|
||||
0 => 'IL',
|
||||
),
|
||||
973 =>
|
||||
array (
|
||||
0 => 'BH',
|
||||
),
|
||||
974 =>
|
||||
array (
|
||||
0 => 'QA',
|
||||
),
|
||||
975 =>
|
||||
array (
|
||||
0 => 'BT',
|
||||
),
|
||||
976 =>
|
||||
array (
|
||||
0 => 'MN',
|
||||
),
|
||||
977 =>
|
||||
array (
|
||||
0 => 'NP',
|
||||
),
|
||||
979 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
992 =>
|
||||
array (
|
||||
0 => 'TJ',
|
||||
),
|
||||
993 =>
|
||||
array (
|
||||
0 => 'TM',
|
||||
),
|
||||
994 =>
|
||||
array (
|
||||
0 => 'AZ',
|
||||
),
|
||||
995 =>
|
||||
array (
|
||||
0 => 'GE',
|
||||
),
|
||||
996 =>
|
||||
array (
|
||||
0 => 'KG',
|
||||
),
|
||||
998 =>
|
||||
array (
|
||||
0 => 'UZ',
|
||||
),
|
||||
);
|
||||
|
||||
}
|
122
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/CountryCodeToRegionCodeMapForTesting.php
vendored
Normal file
122
vendor/giggsey/libphonenumber-for-php/src/libphonenumber/CountryCodeToRegionCodeMapForTesting.php
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
|
||||
* Please don't modify it directly.
|
||||
*/
|
||||
|
||||
|
||||
namespace libphonenumber;
|
||||
class CountryCodeToRegionCodeMapForTesting {
|
||||
|
||||
// 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.
|
||||
|
||||
public static $countryCodeToRegionCodeMapForTesting = array (
|
||||
1 =>
|
||||
array (
|
||||
0 => 'US',
|
||||
1 => 'BB',
|
||||
2 => 'BS',
|
||||
3 => 'CA',
|
||||
),
|
||||
33 =>
|
||||
array (
|
||||
0 => 'FR',
|
||||
),
|
||||
36 =>
|
||||
array (
|
||||
0 => 'HU',
|
||||
),
|
||||
39 =>
|
||||
array (
|
||||
0 => 'IT',
|
||||
),
|
||||
44 =>
|
||||
array (
|
||||
0 => 'GB',
|
||||
1 => 'GG',
|
||||
),
|
||||
46 =>
|
||||
array (
|
||||
0 => 'SE',
|
||||
),
|
||||
48 =>
|
||||
array (
|
||||
0 => 'PL',
|
||||
),
|
||||
49 =>
|
||||
array (
|
||||
0 => 'DE',
|
||||
),
|
||||
52 =>
|
||||
array (
|
||||
0 => 'MX',
|
||||
),
|
||||
54 =>
|
||||
array (
|
||||
0 => 'AR',
|
||||
),
|
||||
55 =>
|
||||
array (
|
||||
0 => 'BR',
|
||||
),
|
||||
61 =>
|
||||
array (
|
||||
0 => 'AU',
|
||||
1 => 'CC',
|
||||
2 => 'CX',
|
||||
),
|
||||
64 =>
|
||||
array (
|
||||
0 => 'NZ',
|
||||
),
|
||||
65 =>
|
||||
array (
|
||||
0 => 'SG',
|
||||
),
|
||||
81 =>
|
||||
array (
|
||||
0 => 'JP',
|
||||
),
|
||||
82 =>
|
||||
array (
|
||||
0 => 'KR',
|
||||
),
|
||||
86 =>
|
||||
array (
|
||||
0 => 'CN',
|
||||
),
|
||||
244 =>
|
||||
array (
|
||||
0 => 'AO',
|
||||
),
|
||||
262 =>
|
||||
array (
|
||||
0 => 'RE',
|
||||
1 => 'YT',
|
||||
),
|
||||
375 =>
|
||||
array (
|
||||
0 => 'BY',
|
||||
),
|
||||
376 =>
|
||||
array (
|
||||
0 => 'AD',
|
||||
),
|
||||
800 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
971 =>
|
||||
array (
|
||||
0 => 'AE',
|
||||
),
|
||||
979 =>
|
||||
array (
|
||||
0 => '001',
|
||||
),
|
||||
);
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user