update for version 1.0.1

This commit is contained in:
sujitprasad
2015-10-23 14:15:29 +05:30
parent 82b878e93b
commit 3d425dc380
8348 changed files with 10020 additions and 4171 deletions

View 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,
);
}

View 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;
}

View 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',
),
);
}

View 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',
),
);
}

View File

@@ -0,0 +1,12 @@
<?php
namespace libphonenumber;
class DefaultMetadataLoader implements MetadataLoaderInterface
{
public function loadMetadata($metadataFileName)
{
return include $metadataFileName;
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace libphonenumber;
/**
* Types of phone number matches
* See detailed description beside the isNumberMatch() method
*/
class MatchType
{
const NOT_A_NUMBER = 0;
const NO_MATCH = 1;
const SHORT_NSN_MATCH = 2;
const NSN_MATCH = 3;
const EXACT_MATCH = 4;
}

View File

@@ -0,0 +1,161 @@
<?php
namespace libphonenumber;
/**
* Matcher for various regex matching
*
* Note that this is NOT the same as google's java PhoneNumberMatcher class.
* This class is a minimal port of java's built-in matcher class, whereas PhoneNumberMatcher
* is designed to recognize phone numbers embedded in any text.
*/
class Matcher
{
/**
* @var string
*/
private $pattern;
/**
* @var string
*/
private $subject;
/**
* @var array
*/
private $groups = array();
/**
* @param string $pattern
* @param string $subject
*/
public function __construct($pattern, $subject)
{
$this->pattern = str_replace('/', '\/', $pattern);
$this->subject = $subject;
}
private function doMatch($type = 'find')
{
$final_pattern = '(?:' . $this->pattern . ')';
switch ($type) {
case 'matches':
$final_pattern = '^' . $final_pattern . '$';
break;
case 'lookingAt':
$final_pattern = '^' . $final_pattern;
break;
case 'find':
default:
// no changes
break;
}
$final_pattern = '/' . $final_pattern . '/x';
return (preg_match($final_pattern, $this->subject, $this->groups, PREG_OFFSET_CAPTURE) == 1) ? true : false;
}
/**
* @return bool
*/
public function matches()
{
return $this->doMatch('matches');
}
/**
* @return bool
*/
public function lookingAt()
{
return $this->doMatch('lookingAt');
}
/**
* @return bool
*/
public function find()
{
return $this->doMatch('find');
}
/**
* @return int
*/
public function groupCount()
{
if (empty($this->groups)) {
return null;
} else {
return count($this->groups) - 1;
}
}
/**
* @param int $group
* @return string
*/
public function group($group = null)
{
if (!isset($group)) {
$group = 0;
}
return (isset($this->groups[$group][0])) ? $this->groups[$group][0] : null;
}
/**
* @param int|null $group
* @return int
*/
public function end($group = null)
{
if (!isset($group) || $group === null) {
$group = 0;
}
if (!isset($this->groups[$group])) {
return null;
}
return $this->groups[$group][1] + strlen($this->groups[$group][0]);
}
public function start($group = null)
{
if (isset($group) || $group === null) {
$group = 0;
}
if (!isset($this->groups[$group])) {
return null;
}
return $this->groups[$group][1];
}
/**
* @param string $replacement
* @return string
*/
public function replaceFirst($replacement)
{
return preg_replace('/' . $this->pattern . '/x', $replacement, $this->subject, 1);
}
/**
* @param string $replacement
* @return string
*/
public function replaceAll($replacement)
{
return preg_replace('/' . $this->pattern . '/x', $replacement, $this->subject);
}
/**
* @param string $input
* @return Matcher
*/
public function reset($input = "")
{
$this->subject = $input;
return $this;
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace libphonenumber;
/**
* Interface MatcherAPIInterface
*
* Internal phonenumber matching API used to isolate the underlying implementation of the
* matcher and allow different implementations to be swapped in easily.
*
* @package libphonenumber
*/
interface MatcherAPIInterface
{
/**
* Returns whether the given national number (a string containing only decimal digits) matches
* the national number pattern defined in the given {@code PhoneNumberDesc} message.
*
* @param string $nationalNumber
* @param PhoneNumberDesc $numberDesc
* @param boolean $allowPrefixMatch
* @return boolean
*/
public function matchesNationalNumber($nationalNumber, PhoneNumberDesc $numberDesc, $allowPrefixMatch);
/**
* Returns whether the given national number (a string containing only decimal digits) matches
* the possible number pattern defined in the given {@code PhoneNumberDesc} message.
*
* @param string $nationalNumber
* @param PhoneNumberDesc $numberDesc
* @return boolean
*/
public function matchesPossibleNumber($nationalNumber, PhoneNumberDesc $numberDesc);
}

View File

@@ -0,0 +1,13 @@
<?php
namespace libphonenumber;
interface MetadataLoaderInterface
{
/**
* @param string $metadataFileName File name (including path) of metadata to load.
* @return mixed
*/
public function loadMetadata($metadataFileName);
}

View File

@@ -0,0 +1,21 @@
<?php
namespace libphonenumber;
interface MetadataSourceInterface
{
/**
* Gets phone metadata for a region.
* @param string $regionCode the region code.
* @return PhoneMetadata the phone metadata for that region, or null if there is none.
*/
public function getMetadataForRegion($regionCode);
/**
* Gets phone metadata for a non-geographical region.
* @param int $countryCallingCode the country calling code.
* @return PhoneMetadata the phone metadata for that region, or null if there is none.
*/
public function getMetadataForNonGeographicalRegion($countryCallingCode);
}

View File

@@ -0,0 +1,109 @@
<?php
/**
*
*
* @author joshuag
* @created: 04/08/2015 09:03
* @project libphonenumber-for-php
*/
namespace libphonenumber;
class MultiFileMetadataSourceImpl implements MetadataSourceInterface
{
private static $metaDataFilePrefix = PhoneNumberUtil::META_DATA_FILE_PREFIX;
/**
* A mapping from a region code to the PhoneMetadata for that region.
* @var PhoneMetadata[]
*/
private $regionToMetadataMap = array();
/**
* A mapping from a country calling code for a non-geographical entity to the PhoneMetadata for
* that country calling code. Examples of the country calling codes include 800 (International
* Toll Free Service) and 808 (International Shared Cost Service).
* @var PhoneMetadata[]
*/
private $countryCodeToNonGeographicalMetadataMap = array();
/**
* The prefix of the metadata files from which region data is loaded.
* @var String
*/
private $currentFilePrefix;
/**
* The metadata loader used to inject alternative metadata sources.
* @var MetadataLoaderInterface
*/
private $metadataLoader;
/**
* @param MetadataLoaderInterface $metadataLoader
* @param string|null $currentFilePrefix
*/
public function __construct(MetadataLoaderInterface $metadataLoader, $currentFilePrefix = null)
{
if ($currentFilePrefix === null) {
$currentFilePrefix = self::$metaDataFilePrefix;
}
$this->currentFilePrefix = $currentFilePrefix;
$this->metadataLoader = $metadataLoader;
}
/**
* @inheritdoc
*/
public function getMetadataForRegion($regionCode)
{
if (!array_key_exists($regionCode, $this->regionToMetadataMap)) {
// The regionCode here will be valid and won't be '001', so we don't need to worry about
// what to pass in for the country calling code.
$this->loadMetadataFromFile($this->currentFilePrefix, $regionCode, 0, $this->metadataLoader);
}
return $this->regionToMetadataMap[$regionCode];
}
/**
* @inheritdoc
*/
public function getMetadataForNonGeographicalRegion($countryCallingCode)
{
if (!array_key_exists($countryCallingCode, $this->countryCodeToNonGeographicalMetadataMap)) {
$this->loadMetadataFromFile($this->currentFilePrefix, PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY, $countryCallingCode, $this->metadataLoader);
}
return $this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode];
}
/**
* @param string $filePrefix
* @param string $regionCode
* @param int $countryCallingCode
* @param MetadataLoaderInterface $metadataLoader
* @throws \RuntimeException
*/
public function loadMetadataFromFile($filePrefix, $regionCode, $countryCallingCode, MetadataLoaderInterface $metadataLoader)
{
$isNonGeoRegion = PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY === $regionCode;
$fileName = $filePrefix . '_' . ($isNonGeoRegion ? $countryCallingCode : $regionCode) . '.php';
if (!is_readable($fileName)) {
throw new \RuntimeException('missing metadata: ' . $fileName);
} else {
$data = $metadataLoader->loadMetadata($fileName);
$metadata = new PhoneMetadata();
$metadata->fromArray($data);
if ($isNonGeoRegion) {
$this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode] = $metadata;
} else {
$this->regionToMetadataMap[$regionCode] = $metadata;
}
}
}
}

View File

@@ -0,0 +1,234 @@
<?php
namespace libphonenumber;
/**
* Number Format
*/
class NumberFormat
{
private $pattern = null;
private $format = null;
private $leadingDigitsPattern = array();
private $nationalPrefixFormattingRule = null;
private $domesticCarrierCodeFormattingRule = null;
/**
* @return boolean
*/
public function hasPattern()
{
return isset($this->pattern);
}
/**
* @return string
*/
public function getPattern()
{
return $this->pattern;
}
/**
* @param string $value
* @return NumberFormat
*/
public function setPattern($value)
{
$this->pattern = $value;
return $this;
}
/**
* @return boolean
*/
public function hasFormat()
{
return isset($this->format);
}
/**
* @return string
*/
public function getFormat()
{
return $this->format;
}
/**
* @param string $value
* @return NumberFormat
*/
public function setFormat($value)
{
$this->format = $value;
return $this;
}
/**
* @return string
*/
public function leadingDigitPatterns()
{
return $this->leadingDigitsPattern;
}
/**
* @return int
*/
public function leadingDigitsPatternSize()
{
return count($this->leadingDigitsPattern);
}
/**
* @param int $index
* @return string
*/
public function getLeadingDigitsPattern($index)
{
return $this->leadingDigitsPattern[$index];
}
/**
* @param string $value
* @return NumberFormat
*/
public function addLeadingDigitsPattern($value)
{
$this->leadingDigitsPattern[] = $value;
return $this;
}
/**
* @return boolean
*/
public function hasNationalPrefixFormattingRule()
{
return isset($this->nationalPrefixFormattingRule);
}
/**
* @return string
*/
public function getNationalPrefixFormattingRule()
{
return $this->nationalPrefixFormattingRule;
}
/**
* @param string $value
* @return NumberFormat
*/
public function setNationalPrefixFormattingRule($value)
{
$this->nationalPrefixFormattingRule = $value;
return $this;
}
/**
* @return NumberFormat
*/
public function clearNationalPrefixFormattingRule()
{
$this->nationalPrefixFormattingRule = null;
return $this;
}
/**
* @return boolean
*/
public function hasDomesticCarrierCodeFormattingRule()
{
return isset($this->domesticCarrierCodeFormattingRule);
}
/**
* @return string
*/
public function getDomesticCarrierCodeFormattingRule()
{
return $this->domesticCarrierCodeFormattingRule;
}
/**
* @param string $value
* @return NumberFormat
*/
public function setDomesticCarrierCodeFormattingRule($value)
{
$this->domesticCarrierCodeFormattingRule = $value;
return $this;
}
/**
* @param NumberFormat $other
* @return NumberFormat
*/
public function mergeFrom(NumberFormat $other)
{
if ($other->hasPattern()) {
$this->setPattern($other->getPattern());
}
if ($other->hasFormat()) {
$this->setFormat($other->getFormat());
}
$leadingDigitsPatternSize = $other->leadingDigitsPatternSize();
for ($i = 0; $i < $leadingDigitsPatternSize; $i++) {
$this->addLeadingDigitsPattern($other->getLeadingDigitsPattern($i));
}
if ($other->hasNationalPrefixFormattingRule()) {
$this->setNationalPrefixFormattingRule($other->getNationalPrefixFormattingRule());
}
if ($other->hasDomesticCarrierCodeFormattingRule()) {
$this->setDomesticCarrierCodeFormattingRule($other->getDomesticCarrierCodeFormattingRule());
}
return $this;
}
/**
* @return array
*/
public function toArray()
{
$output = array();
$output['pattern'] = $this->getPattern();
$output['format'] = $this->getFormat();
$output['leadingDigitsPatterns'] = $this->leadingDigitPatterns();
if ($this->hasNationalPrefixFormattingRule()) {
$output['nationalPrefixFormattingRule'] = $this->getNationalPrefixFormattingRule();
}
if ($this->hasDomesticCarrierCodeFormattingRule()) {
$output['domesticCarrierCodeFormattingRule'] = $this->getDomesticCarrierCodeFormattingRule();
}
return $output;
}
/**
* @param array $input
*/
public function fromArray(array $input)
{
$this->setPattern($input['pattern']);
$this->setFormat($input['format']);
foreach ($input['leadingDigitsPatterns'] as $leadingDigitsPattern) {
$this->addLeadingDigitsPattern($leadingDigitsPattern);
}
if (isset($input['nationalPrefixFormattingRule'])) {
$this->setNationalPrefixFormattingRule($input['nationalPrefixFormattingRule']);
}
if (isset($input['domesticCarrierCodeFormattingRule'])) {
$this->setDomesticCarrierCodeFormattingRule($input['domesticCarrierCodeFormattingRule']);
}
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace libphonenumber;
/**
* Generic exception class for errors encountered when parsing phone numbers.
* @author Lara Rennie
*/
class NumberParseException extends \Exception
{
const INVALID_COUNTRY_CODE = 0;
// This generally indicates the string passed in had less than 3 digits in it. More
// specifically, the number failed to match the regular expression VALID_PHONE_NUMBER in
// PhoneNumberUtil.
const NOT_A_NUMBER = 1;
// This indicates the string started with an international dialing prefix, but after this was
// stripped from the number, had less digits than any valid phone number (including country
// code) could have.
const TOO_SHORT_AFTER_IDD = 2;
// This indicates the string, after any country code has been stripped, had less digits than any
// valid phone number could have.
const TOO_SHORT_NSN = 3;
// This indicates the string had more digits than any valid phone number could have.
const TOO_LONG = 4;
private $errorType;
public function __construct($errorType, $message, $previous = null)
{
parent::__construct($message, $errorType, $previous);
$this->message = $message;
$this->errorType = $errorType;
}
/**
* Returns the error type of the exception that has been thrown.
*/
public function getErrorType()
{
return $this->errorType;
}
public function __toString()
{
return "Error type: " . $this->errorType . ". " . $this->message;
}
}

View File

@@ -0,0 +1,937 @@
<?php
namespace libphonenumber;
class PhoneMetadata
{
/**
* @var string
*/
private $id = null;
/**
* @return boolean
*/
public function hasId()
{
return isset($this->id);
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* @param string $value
* @return PhoneMetadata
*/
public function setId($value)
{
$this->id = $value;
return $this;
}
/**
* @var int
*/
private $countryCode = null;
/**
* @return boolean
*/
public function hasCountryCode()
{
return isset($this->countryCode);
}
/**
* @return int
*/
public function getCountryCode()
{
return $this->countryCode;
}
/**
* @param int $value
* @return PhoneMetadata
*/
public function setCountryCode($value)
{
$this->countryCode = $value;
return $this;
}
private $leadingDigits = null;
/**
* @return bool
*/
public function hasLeadingDigits()
{
return isset($this->leadingDigits);
}
public function getLeadingDigits()
{
return $this->leadingDigits;
}
public function setLeadingDigits($value)
{
$this->leadingDigits = $value;
return $this;
}
private $internationalPrefix = null;
public function hasInternationalPrefix()
{
return isset($this->internationalPrefix);
}
public function getInternationalPrefix()
{
return $this->internationalPrefix;
}
public function setInternationalPrefix($value)
{
$this->internationalPrefix = $value;
return $this;
}
private $preferredInternationalPrefix = null;
public function hasPreferredInternationalPrefix()
{
return isset($this->preferredInternationalPrefix);
}
public function getPreferredInternationalPrefix()
{
return $this->preferredInternationalPrefix;
}
public function setPreferredInternationalPrefix($value)
{
$this->preferredInternationalPrefix = $value;
return $this;
}
private $nationalPrefixForParsing = null;
public function hasNationalPrefixForParsing()
{
return isset($this->nationalPrefixForParsing);
}
public function getNationalPrefixForParsing()
{
return $this->nationalPrefixForParsing;
}
public function setNationalPrefixForParsing($value)
{
$this->nationalPrefixForParsing = $value;
return $this;
}
private $nationalPrefixTransformRule = null;
public function hasNationalPrefixTransformRule()
{
return isset($this->nationalPrefixTransformRule);
}
public function getNationalPrefixTransformRule()
{
return $this->nationalPrefixTransformRule;
}
public function setNationalPrefixTransformRule($value)
{
$this->nationalPrefixTransformRule = $value;
return $this;
}
private $nationalPrefix = null;
public function hasNationalPrefix()
{
return isset($this->nationalPrefix);
}
public function getNationalPrefix()
{
return $this->nationalPrefix;
}
public function setNationalPrefix($value)
{
$this->nationalPrefix = $value;
return $this;
}
private $preferredExtnPrefix = null;
public function hasPreferredExtnPrefix()
{
return isset($this->preferredExtnPrefix);
}
public function getPreferredExtnPrefix()
{
return $this->preferredExtnPrefix;
}
public function setPreferredExtnPrefix($value)
{
$this->preferredExtnPrefix = $value;
return $this;
}
private $mainCountryForCode = false;
public function hasMainCountryForCode()
{
return isset($this->mainCountryForCode);
}
public function isMainCountryForCode()
{
return $this->mainCountryForCode;
}
public function getMainCountryForCode()
{
return $this->mainCountryForCode;
}
public function setMainCountryForCode($value)
{
$this->mainCountryForCode = $value;
return $this;
}
private $leadingZeroPossible = false;
public function hasLeadingZeroPossible()
{
return isset($this->leadingZeroPossible);
}
public function isLeadingZeroPossible()
{
return $this->leadingZeroPossible;
}
public function setLeadingZeroPossible($value)
{
$this->leadingZeroPossible = $value;
return $this;
}
private $mobileNumberPortableRegion = false;
public function hasMobileNumberPortableRegion()
{
return isset($this->mobileNumberPortableRegion);
}
public function isMobileNumberPortableRegion()
{
return $this->mobileNumberPortableRegion;
}
public function setMobileNumberPortableRegion($value)
{
$this->mobileNumberPortableRegion = $value;
return $this;
}
private $generalDesc = null;
public function hasGeneralDesc()
{
return isset($this->generalDesc);
}
/**
* @return PhoneNumberDesc
*/
public function getGeneralDesc()
{
return $this->generalDesc;
}
public function setGeneralDesc(PhoneNumberDesc $value)
{
$this->generalDesc = $value;
return $this;
}
/**
* @var PhoneNumberDesc
*/
private $mobile = null;
public function hasMobile()
{
return isset($this->mobile);
}
/**
* @return PhoneNumberDesc
*/
public function getMobile()
{
return $this->mobile;
}
public function setMobile(PhoneNumberDesc $value)
{
$this->mobile = $value;
return $this;
}
private $premiumRate = null;
public function hasPremiumRate()
{
return isset($this->premiumRate);
}
/**
* @return PhoneNumberDesc
*/
public function getPremiumRate()
{
return $this->premiumRate;
}
public function setPremiumRate(PhoneNumberDesc $value)
{
$this->premiumRate = $value;
return $this;
}
private $fixedLine = null;
public function hasFixedLine()
{
return isset($this->fixedLine);
}
/**
* @return PhoneNumberDesc
*/
public function getFixedLine()
{
return $this->fixedLine;
}
public function setFixedLine(PhoneNumberDesc $value)
{
$this->fixedLine = $value;
return $this;
}
private $sameMobileAndFixedLinePattern = false;
public function hasSameMobileAndFixedLinePattern()
{
return isset($this->sameMobileAndFixedLinePattern);
}
public function isSameMobileAndFixedLinePattern()
{
return $this->sameMobileAndFixedLinePattern;
}
public function setSameMobileAndFixedLinePattern($value)
{
$this->sameMobileAndFixedLinePattern = $value;
return $this;
}
private $numberFormat = array();
/**
* @return NumberFormat[]
*/
public function numberFormats()
{
return $this->numberFormat;
}
public function numberFormatSize()
{
return count($this->numberFormat);
}
/**
* @param int $index
* @return NumberFormat
*/
public function getNumberFormat($index)
{
return $this->numberFormat[$index];
}
public function addNumberFormat(NumberFormat $value)
{
$this->numberFormat[] = $value;
return $this;
}
private $tollFree = null;
public function hasTollFree()
{
return isset($this->tollFree);
}
/**
* @return PhoneNumberDesc
*/
public function getTollFree()
{
return $this->tollFree;
}
public function setTollFree(PhoneNumberDesc $value)
{
$this->tollFree = $value;
return $this;
}
private $sharedCost = null;
public function hasSharedCost()
{
return isset($this->sharedCost);
}
/**
* @return PhoneNumberDesc
*/
public function getSharedCost()
{
return $this->sharedCost;
}
public function setSharedCost(PhoneNumberDesc $value)
{
$this->sharedCost = $value;
return $this;
}
private $personalNumber;
public function hasPersonalNumber()
{
return isset($this->personalNumber);
}
/**
* @return PhoneNumberDesc
*/
public function getPersonalNumber()
{
return $this->personalNumber;
}
public function setPersonalNumber(PhoneNumberDesc $value)
{
$this->personalNumber = $value;
return $this;
}
private $voip;
public function hasVoip()
{
return isset($this->voip);
}
/**
* @return PhoneNumberDesc
*/
public function getVoip()
{
return $this->voip;
}
public function setVoip(PhoneNumberDesc $value)
{
$this->voip = $value;
return $this;
}
private $pager;
public function hasPager()
{
return isset($this->pager);
}
/**
* @return PhoneNumberDesc
*/
public function getPager()
{
return $this->pager;
}
public function setPager(PhoneNumberDesc $value)
{
$this->pager = $value;
return $this;
}
private $uan;
public function hasUan()
{
return isset($this->uan);
}
/**
* @return PhoneNumberDesc
*/
public function getUan()
{
return $this->uan;
}
public function setUan(PhoneNumberDesc $value)
{
$this->uan = $value;
return $this;
}
private $emergency;
public function hasEmergency()
{
return isset($this->emergency);
}
/**
* @return PhoneNumberDesc
*/
public function getEmergency()
{
return $this->emergency;
}
public function setEmergency(PhoneNumberDesc $value)
{
$this->emergency = $value;
return $this;
}
private $voicemail;
public function hasVoicemail()
{
return isset($this->voicemail);
}
/**
* @return PhoneNumberDesc
*/
public function getVoicemail()
{
return $this->voicemail;
}
public function setVoicemail(PhoneNumberDesc $value)
{
$this->voicemail = $value;
return $this;
}
/**
* @var PhoneNumberDesc
*/
private $short_code;
public function hasShortCode()
{
return isset($this->short_code);
}
public function getShortCode()
{
return $this->short_code;
}
public function setShortCode(PhoneNumberDesc $value)
{
$this->short_code = $value;
return $this;
}
/**
* @var PhoneNumberDesc
*/
private $standard_rate;
public function hasStandardRate()
{
return isset($this->standard_rate);
}
public function getStandardRate()
{
return $this->standard_rate;
}
public function setStandardRate(PhoneNumberDesc $value)
{
$this->standard_rate = $value;
return $this;
}
/**
* @var PhoneNumberDesc
*/
private $carrierSpecific;
public function hasCarrierSpecific()
{
return isset($this->carrierSpecific);
}
public function getCarrierSpecific()
{
return $this->carrierSpecific;
}
public function setCarrierSpecific(PhoneNumberDesc $value)
{
$this->carrierSpecific = $value;
return $this;
}
/**
* @var PhoneNumberDesc
*/
private $noInternationalDialling = null;
public function hasNoInternationalDialling()
{
return isset($this->noInternationalDialling);
}
public function getNoInternationalDialling()
{
return $this->noInternationalDialling;
}
public function setNoInternationalDialling(PhoneNumberDesc $value)
{
$this->noInternationalDialling = $value;
return $this;
}
/**
*
* @var NumberFormat[]
*/
private $intlNumberFormat = array();
public function intlNumberFormats()
{
return $this->intlNumberFormat;
}
public function intlNumberFormatSize()
{
return count($this->intlNumberFormat);
}
public function getIntlNumberFormat($index)
{
return $this->intlNumberFormat[$index];
}
public function addIntlNumberFormat(NumberFormat $value)
{
$this->intlNumberFormat[] = $value;
return $this;
}
public function clearIntlNumberFormat()
{
$this->intlNumberFormat = array();
return $this;
}
public function toArray()
{
$output = array();
if ($this->hasGeneralDesc()) {
$output['generalDesc'] = $this->getGeneralDesc()->toArray();
}
if ($this->hasFixedLine()) {
$output['fixedLine'] = $this->getFixedLine()->toArray();
}
if ($this->hasMobile()) {
$output['mobile'] = $this->getMobile()->toArray();
}
if ($this->hasTollFree()) {
$output['tollFree'] = $this->getTollFree()->toArray();
}
if ($this->hasPremiumRate()) {
$output['premiumRate'] = $this->getPremiumRate()->toArray();
}
if ($this->hasPremiumRate()) {
$output['premiumRate'] = $this->getPremiumRate()->toArray();
}
if ($this->hasSharedCost()) {
$output['sharedCost'] = $this->getSharedCost()->toArray();
}
if ($this->hasPersonalNumber()) {
$output['personalNumber'] = $this->getPersonalNumber()->toArray();
}
if ($this->hasVoip()) {
$output['voip'] = $this->getVoip()->toArray();
}
if ($this->hasPager()) {
$output['pager'] = $this->getPager()->toArray();
}
if ($this->hasUan()) {
$output['uan'] = $this->getUan()->toArray();
}
if ($this->hasEmergency()) {
$output['emergency'] = $this->getEmergency()->toArray();
}
if ($this->hasVoicemail()) {
$output['voicemail'] = $this->getVoicemail()->toArray();
}
if ($this->hasShortCode()) {
$output['shortCode'] = $this->getShortCode()->toArray();
}
if ($this->hasStandardRate()) {
$output['standardRate'] = $this->getStandardRate()->toArray();
}
if ($this->hasCarrierSpecific()) {
$output['carrierSpecific'] = $this->getCarrierSpecific()->toArray();
}
if ($this->hasNoInternationalDialling()) {
$output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray();
}
$output['id'] = $this->getId();
$output['countryCode'] = $this->getCountryCode();
$output['internationalPrefix'] = $this->getInternationalPrefix();
if ($this->hasPreferredInternationalPrefix()) {
$output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix();
}
if ($this->hasNationalPrefix()) {
$output['nationalPrefix'] = $this->getNationalPrefix();
}
if ($this->hasPreferredExtnPrefix()) {
$output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix();
}
if ($this->hasNationalPrefixForParsing()) {
$output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing();
}
if ($this->hasNationalPrefixTransformRule()) {
$output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule();
}
$output['sameMobileAndFixedLinePattern'] = $this->isSameMobileAndFixedLinePattern();
$output['numberFormat'] = array();
foreach ($this->numberFormats() as $numberFormat) {
$output['numberFormat'][] = $numberFormat->toArray();
}
$output['intlNumberFormat'] = array();
foreach ($this->intlNumberFormats() as $intlNumberFormat) {
$output['intlNumberFormat'][] = $intlNumberFormat->toArray();
}
$output['mainCountryForCode'] = $this->getMainCountryForCode();
if ($this->hasLeadingDigits()) {
$output['leadingDigits'] = $this->getLeadingDigits();
}
$output['leadingZeroPossible'] = $this->isLeadingZeroPossible();
$output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion();
return $output;
}
/**
* @param array $input
* @return PhoneMetadata
*/
public function fromArray(array $input)
{
if (isset($input['generalDesc'])) {
$desc = new PhoneNumberDesc();
$this->setGeneralDesc($desc->fromArray($input['generalDesc']));
}
if (isset($input['fixedLine'])) {
$desc = new PhoneNumberDesc();
$this->setFixedLine($desc->fromArray($input['fixedLine']));
}
if (isset($input['mobile'])) {
$desc = new PhoneNumberDesc();
$this->setMobile($desc->fromArray($input['mobile']));
}
if (isset($input['tollFree'])) {
$desc = new PhoneNumberDesc();
$this->setTollFree($desc->fromArray($input['tollFree']));
}
if (isset($input['premiumRate'])) {
$desc = new PhoneNumberDesc();
$this->setPremiumRate($desc->fromArray($input['premiumRate']));
}
if (isset($input['sharedCost'])) {
$desc = new PhoneNumberDesc();
$this->setSharedCost($desc->fromArray($input['sharedCost']));
}
if (isset($input['personalNumber'])) {
$desc = new PhoneNumberDesc();
$this->setPersonalNumber($desc->fromArray($input['personalNumber']));
}
if (isset($input['voip'])) {
$desc = new PhoneNumberDesc();
$this->setVoip($desc->fromArray($input['voip']));
}
if (isset($input['pager'])) {
$desc = new PhoneNumberDesc();
$this->setPager($desc->fromArray($input['pager']));
}
if (isset($input['uan'])) {
$desc = new PhoneNumberDesc();
$this->setUan($desc->fromArray($input['uan']));
}
if (isset($input['emergency'])) {
$desc = new PhoneNumberDesc();
$this->setEmergency($desc->fromArray($input['emergency']));
}
if (isset($input['voicemail'])) {
$desc = new PhoneNumberDesc();
$this->setVoicemail($desc->fromArray($input['voicemail']));
}
if (isset($input['shortCode'])) {
$desc = new PhoneNumberDesc();
$this->setShortCode(($desc->fromArray($input['shortCode'])));
}
if (isset($input['standardRate'])) {
$desc = new PhoneNumberDesc();
$this->setStandardRate($desc->fromArray($input['standardRate']));
}
if (isset($input['carrierSpecific'])) {
$desc = new PhoneNumberDesc();
$this->setCarrierSpecific($desc->fromArray($input['carrierSpecific']));
}
if (isset($input['noInternationalDialling'])) {
$desc = new PhoneNumberDesc();
$this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling']));
}
$this->setId($input['id']);
$this->setCountryCode($input['countryCode']);
$this->setInternationalPrefix($input['internationalPrefix']);
if (isset($input['preferredInternationalPrefix'])) {
$this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']);
}
if (isset($input['nationalPrefix'])) {
$this->setNationalPrefix($input['nationalPrefix']);
}
if (isset($input['nationalPrefix'])) {
$this->setNationalPrefix($input['nationalPrefix']);
}
if (isset($input['preferredExtnPrefix'])) {
$this->setPreferredExtnPrefix($input['preferredExtnPrefix']);
}
if (isset($input['nationalPrefixForParsing'])) {
$this->setNationalPrefixForParsing($input['nationalPrefixForParsing']);
}
if (isset($input['nationalPrefixTransformRule'])) {
$this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']);
}
foreach ($input['numberFormat'] as $numberFormatElt) {
$numberFormat = new NumberFormat();
$numberFormat->fromArray($numberFormatElt);
$this->addNumberFormat($numberFormat);
}
foreach ($input['intlNumberFormat'] as $intlNumberFormatElt) {
$numberFormat = new NumberFormat();
$numberFormat->fromArray($intlNumberFormatElt);
$this->addIntlNumberFormat($numberFormat);
}
$this->setMainCountryForCode($input['mainCountryForCode']);
if (isset($input['leadingDigits'])) {
$this->setLeadingDigits($input['leadingDigits']);
}
$this->setLeadingZeroPossible($input['leadingZeroPossible']);
$this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']);
return $this;
}
}

View File

@@ -0,0 +1,578 @@
<?php
namespace libphonenumber;
class PhoneNumber implements \Serializable
{
/**
* The country code.
*
* @var int|null
*/
private $countryCode = null;
/**
* Returns whether this phone number has a country code set.
*
* @return bool True if a country code is set, false otherwise.
*/
public function hasCountryCode()
{
return isset($this->countryCode);
}
/**
* Returns the country code of this phone number.
*
* @return int|null The country code, or null if not set.
*/
public function getCountryCode()
{
return $this->countryCode;
}
/**
* Sets the country code of this phone number.
*
* @param int $value The country code.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setCountryCode($value)
{
$this->countryCode = (int) $value;
return $this;
}
/**
* Clears the country code of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearCountryCode()
{
$this->countryCode = null;
return $this;
}
/**
* The national number.
*
* @var string|null
*/
private $nationalNumber = null;
/**
* Returns whether this phone number has a national number set.
*
* @return bool True if a national number is set, false otherwise.
*/
public function hasNationalNumber()
{
return isset($this->nationalNumber);
}
/**
* Returns the country code of this phone number.
*
* @return string|null The national number, or null if not set.
*/
public function getNationalNumber()
{
return $this->nationalNumber;
}
/**
* Sets the national number of this phone number.
*
* @param string $value The national number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setNationalNumber($value)
{
$this->nationalNumber = (string) $value;
return $this;
}
/**
* Clears the national number of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearNationalNumber()
{
$this->nationalNumber = null;
return $this;
}
/**
* The extension.
*
* @var string|null
*/
private $extension = null;
/**
* Returns whether this phone number has an extension set.
*
* @return bool True if an extension is set, false otherwise.
*/
public function hasExtension()
{
return isset($this->extension);
}
/**
* Returns the extension of this phone number.
*
* @return string|null The extension, or null if not set.
*/
public function getExtension()
{
return $this->extension;
}
/**
* Sets the extension of this phone number.
*
* @param string $value The extension.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setExtension($value)
{
$this->extension = (string) $value;
return $this;
}
/**
* Clears the extension of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearExtension()
{
$this->extension = null;
return $this;
}
/**
* Whether this phone number uses an italian leading zero.
*
* @var bool|null
*/
private $italianLeadingZero = null;
/**
* Returns whether this phone number has the italian leading zero information set.
*
* @return bool
*/
public function hasItalianLeadingZero()
{
return isset($this->italianLeadingZero);
}
/**
* Returns whether this phone number uses an italian leading zero.
*
* @return bool|null True if it uses an italian leading zero, false it it does not, null if not set.
*/
public function isItalianLeadingZero()
{
return $this->italianLeadingZero;
}
/**
* Sets whether this phone number uses an italian leading zero.
*
* @param bool $value True to use italian leading zero, false otherwise.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setItalianLeadingZero($value)
{
$this->italianLeadingZero = (bool) $value;
return $this;
}
/**
* Clears the italian leading zero information of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearItalianLeadingZero()
{
$this->italianLeadingZero = null;
return $this;
}
/**
* The raw input.
*
* @var string|null
*/
private $rawInput = null;
/**
* Returns whether this phone number has a raw input.
*
* @return bool True if a raw input is set, false otherwise.
*/
public function hasRawInput()
{
return isset($this->rawInput);
}
/**
* Returns the raw input of this phone number.
*
* @return string|null The raw input, or null if not set.
*/
public function getRawInput()
{
return $this->rawInput;
}
/**
* Sets the raw input of this phone number.
*
* @param string $value The raw input.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setRawInput($value)
{
$this->rawInput = (string) $value;
return $this;
}
/**
* Clears the raw input of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearRawInput()
{
$this->rawInput = null;
return $this;
}
/**
* The country code source.
*
* This must be one of the CountryCodeSource constants.
*
* @var int|null
*/
private $countryCodeSource = null;
/**
* Returns whether this phone number has a country code source.
*
* @return bool True if a country code source is set, false otherwise.
*/
public function hasCountryCodeSource()
{
return isset($this->countryCodeSource);
}
/**
* Returns the country code source of this phone number.
*
* @return int|null A CountryCodeSource constant, or null if not set.
*/
public function getCountryCodeSource()
{
return $this->countryCodeSource;
}
/**
* Sets the country code source of this phone number.
*
* @param int $value A CountryCodeSource constant.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setCountryCodeSource($value)
{
$this->countryCodeSource = (int) $value;
return $this;
}
/**
* Clears the country code source of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearCountryCodeSource()
{
$this->countryCodeSource = null;
return $this;
}
/**
* The preferred domestic carrier code.
*
* @var string|null
*/
private $preferredDomesticCarrierCode = null;
/**
* Returns whether this phone number has a preferred domestic carrier code.
*
* @return bool True if a preferred domestic carrier code is set, false otherwise.
*/
public function hasPreferredDomesticCarrierCode()
{
return isset($this->preferredDomesticCarrierCode);
}
/**
* Returns the preferred domestic carrier code of this phone number.
*
* @return string|null The preferred domestic carrier code, or null if not set.
*/
public function getPreferredDomesticCarrierCode()
{
return $this->preferredDomesticCarrierCode;
}
/**
* Sets the preferred domestic carrier code of this phone number.
*
* @param string $value The preferred domestic carrier code.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setPreferredDomesticCarrierCode($value)
{
$this->preferredDomesticCarrierCode = (string) $value;
return $this;
}
/**
* Clears the preferred domestic carrier code of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearPreferredDomesticCarrierCode()
{
$this->preferredDomesticCarrierCode = null;
return $this;
}
/**
* Whether this phone number has a number of leading zeros set.
*
* @var bool
*/
private $hasNumberOfLeadingZeros = false;
/**
* The number of leading zeros of this phone number.
*
* @var int
*/
private $numberOfLeadingZeros = 1;
/**
* Returns whether this phone number has a number of leading zeros set.
*
* @return bool True if a number of leading zeros is set, false otherwise.
*/
public function hasNumberOfLeadingZeros()
{
return $this->hasNumberOfLeadingZeros;
}
/**
* Returns the number of leading zeros of this phone number.
*
* @return int The number of leading zeros.
*/
public function getNumberOfLeadingZeros()
{
return $this->numberOfLeadingZeros;
}
/**
* Sets the number of leading zeros of this phone number.
*
* @param int $value The number of leading zeros.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function setNumberOfLeadingZeros($value)
{
$this->hasNumberOfLeadingZeros = true;
$this->numberOfLeadingZeros = (int) $value;
return $this;
}
/**
* Clears the number of leading zeros of this phone number.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clearNumberOfLeadingZeros()
{
$this->hasNumberOfLeadingZeros = false;
$this->numberOfLeadingZeros = 1;
return $this;
}
/**
* Clears this phone number.
*
* This effectively resets this phone number to the state of a new instance.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function clear()
{
$this->clearCountryCode();
$this->clearNationalNumber();
$this->clearExtension();
$this->clearItalianLeadingZero();
$this->clearNumberOfLeadingZeros();
$this->clearRawInput();
$this->clearCountryCodeSource();
$this->clearPreferredDomesticCarrierCode();
return $this;
}
/**
* Merges the information from another phone number into this phone number.
*
* @param PhoneNumber $other The phone number to copy.
*
* @return PhoneNumber This PhoneNumber instance, for chaining method calls.
*/
public function mergeFrom(PhoneNumber $other)
{
if ($other->hasCountryCode()) {
$this->setCountryCode($other->getCountryCode());
}
if ($other->hasNationalNumber()) {
$this->setNationalNumber($other->getNationalNumber());
}
if ($other->hasExtension()) {
$this->setExtension($other->getExtension());
}
if ($other->hasItalianLeadingZero()) {
$this->setItalianLeadingZero($other->isItalianLeadingZero());
}
if ($other->hasNumberOfLeadingZeros()) {
$this->setNumberOfLeadingZeros($other->getNumberOfLeadingZeros());
}
if ($other->hasRawInput()) {
$this->setRawInput($other->getRawInput());
}
if ($other->hasCountryCodeSource()) {
$this->setCountryCodeSource($other->getCountryCodeSource());
}
if ($other->hasPreferredDomesticCarrierCode()) {
$this->setPreferredDomesticCarrierCode($other->getPreferredDomesticCarrierCode());
}
return $this;
}
/**
* Returns whether this phone number is equal to another.
*
* @param PhoneNumber $other The phone number to compare.
*
* @return bool True if the phone numbers are equal, false otherwise.
*/
public function equals(PhoneNumber $other)
{
$sameType = get_class($other) == get_class($this);
$sameCountry = $this->hasCountryCode() == $other->hasCountryCode() &&
(!$this->hasCountryCode() || $this->getCountryCode() == $other->getCountryCode());
$sameNational = $this->hasNationalNumber() == $other->hasNationalNumber() &&
(!$this->hasNationalNumber() || $this->getNationalNumber() == $other->getNationalNumber());
$sameExt = $this->hasExtension() == $other->hasExtension() &&
(!$this->hasExtension() || $this->hasExtension() == $other->hasExtension());
$sameLead = $this->hasItalianLeadingZero() == $other->hasItalianLeadingZero() &&
(!$this->hasItalianLeadingZero() || $this->isItalianLeadingZero() == $other->isItalianLeadingZero());
$sameZeros = $this->getNumberOfLeadingZeros() == $other->getNumberOfLeadingZeros();
$sameRaw = $this->hasRawInput() == $other->hasRawInput() &&
(!$this->hasRawInput() || $this->getRawInput() == $other->getRawInput());
$sameCountrySource = $this->hasCountryCodeSource() == $other->hasCountryCodeSource() &&
(!$this->hasCountryCodeSource() || $this->getCountryCodeSource() == $other->getCountryCodeSource());
$samePrefCar = $this->hasPreferredDomesticCarrierCode() == $other->hasPreferredDomesticCarrierCode() &&
(!$this->hasPreferredDomesticCarrierCode() || $this->getPreferredDomesticCarrierCode(
) == $other->getPreferredDomesticCarrierCode());
return $sameType && $sameCountry && $sameNational && $sameExt && $sameLead && $sameZeros && $sameRaw && $sameCountrySource && $samePrefCar;
}
/**
* Returns a string representation of this phone number.
* @return string
*/
public function __toString()
{
$outputString = '';
$outputString .= 'Country Code: ' . $this->countryCode;
$outputString .= ' National Number: ' . $this->nationalNumber;
if ($this->hasItalianLeadingZero()) {
$outputString .= ' Leading Zero(s): true';
}
if ($this->hasNumberOfLeadingZeros()) {
$outputString .= ' Number of leading zeros: ' . $this->numberOfLeadingZeros;
}
if ($this->hasExtension()) {
$outputString .= ' Extension: ' . $this->extension;
}
if ($this->hasCountryCode()) {
$outputString .= ' Country Code Source: ' . $this->countryCodeSource;
}
if ($this->hasPreferredDomesticCarrierCode()) {
$outputString .= ' Preferred Domestic Carrier Code: ' . $this->preferredDomesticCarrierCode;
}
return $outputString;
}
/**
* @inheritDoc
*/
public function serialize()
{
return serialize(
array(
$this->countryCode,
$this->nationalNumber,
$this->extension,
$this->italianLeadingZero,
$this->numberOfLeadingZeros,
$this->rawInput,
$this->countryCodeSource,
$this->preferredDomesticCarrierCode
)
);
}
/**
* @inheritDoc
*/
public function unserialize($serialized)
{
$data = unserialize($serialized);
list (
$this->countryCode,
$this->nationalNumber,
$this->extension,
$this->italianLeadingZero,
$this->numberOfLeadingZeros,
$this->rawInput,
$this->countryCodeSource,
$this->preferredDomesticCarrierCode
) = $data;
$this->hasNumberOfLeadingZeros = true;
}
}

View File

@@ -0,0 +1,168 @@
<?php
namespace libphonenumber;
/**
* Phone Number Description
*/
class PhoneNumberDesc
{
private $hasNationalNumberPattern = false;
private $nationalNumberPattern = "";
private $hasPossibleNumberPattern = false;
private $possibleNumberPattern = "";
private $hasExampleNumber = false;
private $exampleNumber = "";
/**
* @return boolean
*/
public function hasNationalNumberPattern()
{
return $this->hasNationalNumberPattern;
}
/**
* @return string
*/
public function getNationalNumberPattern()
{
return $this->nationalNumberPattern;
}
/**
* @param string $value
* @return PhoneNumberDesc
*/
public function setNationalNumberPattern($value)
{
$this->hasNationalNumberPattern = true;
$this->nationalNumberPattern = $value;
return $this;
}
/**
* @return boolean
*/
public function hasPossibleNumberPattern()
{
return $this->hasPossibleNumberPattern;
}
/**
* @return string
*/
public function getPossibleNumberPattern()
{
return $this->possibleNumberPattern;
}
/**
* @param string $value
* @return PhoneNumberDesc
*/
public function setPossibleNumberPattern($value)
{
$this->hasPossibleNumberPattern = true;
$this->possibleNumberPattern = $value;
return $this;
}
/**
* @return string
*/
public function hasExampleNumber()
{
return $this->hasExampleNumber;
}
/**
* @return string
*/
public function getExampleNumber()
{
return $this->exampleNumber;
}
/**
* @param string $value
* @return PhoneNumberDesc
*/
public function setExampleNumber($value)
{
$this->hasExampleNumber = true;
$this->exampleNumber = $value;
return $this;
}
/**
* @param PhoneNumberDesc $other
* @return PhoneNumberDesc
*/
public function mergeFrom(PhoneNumberDesc $other)
{
if ($other->hasNationalNumberPattern()) {
$this->setNationalNumberPattern($other->getNationalNumberPattern());
}
if ($other->hasPossibleNumberPattern()) {
$this->setPossibleNumberPattern($other->getPossibleNumberPattern());
}
if ($other->hasExampleNumber()) {
$this->setExampleNumber($other->getExampleNumber());
}
return $this;
}
/**
* @param PhoneNumberDesc $other
* @return boolean
*/
public function exactlySameAs(PhoneNumberDesc $other)
{
return $this->nationalNumberPattern === $other->nationalNumberPattern &&
$this->possibleNumberPattern === $other->possibleNumberPattern &&
$this->exampleNumber === $other->exampleNumber;
}
/**
* @return array
*/
public function toArray()
{
$data = array();
if ($this->hasNationalNumberPattern()) {
$data['NationalNumberPattern'] = $this->getNationalNumberPattern();
}
if ($this->hasPossibleNumberPattern()) {
$data['PossibleNumberPattern'] = $this->getPossibleNumberPattern();
}
if ($this->hasExampleNumber()) {
$data['ExampleNumber'] = $this->getExampleNumber();
}
return $data;
}
/**
* @param array $input
* @return PhoneNumberDesc
*/
public function fromArray(array $input)
{
if (isset($input['NationalNumberPattern']) && $input['NationalNumberPattern'] != '') {
$this->setNationalNumberPattern($input['NationalNumberPattern']);
}
if (isset($input['PossibleNumberPattern']) && $input['NationalNumberPattern'] != '') {
$this->setPossibleNumberPattern($input['PossibleNumberPattern']);
}
if (isset($input['ExampleNumber']) && $input['NationalNumberPattern'] != '') {
$this->setExampleNumber($input['ExampleNumber']);
}
return $this;
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace libphonenumber;
/**
* INTERNATIONAL and NATIONAL formats are consistent with the definition in ITU-T Recommendation
* E123. For example, the number of the Google Switzerland office will be written as
* "+41 44 668 1800" in INTERNATIONAL format, and as "044 668 1800" in NATIONAL format.
* E164 format is as per INTERNATIONAL format but with no formatting applied, e.g.
* "+41446681800". RFC3966 is as per INTERNATIONAL format, but with all spaces and other
* separating symbols replaced with a hyphen, and with any phone number extension appended with
* ";ext=". It also will have a prefix of "tel:" added, e.g. "tel:+41-44-668-1800".
*
* Note: If you are considering storing the number in a neutral format, you are highly advised to
* use the PhoneNumber class.
*/
class PhoneNumberFormat
{
const E164 = 0;
const INTERNATIONAL = 1;
const NATIONAL = 2;
const RFC3966 = 3;
}

View File

@@ -0,0 +1,135 @@
<?php
/**
*
*
* @author giggsey
* @created: 02/10/13 16:52
* @project libphonenumber-for-php
*/
namespace libphonenumber;
use libphonenumber\prefixmapper\PrefixFileReader;
class PhoneNumberToCarrierMapper
{
/**
* @var PhoneNumberToCarrierMapper[]
*/
private static $instance = array();
const MAPPING_DATA_DIRECTORY = '/carrier/data/';
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
/**
* @var PrefixFileReader
*/
private $prefixFileReader;
private function __construct($phonePrefixDataDirectory)
{
if(!extension_loaded('intl')) {
throw new \RuntimeException('The intl extension must be installed');
}
$this->prefixFileReader = new PrefixFileReader(dirname(__FILE__) . $phonePrefixDataDirectory);
$this->phoneUtil = PhoneNumberUtil::getInstance();
}
/**
* Gets a {@link PhoneNumberToCarrierMapper} instance to carry out international carrier lookup.
*
* <p> The {@link PhoneNumberToCarrierMapper} is implemented as a singleton. Therefore, calling
* this method multiple times will only result in one instance being created.
*
* @param string $mappingDir
* @return PhoneNumberToCarrierMapper
*/
public static function getInstance($mappingDir = self::MAPPING_DATA_DIRECTORY)
{
if (!array_key_exists($mappingDir, self::$instance)) {
self::$instance[$mappingDir] = new self($mappingDir);
}
return self::$instance[$mappingDir];
}
/**
* Returns a carrier name for the given phone number, in the language provided. The carrier name
* is the one the number was originally allocated to, however if the country supports mobile
* number portability the number might not belong to the returned carrier anymore. If no mapping
* is found an empty string is returned.
*
* <p>This method assumes the validity of the number passed in has already been checked, and that
* the number is suitable for carrier lookup. We consider mobile and pager numbers possible
* candidates for carrier lookup.
*
* @param PhoneNumber $number a valid phone number for which we want to get a carrier name
* @param string $languageCode the language code in which the name should be written
* @return string a carrier name for the given phone number
*/
public function getNameForValidNumber(PhoneNumber $number, $languageCode)
{
$languageStr = \Locale::getPrimaryLanguage($languageCode);
$scriptStr = "";
$regionStr = \Locale::getRegion($languageCode);
return $this->prefixFileReader->getDescriptionForNumber($number, $languageStr, $scriptStr, $regionStr);
}
/**
* Gets the name of the carrier for the given phone number, in the language provided. As per
* {@link #getNameForValidNumber(PhoneNumber, Locale)} but explicitly checks the validity of
* the number passed in.
*
* @param PhoneNumber $number The phone number for which we want to get a carrier name
* @param string $languageCode Language code for which the description should be written
* @return string a carrier name for the given phone number, or empty string if the number passed in is
* invalid
*/
public function getNameForNumber(PhoneNumber $number, $languageCode)
{
$numberType = $this->phoneUtil->getNumberType($number);
if ($this->isMobile($numberType)) {
return $this->getNameForValidNumber($number, $languageCode);
}
return "";
}
/**
* Gets the name of the carrier for the given phone number only when it is 'safe' to display to
* users. A carrier name is considered safe if the number is valid and for a region that doesn't
* support
* {@linkplain http://en.wikipedia.org/wiki/Mobile_number_portability mobile number portability}.
*
* @param $number PhoneNumber the phone number for which we want to get a carrier name
* @param $languageCode String the language code in which the name should be written
* @return string a carrier name that is safe to display to users, or the empty string
*/
public function getSafeDisplayName(PhoneNumber $number, $languageCode)
{
if ($this->phoneUtil->isMobileNumberPortableRegion($this->phoneUtil->getRegionCodeForNumber($number))) {
return "";
}
return $this->getNameForNumber($number, $languageCode);
}
/**
* Checks if the supplied number type supports carrier lookup.
* @param int $numberType A PhoneNumberType int
* @return bool
*/
private function isMobile($numberType)
{
return ($numberType === PhoneNumberType::MOBILE ||
$numberType === PhoneNumberType::FIXED_LINE_OR_MOBILE ||
$numberType === PhoneNumberType::PAGER
);
}
}

View File

@@ -0,0 +1,159 @@
<?php
/**
* Created by PhpStorm.
* User: giggsey
* Date: 14/10/13
* Time: 16:00
*/
namespace libphonenumber;
use libphonenumber\prefixmapper\PrefixTimeZonesMap;
class PhoneNumberToTimeZonesMapper
{
const UNKNOWN_TIMEZONE = 'Etc/Unknown';
const MAPPING_DATA_DIRECTORY = '/timezone/data/';
const MAPPING_DATA_FILE_NAME = "map_data.php";
/**
* @var PhoneNumberToTimeZonesMapper
*/
private static $instance = null;
private $unknownTimeZoneList = array();
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
private $prefixTimeZonesMap;
private function __construct($phonePrefixDataDirectory)
{
$this->prefixTimeZonesMap = self::loadPrefixTimeZonesMapFromFile(
dirname(__FILE__) . $phonePrefixDataDirectory . DIRECTORY_SEPARATOR . self::MAPPING_DATA_FILE_NAME
);
$this->phoneUtil = PhoneNumberUtil::getInstance();
$this->unknownTimeZoneList[] = self::UNKNOWN_TIMEZONE;
}
private static function loadPrefixTimeZonesMapFromFile($path)
{
if (!is_readable($path)) {
throw new \InvalidArgumentException("Mapping file can not be found");
}
$data = require $path;
$map = new PrefixTimeZonesMap($data);
return $map;
}
/**
* Gets a {@link PhoneNumberToTimeZonesMapper} instance.
*
* <p> The {@link PhoneNumberToTimeZonesMapper} is implemented as a singleton. Therefore, calling
* this method multiple times will only result in one instance being created.
*
* @param $mappingDir
* @return PhoneNumberToTimeZonesMapper instance
*/
public static function getInstance($mappingDir = self::MAPPING_DATA_DIRECTORY)
{
if (self::$instance === null) {
self::$instance = new self($mappingDir);
}
return self::$instance;
}
/**
* Returns a String with the ICU unknown time zone.
* @return string
*/
public static function getUnknownTimeZone()
{
return self::UNKNOWN_TIMEZONE;
}
/**
* As per {@link #getTimeZonesForGeographicalNumber(PhoneNumber)} but explicitly checks
* the validity of the number passed in.
*
* @param $number PhoneNumber the phone number for which we want to get the time zones to which it belongs
* @return array a list of the corresponding time zones or a single element list with the default
* unknown time zone if no other time zone was found or if the number was invalid
*/
public function getTimeZonesForNumber(PhoneNumber $number)
{
$numberType = $this->phoneUtil->getNumberType($number);
if ($numberType === PhoneNumberType::UNKNOWN) {
return $this->unknownTimeZoneList;
} elseif (!$this->canBeGeocoded($numberType)) {
return $this->getCountryLevelTimeZonesforNumber($number);
}
return $this->getTimeZonesForGeographicalNumber($number);
}
/**
* A similar method is implemented as PhoneNumberUtil.isNumberGeographical, which performs a
* stricter check, as it determines if a number has a geographical association. Also, if new
* phone number types were added, we should check if this other method should be updated too.
* TODO: Remove duplication by completing the logic in the method in PhoneNumberUtil.
* For more information, see the comments in that method.
* @param $numberType
* @return bool
*/
public function canBeGeocoded($numberType)
{
return ($numberType === PhoneNumberType::FIXED_LINE ||
$numberType === PhoneNumberType::MOBILE ||
$numberType === PhoneNumberType::FIXED_LINE_OR_MOBILE
);
}
/**
* Returns the list of time zones corresponding to the country calling code of {@code number}.
*
* @param $number PhoneNumber the phone number to look up
* @return array the list of corresponding time zones or a single element list with the default
* unknown time zone if no other time zone was found
*/
private function getCountryLevelTimeZonesforNumber(PhoneNumber $number)
{
$timezones = $this->prefixTimeZonesMap->lookupCountryLevelTimeZonesForNumber($number);
return (count($timezones) == 0) ? $this->unknownTimeZoneList : $timezones;
}
/**
* Returns a list of time zones to which a phone number belongs.
*
* <p>This method assumes the validity of the number passed in has already been checked, and that
* the number is geo-localizable. We consider fixed-line and mobile numbers possible candidates
* for geo-localization.
*
* @param $number PhoneNumber a valid phone number for which we want to get the time zones to which it belongs
* @return array a list of the corresponding time zones or a single element list with the default
* unknown time zone if no other time zone was found or if the number was invalid
*/
public function getTimeZonesForGeographicalNumber(PhoneNumber $number)
{
return $this->getTimeZonesForGeocodableNumber($number);
}
/**
* Returns a list of time zones to which a geocodable phone number belongs.
*
* @param PhoneNumber $number The phone number for which we want to get the time zones to which it belongs
* @return array the list of correspondiing time zones or a single element list with the default
* unknown timezone if no other time zone was found or if the number was invalid
*/
private function getTimeZonesForGeocodableNumber(PhoneNumber $number)
{
$timezones = $this->prefixTimeZonesMap->lookupTimeZonesForNumber($number);
return (count($timezones) == 0) ? $this->unknownTimeZoneList : $timezones;
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace libphonenumber;
/**
* Type of phone numbers.
*/
class PhoneNumberType
{
const FIXED_LINE = 0;
const MOBILE = 1;
// In some regions (e.g. the USA), it is impossible to distinguish between fixed-line and
// mobile numbers by looking at the phone number itself.
const FIXED_LINE_OR_MOBILE = 2;
// Freephone lines
const TOLL_FREE = 3;
const PREMIUM_RATE = 4;
// The cost of this call is shared between the caller and the recipient, and is hence typically
// less than PREMIUM_RATE calls. See // http://en.wikipedia.org/wiki/Shared_Cost_Service for
// more information.
const SHARED_COST = 5;
// Voice over IP numbers. This includes TSoIP (Telephony Service over IP).
const VOIP = 6;
// A personal number is associated with a particular person, and may be routed to either a
// MOBILE or FIXED_LINE number. Some more information can be found here:
// http://en.wikipedia.org/wiki/Personal_Numbers
const PERSONAL_NUMBER = 7;
const PAGER = 8;
// Used for "Universal Access Numbers" or "Company Numbers". They may be further routed to
// specific offices, but allow one number to be used for a company.
const UAN = 9;
// A phone number is of type UNKNOWN when it does not fit any of the known patterns for a
// specific region.
const UNKNOWN = 10;
// Emergency
const EMERGENCY = 27;
// Voicemail
const VOICEMAIL = 28;
// Short Code
const SHORT_CODE = 29;
// Standard Rate
const STANDARD_RATE = 30;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
<?php
namespace libphonenumber;
class RegexBasedMatcher implements MatcherAPIInterface
{
public static function create()
{
return new static();
}
/**
* Returns whether the given national number (a string containing only decimal digits) matches
* the national number pattern defined in the given {@code PhoneNumberDesc} message.
*
* @param string $nationalNumber
* @param PhoneNumberDesc $numberDesc
* @param boolean $allowPrefixMatch
* @return boolean
*/
public function matchesNationalNumber($nationalNumber, PhoneNumberDesc $numberDesc, $allowPrefixMatch)
{
$nationalNumberPatternMatcher = new Matcher($numberDesc->getNationalNumberPattern(), $nationalNumber);
return ($nationalNumberPatternMatcher->matches()
|| ($allowPrefixMatch && $nationalNumberPatternMatcher->lookingAt()));
}
/**
* Returns whether the given national number (a string containing only decimal digits) matches
* the possible number pattern defined in the given {@code PhoneNumberDesc} message.
*
* @param string $nationalNumber
* @param PhoneNumberDesc $numberDesc
* @return boolean
*/
public function matchesPossibleNumber($nationalNumber, PhoneNumberDesc $numberDesc)
{
$possibleNumberPatternMatcher = new Matcher($numberDesc->getPossibleNumberPattern(), $nationalNumber);
return $possibleNumberPatternMatcher->matches();
}
}

View File

@@ -0,0 +1,63 @@
<?php
/*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace libphonenumber;
/**
* Class containing string constants of region codes for easier testing.
*/
class RegionCode
{
// Region code for global networks (e.g. +800 numbers).
const UN001 = "001";
const AD = "AD";
const AE = "AE";
const AM = "AM";
const AO = "AO";
const AQ = "AQ";
const AR = "AR";
const AU = "AU";
const BB = "BB";
const BR = "BR";
const BS = "BS";
const BY = "BY";
const CA = "CA";
const CH = "CH";
const CL = "CL";
const CN = "CN";
const CS = "CS";
const CX = "CX";
const DE = "DE";
const FR = "FR";
const GB = "GB";
const HU = "HU";
const IT = "IT";
const JP = "JP";
const KR = "KR";
const MX = "MX";
const NZ = "NZ";
const PG = "PG";
const PL = "PL";
const RE = "RE";
const SE = "SE";
const SG = "SG";
const US = "US";
const YT = "YT";
const ZW = "ZW";
// Official code for the unknown region.
const ZZ = "ZZ";
}

View File

@@ -0,0 +1,15 @@
<?php
namespace libphonenumber;
/**
* Cost categories of short numbers
* @package libphonenumber
*/
class ShortNumberCost
{
const TOLL_FREE = 3;
const PREMIUM_RATE = 4;
const STANDARD_RATE = 30;
const UNKNOWN_COST = 10;
}

View File

@@ -0,0 +1,626 @@
<?php
/**
* Methods for getting information about short phone numbers, such as short codes and emergency
* numbers. Note that most commercial short numbers are not handled here, but by the
* {@link PhoneNumberUtil}.
*
* @author Shaopeng Jia
* @author David Yonge-Mallo
* @since 5.8
*/
namespace libphonenumber;
class ShortNumberInfo
{
const META_DATA_FILE_PREFIX = 'ShortNumberMetadata';
/**
* @var ShortNumberInfo
*/
private static $instance = null;
/**
* @var MatcherAPIInterface
*/
private $matcherAPI;
private $currentFilePrefix;
private $regionToMetadataMap = array();
private $countryCallingCodeToRegionCodeMap = array();
private $countryCodeToNonGeographicalMetadataMap = array();
private static $regionsWhereEmergencyNumbersMustBeExact = array(
'BR',
'CL',
'NI',
);
private function __construct(MatcherAPIInterface $matcherAPI)
{
$this->matcherAPI = $matcherAPI;
// TODO: Create ShortNumberInfo for a given map
$this->countryCallingCodeToRegionCodeMap = CountryCodeToRegionCodeMap::$countryCodeToRegionCodeMap;
$this->currentFilePrefix = dirname(__FILE__) . '/data/' . self::META_DATA_FILE_PREFIX;
// Initialise PhoneNumberUtil to make sure regex's are setup correctly
PhoneNumberUtil::getInstance();
}
/**
* Returns the singleton instance of ShortNumberInfo
*
* @return \libphonenumber\ShortNumberInfo
*/
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self(RegexBasedMatcher::create());
}
return self::$instance;
}
public static function resetInstance()
{
self::$instance = null;
}
/**
* Returns a list with teh region codes that match the specific country calling code. For
* non-geographical country calling codes, the region code 001 is returned. Also, in the case
* of no region code being found, an empty list is returned.
*
* @param int $countryCallingCode
* @return array
*/
private function getRegionCodesForCountryCode($countryCallingCode)
{
if (!array_key_exists($countryCallingCode, $this->countryCallingCodeToRegionCodeMap)) {
$regionCodes = null;
} else {
$regionCodes = $this->countryCallingCodeToRegionCodeMap[$countryCallingCode];
}
return ($regionCodes === null) ? array() : $regionCodes;
}
/**
* Helper method to check that the country calling code of the number matches the region it's
* being dialed from.
* @param PhoneNumber $number
* @param string $regionDialingFrom
* @return bool
*/
private function regionDialingFromMatchesNumber(PhoneNumber $number, $regionDialingFrom)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
return in_array($regionDialingFrom, $regionCodes);
}
public function getSupportedRegions()
{
return ShortNumbersRegionCodeSet::$shortNumbersRegionCodeSet;
}
/**
* Gets a valid short number for the specified region.
*
* @param $regionCode String the region for which an example short number is needed
* @return string a valid short number for the specified region. Returns an empty string when the
* metadata does not contain such information.
*/
public function getExampleShortNumber($regionCode)
{
$phoneMetadata = $this->getMetadataForRegion($regionCode);
if ($phoneMetadata === null) {
return "";
}
/** @var PhoneNumberDesc $desc */
$desc = $phoneMetadata->getShortCode();
if ($desc !== null && $desc->hasExampleNumber()) {
return $desc->getExampleNumber();
}
return "";
}
/**
* @param $regionCode
* @return PhoneMetadata|null
*/
public function getMetadataForRegion($regionCode)
{
if (!in_array($regionCode, ShortNumbersRegionCodeSet::$shortNumbersRegionCodeSet)) {
return null;
}
if (!isset($this->regionToMetadataMap[$regionCode])) {
// The regionCode here will be valid and won't be '001', so we don't need to worry about
// what to pass in for the country calling code.
$this->loadMetadataFromFile($this->currentFilePrefix, $regionCode, 0);
}
return isset($this->regionToMetadataMap[$regionCode]) ? $this->regionToMetadataMap[$regionCode] : null;
}
private function loadMetadataFromFile($filePrefix, $regionCode, $countryCallingCode)
{
$isNonGeoRegion = PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY === $regionCode;
$fileName = $filePrefix . '_' . ($isNonGeoRegion ? $countryCallingCode : $regionCode) . '.php';
if (!is_readable($fileName)) {
throw new \Exception('missing metadata: ' . $fileName);
} else {
$data = include $fileName;
$metadata = new PhoneMetadata();
$metadata->fromArray($data);
if ($isNonGeoRegion) {
$this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode] = $metadata;
} else {
$this->regionToMetadataMap[$regionCode] = $metadata;
}
}
}
/**
* Gets a valid short number for the specified cost category.
*
* @param string $regionCode the region for which an example short number is needed
* @param int $cost the cost category of number that is needed
* @return string a valid short number for the specified region and cost category. Returns an empty string
* when the metadata does not contain such information, or the cost is UNKNOWN_COST.
*/
public function getExampleShortNumberForCost($regionCode, $cost)
{
$phoneMetadata = $this->getMetadataForRegion($regionCode);
if ($phoneMetadata === null) {
return "";
}
/** @var PhoneNumberDesc $desc */
$desc = null;
switch ($cost) {
case ShortNumberCost::TOLL_FREE:
$desc = $phoneMetadata->getTollFree();
break;
case ShortNumberCost::STANDARD_RATE:
$desc = $phoneMetadata->getStandardRate();
break;
case ShortNumberCost::PREMIUM_RATE:
$desc = $phoneMetadata->getPremiumRate();
break;
default:
// UNKNOWN_COST numbers are computed by the process of elimination from the other cost categories
break;
}
if ($desc !== null && $desc->hasExampleNumber()) {
return $desc->getExampleNumber();
}
return "";
}
/**
* Returns true if the given number, exactly as dialed, might be used to connect to an emergency
* service in the given region.
* <p>
* This method accepts a string, rather than a PhoneNumber, because it needs to distinguish
* cases such as "+1 911" and "911", where the former may not connect to an emergency service in
* all cases but the latter would. This method takes into account cases where the number might
* contain formatting, or might have additional digits appended (when it is okay to do that in
* the specified region).
*
* @param string $number the phone number to test
* @param string $regionCode the region where the phone number if being dialled
* @return boolean whether the number might be used to connect to an emergency service in the given region
*/
public function connectsToEmergencyNumber($number, $regionCode)
{
return $this->matchesEmergencyNumberHelper($number, $regionCode, true /* allows prefix match */);
}
/**
* @param string $number
* @param string $regionCode
* @param bool $allowPrefixMatch
* @return bool
*/
private function matchesEmergencyNumberHelper($number, $regionCode, $allowPrefixMatch)
{
$number = PhoneNumberUtil::extractPossibleNumber($number);
$matcher = new Matcher(PhoneNumberUtil::$PLUS_CHARS_PATTERN, $number);
if ($matcher->lookingAt()) {
// Returns false if the number starts with a plus sign. We don't believe dialing the country
// code before emergency numbers (e.g. +1911) works, but later, if that proves to work, we can
// add additional logic here to handle it.
return false;
}
$metadata = $this->getMetadataForRegion($regionCode);
if ($metadata === null || !$metadata->hasEmergency()) {
return false;
}
$normalizedNumber = PhoneNumberUtil::normalizeDigitsOnly($number);
$emergencyDesc = $metadata->getEmergency();
$allowPrefixMatchForRegion = ($allowPrefixMatch
&& !in_array($regionCode, self::$regionsWhereEmergencyNumbersMustBeExact)
);
return $this->matcherAPI->matchesNationalNumber($normalizedNumber, $emergencyDesc, $allowPrefixMatchForRegion);
}
/**
* Given a valid short number, determines whether it is carrier-specific (however, nothing is
* implied about its validity). If it is important that the number is valid, then its validity
* must first be checked using {@link isValidShortNumber} or
* {@link #isValidShortNumberForRegion}.
*
* @param PhoneNumber $number the valid short number to check
* @return boolean whether the short number is carrier-specific (assuming the input was a valid short
* number).
*/
public function isCarrierSpecific(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
$regionCode = $this->getRegionCodeForShortNumberFromRegionList($number, $regionCodes);
$nationalNumber = $this->getNationalSignificantNumber($number);
$phoneMetadata = $this->getMetadataForRegion($regionCode);
return ($phoneMetadata !== null) && ($this->matchesPossibleNumberAndNationalNumber(
$nationalNumber,
$phoneMetadata->getCarrierSpecific()
));
}
/**
* Helper method to get the region code for a given phone number, from a list of possible region
* codes. If the list contains more than one region, the first region for which the number is
* valid is returned.
*
* @param PhoneNumber $number
* @param $regionCodes
* @return String|null Region Code (or null if none are found)
*/
private function getRegionCodeForShortNumberFromRegionList(PhoneNumber $number, $regionCodes)
{
if (count($regionCodes) == 0) {
return null;
} elseif (count($regionCodes) == 1) {
return $regionCodes[0];
}
$nationalNumber = $this->getNationalSignificantNumber($number);
foreach ($regionCodes as $regionCode) {
$phoneMetadata = $this->getMetadataForRegion($regionCode);
if ($phoneMetadata !== null
&& $this->matchesPossibleNumberAndNationalNumber($nationalNumber, $phoneMetadata->getShortCode())
) {
// The number is valid for this region.
return $regionCode;
}
}
return null;
}
/**
* Check whether a short number is a possible number. If a country calling code is shared by
* multiple regions, this returns true if it's possible in any of them. This provides a more
* lenient check than {@link #isValidShortNumber}. See {@link
* #IsPossibleShortNumberForRegion(PhoneNumber, String)} for details.
*
* @param $number PhoneNumber the short number to check
* @return boolean whether the number is a possible short number
*/
public function isPossibleShortNumber(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
$shortNumber = $this->getNationalSignificantNumber($number);
foreach ($regionCodes as $region) {
$phoneMetadata = $this->getMetadataForRegion($region);
if ($phoneMetadata === null) {
continue;
}
if ($this->matcherAPI->matchesPossibleNumber($shortNumber, $phoneMetadata->getGeneralDesc())) {
return true;
}
}
return false;
}
/**
* Check whether a short number is a possible number when dialled from a region, given the number
* in the form of a string, and the region where the number is dialled from. This provides a more
* lenient check than {@link #isValidShortNumber}.
*
* @param PhoneNumber|string $shortNumber The short number to check
* @param string $regionDialingFrom Region dialing From
* @return boolean whether the number is a possible short number
*/
public function isPossibleShortNumberForRegion($shortNumber, $regionDialingFrom)
{
if ($shortNumber instanceof PhoneNumber) {
if (!$this->regionDialingFromMatchesNumber($shortNumber, $regionDialingFrom)) {
return false;
}
}
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
if ($phoneMetadata === null) {
return false;
}
if ($shortNumber instanceof PhoneNumber) {
return $this->matcherAPI->matchesPossibleNumber(
$this->getNationalSignificantNumber($shortNumber),
$phoneMetadata->getGeneralDesc()
);
} else {
/**
* @deprecated Anyone who was using it and passing in a string with whitespace (or other
* formatting characters) would have been getting the wrong result. You should parse
* the string to PhoneNumber and use the method
* {@code #isPossibleShortNumberForRegion(PhoneNumber, String)}. This method will be
* removed in the next release.
*/
return $this->matcherAPI->matchesPossibleNumber($shortNumber, $phoneMetadata->getGeneralDesc());
}
}
/**
* Tests whether a short number matches a valid pattern. If a country calling code is shared by
* multiple regions, this returns true if it's valid in any of them. Note that this doesn't verify
* the number is actually in use, which is impossible to tell by just looking at the number
* itself. See {@link #isValidShortNumberForRegion(PhoneNumber, String)} for details.
*
* @param $number PhoneNumber the short number for which we want to test the validity
* @return boolean whether the short number matches a valid pattern
*/
public function isValidShortNumber(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
$regionCode = $this->getRegionCodeForShortNumberFromRegionList($number, $regionCodes);
if (count($regionCodes) > 1 && $regionCode !== null) {
// If a matching region had been found for the phone number from among two or more regions,
// then we have already implicitly verified its validity for that region.
return true;
}
return $this->isValidShortNumberForRegion($number, $regionCode);
}
/**
* Tests whether a short number matches a valid pattern in a region. Note that this doesn't verify
* the number is actually in use, which is impossible to tell by just looking at the number
* itself.
*
* @param PhoneNumber|string $number The Short number for which we want to test the validity
* @param string $regionDialingFrom the region from which the number is dialed
* @return boolean whether the short number matches a valid pattern
*/
public function isValidShortNumberForRegion($number, $regionDialingFrom)
{
if ($number instanceof PhoneNumber) {
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return false;
}
}
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
if ($phoneMetadata === null) {
return false;
}
if ($number instanceof PhoneNumber) {
$shortNumber = $this->getNationalSignificantNumber($number);
} else {
/**
* @deprecated Anyone who was using it and passing in a string with whitespace (or other
* formatting characters) would have been getting the wrong result. You should parse
* the string to PhoneNumber and use the method
* {@code #isValidShortNumberForRegion(PhoneNumber, String)}. This method will be
* removed in the next release.
*/
$shortNumber = $number;
}
$generalDesc = $phoneMetadata->getGeneralDesc();
if (!$this->matchesPossibleNumberAndNationalNumber($shortNumber, $generalDesc)) {
return false;
}
$shortNumberDesc = $phoneMetadata->getShortCode();
return $this->matchesPossibleNumberAndNationalNumber($shortNumber, $shortNumberDesc);
}
/**
* Gets the expected cost category of a short number when dialled from a region (however, nothing is
* implied about its validity). If it is important that the number is valid, then its validity
* must first be checked using {@link isValidShortNumberForRegion}. Note that emergency numbers
* are always considered toll-free.
* Example usage:
* <pre>{@code
* $shortInfo = ShortNumberInfo::getInstance();
* $shortNumber = "110";
* $regionCode = "FR";
* if ($shortInfo->isValidShortNumberForRegion($shortNumber, $regionCode)) {
* $cost = $shortInfo->getExpectedCostForRegion($shortNumber, $regionCode);
* // Do something with the cost information here.
* }}</pre>
*
* @param PhoneNumber|string $number the short number for which we want to know the expected cost category,
* as a string
* @param string $regionDialingFrom the region from which the number is dialed
* @return int the expected cost category for that region of the short number. Returns UNKNOWN_COST if
* the number does not match a cost category. Note that an invalid number may match any cost
* category.
*/
public function getExpectedCostForRegion($number, $regionDialingFrom)
{
if ($number instanceof PhoneNumber) {
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return ShortNumberCost::UNKNOWN_COST;
}
}
// Note that regionDialingFrom may be null, in which case phoneMetadata will also be null.
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
if ($phoneMetadata === null) {
return ShortNumberCost::UNKNOWN_COST;
}
if ($number instanceof PhoneNumber) {
$shortNumber = $this->getNationalSignificantNumber($number);
} else {
/**
* @deprecated Anyone who was using it and passing in a string with whitespace (or other
* formatting characters) would have been getting the wrong result. You should parse
* the string to PhoneNumber and use the method
* {@code #getExpectedCostForRegion(PhoneNumber, String)}. This method will be
* removed in the next release.
*/
$shortNumber = $number;
}
// The cost categories are tested in order of decreasing expense, since if for some reason the
// patterns overlap the most expensive matching cost category should be returned.
if ($this->matchesPossibleNumberAndNationalNumber($shortNumber, $phoneMetadata->getPremiumRate())) {
return ShortNumberCost::PREMIUM_RATE;
}
if ($this->matchesPossibleNumberAndNationalNumber($shortNumber, $phoneMetadata->getStandardRate())) {
return ShortNumberCost::STANDARD_RATE;
}
if ($this->matchesPossibleNumberAndNationalNumber($shortNumber, $phoneMetadata->getTollFree())) {
return ShortNumberCost::TOLL_FREE;
}
if ($this->isEmergencyNumber($shortNumber, $regionDialingFrom)) {
// Emergency numbers are implicitly toll-free.
return ShortNumberCost::TOLL_FREE;
}
return ShortNumberCost::UNKNOWN_COST;
}
/**
* Gets the expected cost category of a short number (however, nothing is implied about its
* validity). If the country calling code is unique to a region, this method behaves exactly the
* same as {@link #getExpectedCostForRegion(PhoneNumber, String)}. However, if the country calling
* code is shared by multiple regions, then it returns the highest cost in the sequence
* PREMIUM_RATE, UNKNOWN_COST, STANDARD_RATE, TOLL_FREE. The reason for the position of
* UNKNOWN_COST in this order is that if a number is UNKNOWN_COST in one region but STANDARD_RATE
* or TOLL_FREE in another, its expected cost cannot be estimated as one of the latter since it
* might be a PREMIUM_RATE number.
*
* <p>
* For example, if a number is STANDARD_RATE in the US, but TOLL_FREE in Canada, the expected
* cost returned by this method will be STANDARD_RATE, since the NANPA countries share the same
* country calling code.
* </p>
*
* Note: If the region from which the number is dialed is known, it is highly preferable to call
* {@link #getExpectedCostForRegion(PhoneNumber, String)} instead.
*
* @param PhoneNumber $number the short number for which we want to know the expected cost category
* @return int the highest expected cost category of the short number in the region(s) with the given
* country calling code
*/
public function getExpectedCost(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
if (count($regionCodes) == 0) {
return ShortNumberCost::UNKNOWN_COST;
}
if (count($regionCodes) == 1) {
return $this->getExpectedCostForRegion($number, $regionCodes[0]);
}
$cost = ShortNumberCost::TOLL_FREE;
foreach ($regionCodes as $regionCode) {
$costForRegion = $this->getExpectedCostForRegion($number, $regionCode);
switch ($costForRegion) {
case ShortNumberCost::PREMIUM_RATE:
return ShortNumberCost::PREMIUM_RATE;
case ShortNumberCost::UNKNOWN_COST:
$cost = ShortNumberCost::UNKNOWN_COST;
break;
case ShortNumberCost::STANDARD_RATE:
if ($cost != ShortNumberCost::UNKNOWN_COST) {
$cost = ShortNumberCost::STANDARD_RATE;
}
break;
case ShortNumberCost::TOLL_FREE:
// Do nothing
break;
}
}
return $cost;
}
/**
* Returns true if the given number exactly matches an emergency service number in the given
* region.
* <p>
* This method takes into account cases where the number might contain formatting, but doesn't
* allow additional digits to be appended. Note that {@code isEmergencyNumber(number, region)}
* implies {@code connectsToEmergencyNumber(number, region)}.
*
* @param string $number the phone number to test
* @param string $regionCode the region where the phone number is being dialled
* @return boolean whether the number exactly matches an emergency services number in the given region
*/
public function isEmergencyNumber($number, $regionCode)
{
return $this->matchesEmergencyNumberHelper($number, $regionCode, false /* doesn't allow prefix match */);
}
/**
* Gets the national significant number of the a phone number. Note a national significant number
* doesn't contain a national prefix or any formatting.
* <p>
* This is a temporary duplicate of the {@code getNationalSignificantNumber} method from
* {@code PhoneNumberUtil}. Ultimately a canonical static version should exist in a separate
* utility class (to prevent {@code ShortNumberInfo} needing to depend on PhoneNumberUtil).
*
* @param PhoneNumber $number the phone number for which the national significant number is needed
* @return string the national significant number of the PhoneNumber object passed in
*/
private function getNationalSignificantNumber(PhoneNumber $number)
{
// If leading zero(s) have been set, we prefix this now. Note this is not a national prefix.
$nationalNumber = '';
if ($number->isItalianLeadingZero()) {
$zeros = str_repeat('0', $number->getNumberOfLeadingZeros());
$nationalNumber .= $zeros;
}
$nationalNumber .= $number->getNationalNumber();
return $nationalNumber;
}
/**
* // TODO: Once we have benchmarked ShortnumberInfo, consider if it is worth keeping
* this performance optimization, and if so move this into the matcher implementation
* @param string $number
* @param PhoneNumberDesc $numberDesc
* @return bool
*/
private function matchesPossibleNumberAndNationalNumber($number, PhoneNumberDesc $numberDesc)
{
return ($this->matcherAPI->matchesPossibleNumber($number, $numberDesc)
&& $this->matcherAPI->matchesNationalNumber($number, $numberDesc, false));
}
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* Utility for international short phone numbers, such as short codes and emergency numbers.
* Note most commercial short numbers are not handled here, but by the PhoneNumberUtil
*
* @author Shaopeng Jia
* @author David Yonge-Mallo
* @deprecated As of release 5.8, replaced by ShortNumberInfo.
*/
namespace libphonenumber;
/**
* Class ShortNumberUtil
* @package libphonenumber
* @deprecated As of release 5.8, replaced by ShortNumberInfo.
*/
class ShortNumberUtil
{
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
public function __construct(PhoneNumberUtil $phoneNumberUtil = null)
{
$this->phoneUtil = $phoneNumberUtil;
}
public function getSupportedRegions()
{
return ShortNumberInfo::getInstance($this->phoneUtil)->getSupportedRegions();
}
/**
* Returns true if the number might be used to connect to an emergency service in the given
* region.
*
* This method takes into account cases where the number might contain formatting, or might have
* additional digits appended (when it is okay to do that in the region specified).
*
* @param $number String the phone number to test
* @param $regionCode String the region where the phone number is being dialed
* @return boolean if the number might be used to connect to an emergency service in the given region.
*/
public function connectsToEmergencyNumber($number, $regionCode)
{
return ShortNumberInfo::getInstance($this->phoneUtil)->connectsToEmergencyNumber($number, $regionCode);
}
/**
* Returns true if the number exactly matches an emergency service number in the given region.
*
* This method takes into account cases where the number might contain formatting, but doesn't
* allow additional digits to be appended.
*
* @param $number String The phone number to test
* @param $regionCode String The region where the phone number is being dialed
* @return boolean if the number exactly matches an emergency services number in the given region.
*/
public function isEmergencyNumber($number, $regionCode)
{
return ShortNumberInfo::getInstance($this->phoneUtil)->isEmergencyNumber($number, $regionCode);
}
}

View File

@@ -0,0 +1,254 @@
<?php
/**
* This file is automatically @generated by {@link BuildMetadataPHPFromXml}.
* Please don't modify it directly.
*/
namespace libphonenumber;
class ShortNumbersRegionCodeSet {
// A set of all region codes for which data is available.
public static $shortNumbersRegionCodeSet = array (
0 => 'AC',
1 => 'AD',
2 => 'AE',
3 => 'AF',
4 => 'AG',
5 => 'AI',
6 => 'AL',
7 => 'AM',
8 => 'AO',
9 => 'AR',
10 => 'AS',
11 => 'AT',
12 => 'AU',
13 => 'AW',
14 => 'AX',
15 => 'AZ',
16 => 'BA',
17 => 'BB',
18 => 'BD',
19 => 'BE',
20 => 'BF',
21 => 'BG',
22 => 'BH',
23 => 'BI',
24 => 'BJ',
25 => 'BL',
26 => 'BM',
27 => 'BN',
28 => 'BO',
29 => 'BQ',
30 => 'BR',
31 => 'BS',
32 => 'BT',
33 => 'BW',
34 => 'BY',
35 => 'BZ',
36 => 'CA',
37 => 'CC',
38 => 'CD',
39 => 'CF',
40 => 'CG',
41 => 'CH',
42 => 'CI',
43 => 'CK',
44 => 'CL',
45 => 'CM',
46 => 'CN',
47 => 'CO',
48 => 'CR',
49 => 'CU',
50 => 'CV',
51 => 'CW',
52 => 'CX',
53 => 'CY',
54 => 'CZ',
55 => 'DE',
56 => 'DJ',
57 => 'DK',
58 => 'DM',
59 => 'DO',
60 => 'DZ',
61 => 'EC',
62 => 'EE',
63 => 'EG',
64 => 'EH',
65 => 'ER',
66 => 'ES',
67 => 'ET',
68 => 'FI',
69 => 'FJ',
70 => 'FK',
71 => 'FM',
72 => 'FO',
73 => 'FR',
74 => 'GA',
75 => 'GB',
76 => 'GD',
77 => 'GE',
78 => 'GF',
79 => 'GG',
80 => 'GH',
81 => 'GI',
82 => 'GL',
83 => 'GM',
84 => 'GN',
85 => 'GP',
86 => 'GR',
87 => 'GT',
88 => 'GU',
89 => 'GW',
90 => 'GY',
91 => 'HK',
92 => 'HN',
93 => 'HR',
94 => 'HT',
95 => 'HU',
96 => 'ID',
97 => 'IE',
98 => 'IL',
99 => 'IM',
100 => 'IN',
101 => 'IQ',
102 => 'IR',
103 => 'IS',
104 => 'IT',
105 => 'JE',
106 => 'JM',
107 => 'JO',
108 => 'JP',
109 => 'KE',
110 => 'KG',
111 => 'KH',
112 => 'KI',
113 => 'KM',
114 => 'KN',
115 => 'KP',
116 => 'KR',
117 => 'KW',
118 => 'KY',
119 => 'KZ',
120 => 'LA',
121 => 'LB',
122 => 'LC',
123 => 'LI',
124 => 'LK',
125 => 'LR',
126 => 'LS',
127 => 'LT',
128 => 'LU',
129 => 'LV',
130 => 'LY',
131 => 'MA',
132 => 'MC',
133 => 'MD',
134 => 'ME',
135 => 'MF',
136 => 'MG',
137 => 'MH',
138 => 'MK',
139 => 'ML',
140 => 'MM',
141 => 'MN',
142 => 'MO',
143 => 'MP',
144 => 'MQ',
145 => 'MR',
146 => 'MS',
147 => 'MT',
148 => 'MU',
149 => 'MV',
150 => 'MW',
151 => 'MX',
152 => 'MY',
153 => 'MZ',
154 => 'NA',
155 => 'NC',
156 => 'NE',
157 => 'NF',
158 => 'NG',
159 => 'NI',
160 => 'NL',
161 => 'NO',
162 => 'NP',
163 => 'NR',
164 => 'NU',
165 => 'NZ',
166 => 'OM',
167 => 'PA',
168 => 'PE',
169 => 'PF',
170 => 'PG',
171 => 'PH',
172 => 'PK',
173 => 'PL',
174 => 'PM',
175 => 'PR',
176 => 'PT',
177 => 'PW',
178 => 'PY',
179 => 'QA',
180 => 'RE',
181 => 'RO',
182 => 'RS',
183 => 'RU',
184 => 'RW',
185 => 'SA',
186 => 'SB',
187 => 'SC',
188 => 'SD',
189 => 'SE',
190 => 'SG',
191 => 'SH',
192 => 'SI',
193 => 'SJ',
194 => 'SK',
195 => 'SL',
196 => 'SM',
197 => 'SN',
198 => 'SO',
199 => 'SR',
200 => 'ST',
201 => 'SV',
202 => 'SX',
203 => 'SY',
204 => 'SZ',
205 => 'TC',
206 => 'TD',
207 => 'TG',
208 => 'TH',
209 => 'TJ',
210 => 'TL',
211 => 'TM',
212 => 'TN',
213 => 'TO',
214 => 'TR',
215 => 'TT',
216 => 'TV',
217 => 'TW',
218 => 'TZ',
219 => 'UA',
220 => 'UG',
221 => 'US',
222 => 'UY',
223 => 'UZ',
224 => 'VA',
225 => 'VC',
226 => 'VE',
227 => 'VG',
228 => 'VI',
229 => 'VN',
230 => 'VU',
231 => 'WF',
232 => 'WS',
233 => 'YE',
234 => 'YT',
235 => 'ZA',
236 => 'ZM',
237 => 'ZW',
);
}

View File

@@ -0,0 +1,14 @@
<?php
namespace libphonenumber;
/**
* Possible outcomes when testing if a PhoneNumber is possible.
*/
class ValidationResult
{
const IS_POSSIBLE = 0;
const INVALID_COUNTRY_CODE = 1;
const TOO_SHORT = 2;
const TOO_LONG = 3;
}

View File

@@ -0,0 +1,225 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
'ar' =>
array (
0 => 965,
),
'be' =>
array (
0 => 375,
),
'en' =>
array (
0 => 1242,
1 => 1246,
2 => 1264,
3 => 1441,
4 => 1473,
5 => 1649,
6 => 1671,
7 => 1684,
8 => 1758,
9 => 1767,
10 => 1784,
11 => 1787,
12 => 1809,
13 => 1868,
14 => 1869,
15 => 1876,
16 => 1939,
17 => 20,
18 => 211,
19 => 212,
20 => 213,
21 => 216,
22 => 220,
23 => 221,
24 => 222,
25 => 223,
26 => 224,
27 => 225,
28 => 226,
29 => 227,
30 => 228,
31 => 229,
32 => 230,
33 => 231,
34 => 232,
35 => 233,
36 => 234,
37 => 235,
38 => 236,
39 => 237,
40 => 238,
41 => 239,
42 => 240,
43 => 241,
44 => 242,
45 => 243,
46 => 244,
47 => 245,
48 => 248,
49 => 249,
50 => 250,
51 => 251,
52 => 252,
53 => 253,
54 => 254,
55 => 255,
56 => 256,
57 => 257,
58 => 258,
59 => 260,
60 => 261,
61 => 263,
62 => 265,
63 => 267,
64 => 268,
65 => 27,
66 => 297,
67 => 298,
68 => 299,
69 => 30,
70 => 31,
71 => 32,
72 => 33,
73 => 350,
74 => 351,
75 => 352,
76 => 353,
77 => 354,
78 => 355,
79 => 356,
80 => 357,
81 => 358,
82 => 359,
83 => 36,
84 => 370,
85 => 372,
86 => 373,
87 => 374,
88 => 375,
89 => 376,
90 => 380,
91 => 381,
92 => 385,
93 => 386,
94 => 387,
95 => 389,
96 => 39,
97 => 40,
98 => 41,
99 => 420,
100 => 421,
101 => 43,
102 => 45,
103 => 47,
104 => 48,
105 => 49,
106 => 501,
107 => 505,
108 => 506,
109 => 507,
110 => 509,
111 => 51,
112 => 53,
113 => 54,
114 => 55,
115 => 56,
116 => 57,
117 => 58,
118 => 591,
119 => 592,
120 => 595,
121 => 597,
122 => 598,
123 => 599,
124 => 60,
125 => 61,
126 => 62,
127 => 63,
128 => 64,
129 => 65,
130 => 66,
131 => 670,
132 => 673,
133 => 675,
134 => 676,
135 => 677,
136 => 678,
137 => 679,
138 => 685,
139 => 686,
140 => 689,
141 => 7,
142 => 84,
143 => 852,
144 => 855,
145 => 856,
146 => 86130,
147 => 86131,
148 => 86132,
149 => 86133,
150 => 86134,
151 => 86135,
152 => 86136,
153 => 86137,
154 => 86138,
155 => 86139,
156 => 86150,
157 => 86151,
158 => 86153,
159 => 86156,
160 => 86157,
161 => 86158,
162 => 86159,
163 => 86176,
164 => 86177,
165 => 86178,
166 => 86180,
167 => 86185,
168 => 86186,
169 => 86187,
170 => 86188,
171 => 86189,
172 => 880,
173 => 90,
174 => 91,
175 => 92,
176 => 93,
177 => 94,
178 => 95,
179 => 960,
180 => 961,
181 => 962,
182 => 964,
183 => 965,
184 => 966,
185 => 967,
186 => 968,
187 => 970,
188 => 971,
189 => 972,
190 => 973,
191 => 974,
192 => 975,
193 => 976,
194 => 977,
195 => 98,
196 => 992,
197 => 993,
198 => 994,
199 => 995,
200 => 996,
201 => 998,
),
'ru' =>
array (
0 => 375,
),
);

View File

@@ -0,0 +1,11 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
9655 => 'فيفا',
9656 => 'الوطنية',
9659 => 'زين',
);

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
37525 => 'БеСТ',
375291 => 'Velcom',
375292 => 'МТС',
375293 => 'Velcom',
375294 => 'БелСел',
375295 => 'МТС',
375296 => 'Velcom',
375297 => 'МТС',
375298 => 'МТС',
375299 => 'Velcom',
37533 => 'МТС',
37544 => 'Velcom',
);

View File

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

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
124623 => 'LIME',
124624 => 'LIME',
1246250 => 'LIME',
1246251 => 'LIME',
1246252 => 'LIME',
1246253 => 'LIME',
1246254 => 'LIME',
1246256 => 'Digicel',
1246258 => 'Digicel',
124626 => 'Digicel',
124645 => 'Sunbeach Communications',
124682 => 'Digicel',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1264536 => 'Weblinks Limited',
1264537 => 'Weblinks Limited',
1264538 => 'Weblinks Limited',
1264539 => 'Weblinks Limited',
1264581 => 'Digicel',
1264582 => 'Digicel',
1264583 => 'Digicel',
1264584 => 'Digicel',
1264729 => 'Cable & Wireless',
1264772 => 'Cable & Wireless',
);

View File

@@ -0,0 +1,14 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
14413 => 'Mobility',
1441500 => 'Digicel Bermuda',
1441539 => 'Digicel Bermuda',
1441590 => 'Digicel Bermuda',
1441599 => 'Digicel Bermuda',
14417 => 'Cellular One',
);

View File

@@ -0,0 +1,15 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1473402 => 'Affordable Island Communications',
147341 => 'Digicel Grenada',
1473420 => 'Digicel Grenada',
1473520 => 'Affordable Island Communications',
1473521 => 'Affordable Island Communications',
147353 => 'AWS Grenada',
1473901 => 'Affordable Island Communications',
);

View File

@@ -0,0 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
164923 => 'C&W',
164924 => 'C&W',
164933 => 'DIGICEL',
164934 => 'DIGICEL',
164943 => 'Islandcom',
);

View File

@@ -0,0 +1,15 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1671838 => 'i CAN_GSM',
1671848 => 'i CAN_GSM',
1671858 => 'i CAN_GSM',
1671868 => 'Choice Phone',
1671878 => 'Choice Phone',
1671888 => 'Choice Phone',
1671898 => 'Choice Phone',
);

View File

@@ -0,0 +1,16 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1684252 => 'Blue Sky',
1684254 => 'Blue Sky',
1684256 => 'Blue Sky',
1684258 => 'Blue Sky',
1684272 => 'Blue Sky',
1684731 => 'ASTCA',
1684733 => 'ASTCA',
1684770 => 'ASTCA',
);

View File

@@ -0,0 +1,22 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
175828 => 'Cable & Wireless',
1758384 => 'Cable & Wireless',
1758460 => 'Cable & Wireless',
1758461 => 'Cable & Wireless',
1758484 => 'Cable & Wireless',
1758485 => 'Cable & Wireless',
1758486 => 'Cable & Wireless',
1758487 => 'Cable & Wireless',
1758488 => 'Cable & Wireless',
1758489 => 'Cable & Wireless',
175851 => 'AT&T',
175852 => 'AT&T',
1758584 => 'Cable & Wireless',
17587 => 'Digicel',
);

View File

@@ -0,0 +1,26 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1767315 => 'Digicel',
1767316 => 'Digicel',
1767317 => 'Digicel',
1767225 => 'Cable & Wireless',
1767235 => 'Cable & Wireless',
1767245 => 'Cable & Wireless',
1767265 => 'Cable & Wireless',
1767275 => 'Cable & Wireless',
1767276 => 'Cable & Wireless',
1767277 => 'Cable & Wireless',
1767285 => 'Cable & Wireless',
1767295 => 'Cable & Wireless',
1767612 => 'Digicel',
1767613 => 'Digicel',
1767614 => 'Digicel',
1767615 => 'Digicel',
1767616 => 'Digicel',
1767617 => 'Digicel',
);

View File

@@ -0,0 +1,31 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1784430 => 'AT&T',
1784431 => 'AT&T',
1784432 => 'AT&T',
1784433 => 'Digicel',
1784434 => 'Digicel',
1784454 => 'Cable & Wireless',
1784455 => 'Cable & Wireless',
1784489 => 'Cable & Wireless',
1784490 => 'Cable & Wireless',
1784491 => 'Cable & Wireless',
1784492 => 'Cable & Wireless',
1784493 => 'Cable & Wireless',
1784494 => 'Cable & Wireless',
1784495 => 'Cable & Wireless',
1784526 => 'Digicel',
1784527 => 'Digicel',
1784528 => 'Digicel',
1784529 => 'Digicel',
1784530 => 'Digicel',
1784531 => 'Digicel',
1784532 => 'Digicel',
1784533 => 'Digicel',
1784534 => 'Digicel',
);

View File

@@ -0,0 +1,210 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1787203 => 'Claro',
1787210 => 'SunCom Wireless Puerto Rico',
1787212 => 'Claro',
1787213 => 'Claro',
1787214 => 'Claro',
1787215 => 'Claro',
1787216 => 'Claro',
1787217 => 'Claro',
1787218 => 'Claro',
1787219 => 'Claro',
1787220 => 'CENTENNIAL',
1787221 => 'CENTENNIAL',
1787222 => 'CENTENNIAL',
1787223 => 'CENTENNIAL',
1787224 => 'CENTENNIAL',
1787225 => 'SunCom Wireless Puerto Rico',
1787226 => 'SunCom Wireless Puerto Rico',
1787227 => 'CENTENNIAL',
1787229 => 'CENTENNIAL',
1787253 => 'Claro',
1787254 => 'Claro',
1787255 => 'Claro',
1787256 => 'Claro',
1787257 => 'Claro',
1787258 => 'Claro',
1787259 => 'Claro',
1787260 => 'Claro',
1787291 => 'CENTENNIAL',
1787299 => 'SunCom Wireless Puerto Rico',
1787300 => 'CENTENNIAL',
1787310 => 'SunCom Wireless Puerto Rico',
1787312 => 'Claro',
1787313 => 'Claro',
1787314 => 'Claro',
1787315 => 'Claro',
1787316 => 'Claro',
1787317 => 'Claro',
1787318 => 'Claro',
17873191 => 'Claro',
17873192 => 'Claro',
17873193 => 'Claro',
17873194 => 'Claro',
17873195 => 'Claro',
17873196 => 'Claro',
17873197 => 'Claro',
17873198 => 'Claro',
17873199 => 'Claro',
1787341 => 'SunCom Wireless Puerto Rico',
1787344 => 'SunCom Wireless Puerto Rico',
1787346 => 'SunCom Wireless Puerto Rico',
1787355 => 'CENTENNIAL',
1787357 => 'CENTENNIAL',
1787359 => 'SunCom Wireless Puerto Rico',
1787367 => 'SunCom Wireless Puerto Rico',
1787368 => 'SunCom Wireless Puerto Rico',
1787369 => 'CENTENNIAL',
1787371 => 'Claro',
1787372 => 'Claro',
1787374 => 'Claro',
1787375 => 'Claro',
1787376 => 'Claro',
1787380 => 'Claro',
1787381 => 'Claro',
1787382 => 'Claro',
1787383 => 'Claro',
1787384 => 'Claro',
1787385 => 'Claro',
1787389 => 'Claro',
1787390 => 'Claro',
1787391 => 'Claro',
1787392 => 'Claro',
1787400 => 'CENTENNIAL',
1787410 => 'SunCom Wireless Puerto Rico',
1787434 => 'CENTENNIAL',
1787447 => 'CENTENNIAL',
1787448 => 'CENTENNIAL',
1787449 => 'CENTENNIAL',
1787450 => 'Claro',
1787453 => 'Claro',
1787454 => 'SunCom Wireless Puerto Rico',
1787458 => 'SunCom Wireless Puerto Rico',
1787459 => 'SunCom Wireless Puerto Rico',
1787460 => 'SunCom Wireless Puerto Rico',
1787462 => 'SunCom Wireless Puerto Rico',
1787463 => 'SunCom Wireless Puerto Rico',
1787465 => 'CENTENNIAL',
1787466 => 'SunCom Wireless Puerto Rico',
1787471 => 'CENTENNIAL',
1787473 => 'CENTENNIAL',
1787474 => 'CENTENNIAL',
1787478 => 'SunCom Wireless Puerto Rico',
1787479 => 'CENTENNIAL',
1787481 => 'Claro',
1787484 => 'Claro',
1787485 => 'Claro',
1787486 => 'Claro',
1787487 => 'Claro',
1787513 => 'SunCom Wireless Puerto Rico',
1787514 => 'Claro',
1787515 => 'Claro',
1787516 => 'Claro',
1787517 => 'Claro',
1787518 => 'Claro',
1787519 => 'Claro',
1787520 => 'CENTENNIAL',
1787521 => 'CENTENNIAL',
1787522 => 'CENTENNIAL',
1787523 => 'CENTENNIAL',
1787528 => 'SunCom Wireless Puerto Rico',
1787534 => 'CENTENNIAL',
1787535 => 'CENTENNIAL',
1787537 => 'CENTENNIAL',
1787544 => 'CENTENNIAL',
1787545 => 'CENTENNIAL',
1787546 => 'SunCom Wireless Puerto Rico',
1787551 => 'CENTENNIAL',
1787553 => 'Claro',
1787561 => 'CENTENNIAL',
1787563 => 'CENTENNIAL',
1787568 => 'SunCom Wireless Puerto Rico',
1787569 => 'CENTENNIAL',
1787579 => 'Claro',
1787580 => 'CENTENNIAL',
1787585 => 'CENTENNIAL',
1787588 => 'CENTENNIAL',
1787589 => 'CENTENNIAL',
1787595 => 'SunCom Wireless Puerto Rico',
1787597 => 'SunCom Wireless Puerto Rico',
1787598 => 'SunCom Wireless Puerto Rico',
1787601 => 'SunCom Wireless Puerto Rico',
1787602 => 'CENTENNIAL',
1787604 => 'SunCom Wireless Puerto Rico',
1787605 => 'SunCom Wireless Puerto Rico',
1787607 => 'CENTENNIAL',
1787608 => 'CENTENNIAL',
1787609 => 'CENTENNIAL',
1787612 => 'Claro',
1787613 => 'Claro',
1787614 => 'Claro',
1787615 => 'Claro',
1787616 => 'Claro',
1787617 => 'Claro',
1787619 => 'SunCom Wireless Puerto Rico',
1787620 => 'CENTENNIAL',
1787621 => 'CENTENNIAL',
1787622 => 'CENTENNIAL',
1787623 => 'CENTENNIAL',
1787624 => 'CENTENNIAL',
1787625 => 'CENTENNIAL',
1787626 => 'CENTENNIAL',
1787628 => 'CENTENNIAL',
1787629 => 'SunCom Wireless Puerto Rico',
178764 => 'CENTENNIAL',
178765 => 'CENTENNIAL',
1787662 => 'SunCom Wireless Puerto Rico',
1787666 => 'SunCom Wireless Puerto Rico',
1787673 => 'SunCom Wireless Puerto Rico',
1787675 => 'CENTENNIAL',
1787678 => 'SunCom Wireless Puerto Rico',
1787686 => 'CENTENNIAL',
1787687 => 'CENTENNIAL',
1787689 => 'CENTENNIAL',
1787690 => 'CENTENNIAL',
1787692 => 'CENTENNIAL',
1787693 => 'CENTENNIAL',
1787695 => 'CENTENNIAL',
1787717 => 'CENTENNIAL',
1787719 => 'CENTENNIAL',
1787901 => 'SunCom Wireless Puerto Rico',
1787903 => 'CENTENNIAL',
1787904 => 'SunCom Wireless Puerto Rico',
1787908 => 'CENTENNIAL',
1787912 => 'CENTENNIAL',
1787915 => 'CENTENNIAL',
1787916 => 'CENTENNIAL',
1787917 => 'CENTENNIAL',
1787922 => 'SunCom Wireless Puerto Rico',
1787923 => 'SunCom Wireless Puerto Rico',
1787924 => 'CENTENNIAL',
1787926 => 'CENTENNIAL',
1787927 => 'CENTENNIAL',
1787928 => 'CENTENNIAL',
1787933 => 'CENTENNIAL',
1787935 => 'CENTENNIAL',
1787937 => 'CENTENNIAL',
1787940 => 'CENTENNIAL',
1787947 => 'CENTENNIAL',
1787949 => 'SunCom Wireless Puerto Rico',
1787952 => 'CENTENNIAL',
1787953 => 'CENTENNIAL',
1787954 => 'CENTENNIAL',
1787957 => 'CENTENNIAL',
1787961 => 'CENTENNIAL',
1787968 => 'CENTENNIAL',
1787969 => 'CENTENNIAL',
1787971 => 'CENTENNIAL',
1787975 => 'CENTENNIAL',
1787978 => 'CENTENNIAL',
1787992 => 'CENTENNIAL',
1787993 => 'CENTENNIAL',
1787998 => 'CENTENNIAL',
1787999 => 'CENTENNIAL',
);

View File

@@ -0,0 +1,71 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
180920 => 'Tricom',
180922 => 'Claro',
180923 => 'Claro',
180924 => 'Claro',
180925 => 'Claro',
180926 => 'Claro',
180927 => 'Claro',
180928 => 'Claro',
180929 => 'Tricom',
180930 => 'Viva',
180931 => 'Tricom',
180932 => 'Tricom',
180933 => 'Claro',
180934 => 'Tricom',
180935 => 'Claro',
180936 => 'Claro',
180937 => 'Claro',
180938 => 'Claro',
180939 => 'Claro',
180941 => 'Viva',
180942 => 'Claro',
180943 => 'Viva',
180944 => 'Viva',
180945 => 'Claro',
180947 => 'Tricom',
180948 => 'Claro',
180949 => 'Claro',
180951 => 'Claro',
180954 => 'Claro',
180960 => 'Claro',
180962 => 'Tricom',
180963 => 'Tricom',
180964 => 'Tricom',
180965 => 'Tricom',
180967 => 'Claro',
180969 => 'Claro',
180970 => 'Claro',
180971 => 'Claro',
180972 => 'Claro',
180974 => 'Claro',
180975 => 'Claro',
180976 => 'Claro',
180977 => 'Viva',
180978 => 'Claro',
180979 => 'Claro',
180980 => 'Orange',
180981 => 'Viva',
180982 => 'Claro',
180983 => 'Claro',
180984 => 'Orange',
180985 => 'Orange',
180986 => 'Orange',
180987 => 'Tricom',
180988 => 'Orange',
180989 => 'Orange',
180991 => 'Orange',
180992 => 'Tricom',
180993 => 'Tricom',
180994 => 'Tricom',
180995 => 'Claro',
180997 => 'Orange',
180998 => 'Orange',
180999 => 'Tricom',
);

View File

@@ -0,0 +1,15 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
186827 => 'Digicel',
186828 => 'Digicel',
186829 => 'Digicel',
18683 => 'Digicel',
18684 => 'bmobile',
18686 => 'bmobile',
18687 => 'bmobile',
);

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
186955 => 'CariGlobe St. Kitts',
186956 => 'The Cable St. Kitts',
186966 => 'Cable & Wireless',
186976 => 'Digicel',
);

View File

@@ -0,0 +1,16 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
187626 => 'Digicel',
1876503 => 'Digicel',
1876504 => 'Digicel',
1876505 => 'Digicel',
1876506 => 'Digicel',
1876507 => 'Digicel',
1876508 => 'Digicel',
1876509 => 'Digicel',
);

View File

@@ -0,0 +1,67 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
1939201 => 'CENTENNIAL',
1939212 => 'CENTENNIAL',
1939214 => 'CENTENNIAL',
1939240 => 'SunCom Wireless Puerto Rico',
19392410 => 'Claro',
19392411 => 'Claro',
19392412 => 'Claro',
19392413 => 'Claro',
19392414 => 'Claro',
19392415 => 'Claro',
19392416 => 'Claro',
193924199 => 'Claro',
1939242 => 'Claro',
19392433 => 'Claro',
19392434 => 'Claro',
19392435 => 'Claro',
19392436 => 'Claro',
19392437 => 'Claro',
19392438 => 'Claro',
19392439 => 'Claro',
1939244 => 'Claro',
1939245 => 'Claro',
1939246 => 'Claro',
1939247 => 'Claro',
1939248 => 'Claro',
1939249 => 'Claro',
1939250 => 'Claro',
1939251 => 'Claro',
1939252 => 'CENTENNIAL',
1939253 => 'Claro',
1939254 => 'Claro',
1939255 => 'Claro',
1939256 => 'Claro',
1939257 => 'Claro',
1939258 => 'Claro',
1939259 => 'Claro',
1939307 => 'CENTENNIAL',
1939325 => 'SunCom Wireless Puerto Rico',
1939329 => 'CENTENNIAL',
1939334 => 'Claro',
1939339 => 'SunCom Wireless Puerto Rico',
1939394 => 'CENTENNIAL',
1939440 => 'CENTENNIAL',
1939628 => 'CENTENNIAL',
1939630 => 'CENTENNIAL',
1939639 => 'CENTENNIAL',
1939640 => 'CENTENNIAL',
1939642 => 'CENTENNIAL',
1939644 => 'CENTENNIAL',
1939645 => 'CENTENNIAL',
1939697 => 'CENTENNIAL',
1939717 => 'CENTENNIAL',
1939731 => 'CENTENNIAL',
1939777 => 'Claro',
1939865 => 'SunCom Wireless Puerto Rico',
1939891 => 'SunCom Wireless Puerto Rico',
1939910 => 'CENTENNIAL',
1939940 => 'CENTENNIAL',
1939969 => 'CENTENNIAL',
);

View File

@@ -0,0 +1,11 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
2010 => 'Vodafone',
2011 => 'Etisalat',
2012 => 'Mobinil',
);

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
21191 => 'Zain',
21192 => 'MTN',
21195 => 'Vivacell',
21197 => 'Gemtel',
);

View File

@@ -0,0 +1,99 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
212600 => 'Inwi',
212601 => 'Inwi',
212602 => 'Inwi',
212603 => 'Inwi',
212604 => 'Inwi',
212605 => 'Inwi',
212606 => 'Inwi',
212607 => 'Inwi',
212608 => 'Inwi',
212610 => 'Maroc Telecom',
212611 => 'Maroc Telecom',
212612 => 'Méditel',
212613 => 'Maroc Telecom',
212614 => 'Méditel',
212615 => 'Maroc Telecom',
212616 => 'Maroc Telecom',
212617 => 'Méditel',
212618 => 'Maroc Telecom',
212619 => 'Méditel',
212620 => 'Méditel',
212621 => 'Méditel',
212622 => 'Maroc Telecom',
212623 => 'Maroc Telecom',
212624 => 'Maroc Telecom',
212625 => 'Méditel',
212626 => 'Inwi',
212627 => 'Inwi',
212628 => 'Maroc Telecom',
212629 => 'Inwi',
212630 => 'Inwi',
212631 => 'Méditel',
212632 => 'Méditel',
212633 => 'Inwi',
212634 => 'Inwi',
212635 => 'Inwi',
212636 => 'Maroc Telecom',
212637 => 'Maroc Telecom',
212638 => 'Inwi',
212639 => 'Maroc Telecom',
212640 => 'Inwi',
212641 => 'Maroc Telecom',
212642 => 'Maroc Telecom',
212643 => 'Maroc Telecom',
212644 => 'Méditel',
212645 => 'Méditel',
212646 => 'Inwi',
212647 => 'Inwi',
212648 => 'Maroc Telecom',
212649 => 'Méditel',
212650 => 'Maroc Telecom',
212651 => 'Maroc Telecom',
212652 => 'Maroc Telecom',
212653 => 'Maroc Telecom',
212654 => 'Maroc Telecom',
212655 => 'Maroc Telecom',
212656 => 'Méditel',
212657 => 'Méditel',
212658 => 'Maroc Telecom',
212659 => 'Maroc Telecom',
212660 => 'Méditel',
212661 => 'Maroc Telecom',
212662 => 'Maroc Telecom',
212663 => 'Méditel',
212664 => 'Méditel',
212665 => 'Méditel',
212666 => 'Maroc Telecom',
212667 => 'Maroc Telecom',
212668 => 'Maroc Telecom',
212669 => 'Méditel',
212670 => 'Maroc Telecom',
212671 => 'Maroc Telecom',
212672 => 'Maroc Telecom',
212673 => 'Maroc Telecom',
212674 => 'Méditel',
212675 => 'Méditel',
212676 => 'Maroc Telecom',
212677 => 'Maroc Telecom',
212678 => 'Maroc Telecom',
212679 => 'Méditel',
212680 => 'Inwi',
212681 => 'Inwi',
212687 => 'Inwi',
212690 => 'Inwi',
212691 => 'Inwi',
212692 => 'GlobalStar',
212694 => 'Méditel',
212695 => 'Inwi',
212696 => 'Inwi',
212697 => 'Maroc Telecom',
212698 => 'Inwi',
212699 => 'Inwi',
);

View File

@@ -0,0 +1,14 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
21354 => 'Nedjma',
21355 => 'Nedjma',
21356 => 'Nedjma',
2136 => 'Mobilis',
21377 => 'Djezzy',
21379 => 'Djezzy',
);

View File

@@ -0,0 +1,15 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
2162 => 'Ooredoo',
21640 => 'Tunisie Telecom',
21641 => 'Tunisie Telecom',
21642 => 'Tunisie Telecom',
21644 => 'Tunisie Telecom',
2165 => 'Orange',
2169 => 'Tunisie Telecom',
);

View File

@@ -0,0 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
2202 => 'Africell',
2203 => 'QCell',
2206 => 'Comium',
2207 => 'Africell',
2209 => 'Gamcel',
);

View File

@@ -0,0 +1,14 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
22170 => 'Expresso',
22172 => 'HAYO',
22176 => 'Tigo',
22177 => 'Orange',
22178 => 'Orange',
22179 => 'ADIE',
);

View File

@@ -0,0 +1,11 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
2222 => 'Chinguitel',
2223 => 'Mattel',
2224 => 'Mauritel',
);

View File

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

View File

@@ -0,0 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
22460 => 'Sotelgui',
22462 => 'Orange',
22463 => 'Intercel',
22465 => 'Cellcom',
22466 => 'Areeba',
);

View File

@@ -0,0 +1,42 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
22501 => 'Moov',
22502 => 'Moov',
22503 => 'Moov',
22504 => 'MTN',
22505 => 'MTN',
22506 => 'MTN',
22507 => 'Orange',
22508 => 'Orange',
22509 => 'Orange',
22540 => 'Moov',
22541 => 'Moov',
22542 => 'Moov',
22543 => 'Moov',
22544 => 'MTN',
22545 => 'MTN',
22546 => 'MTN',
22547 => 'Orange',
22548 => 'Orange',
22549 => 'Orange',
22554 => 'MTN',
22555 => 'MTN',
22556 => 'MTN',
22557 => 'Orange',
22558 => 'Orange',
22559 => 'Orange',
22560 => 'GreenN',
22561 => 'GreenN',
22565 => 'KoZ',
22566 => 'KoZ',
22567 => 'KoZ',
22569 => 'Aircom',
22575 => 'MTN',
22577 => 'Orange',
22578 => 'Orange',
);

View File

@@ -0,0 +1,28 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
22660 => 'Telmob',
22661 => 'Telmob',
22662 => 'Telmob',
22663 => 'Telmob',
22664 => 'Airtel',
22665 => 'Airtel',
22666 => 'Airtel',
22667 => 'Airtel',
22668 => 'Telecel Faso',
22669 => 'Telecel Faso',
22670 => 'Telmob',
22671 => 'Telmob',
22672 => 'Telmob',
22673 => 'Telmob',
22674 => 'Airtel',
22675 => 'Airtel',
22676 => 'Airtel',
22677 => 'Airtel',
22678 => 'Telecel Faso',
22679 => 'Telecel Faso',
);

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
22780 => 'Orange',
22788 => 'Airtel',
22789 => 'Airtel',
22790 => 'Orange',
22791 => 'Orange',
22792 => 'Orange',
22794 => 'Moov',
22795 => 'Moov',
22796 => 'Airtel',
22797 => 'Airtel',
22798 => 'Airtel',
22799 => 'Airtel',
);

View File

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

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
22961 => 'MTN',
22964 => 'Moov',
22966 => 'MTN',
22967 => 'MTN',
22968 => 'Glo',
22990 => 'Libercom',
22993 => 'BLK',
22994 => 'Moov',
22995 => 'Moov',
22997 => 'MTN',
22998 => 'Glo',
22999 => 'Glo',
);

View File

@@ -0,0 +1,55 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
230525 => 'Cellplus',
230529 => 'MTML',
2305421 => 'Emtel',
2305422 => 'Emtel',
2305423 => 'Emtel',
2305428 => 'Emtel',
2305429 => 'Emtel',
230544 => 'Emtel',
2305471 => 'Mauritius Telecom',
2305472 => 'Emtel',
2305473 => 'Emtel',
2305474 => 'Emtel',
2305475 => 'Emtel',
2305476 => 'Emtel',
2305477 => 'Emtel',
2305478 => 'Emtel',
2305479 => 'Emtel',
230549 => 'Emtel',
230570 => 'Cellplus',
230571 => 'Emtel',
230572 => 'Emtel',
230573 => 'Emtel',
230574 => 'Emtel',
230575 => 'Cellplus',
230576 => 'Cellplus',
230577 => 'Cellplus',
230578 => 'Cellplus',
230579 => 'Cellplus',
230580 => 'Cellplus',
230581 => 'Cellplus',
230582 => 'Cellplus',
230585 => 'Emtel',
230586 => 'MTML',
2305871 => 'MTML',
2305875 => 'Cellplus',
2305876 => 'Cellplus',
2305877 => 'Cellplus',
2305878 => 'Cellplus',
230590 => 'Cellplus',
230591 => 'Cellplus',
230592 => 'Cellplus',
230593 => 'Emtel',
230594 => 'Cellplus',
230595 => 'MTML',
230596 => 'MTML',
230597 => 'Emtel',
230598 => 'Emtel',
);

View File

@@ -0,0 +1,16 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
23120 => 'LIBTELCO',
231330 => 'West Africa Telecom',
23133202 => 'Atlantic Reality',
2313325 => 'WASSCOM',
231555 => 'Novafone',
23177 => 'Cellcom',
23188 => 'Lonestar Cell',
231994 => 'Atlantic Wireless',
);

View File

@@ -0,0 +1,25 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
23221 => 'Sierratel',
23225 => 'Sierratel',
23230 => 'Africell',
23233 => 'Comium',
23234 => 'Comium',
23235 => 'IPTEL',
23240 => 'Datatel/Cellcom',
23244 => 'Intergroup',
23250 => 'Datatel/Cellcom',
23255 => 'AFCOM',
23266 => 'Onlime',
23276 => 'Airtel',
23277 => 'Africell',
23278 => 'Airtel',
23279 => 'Airtel',
23288 => 'Africell',
23299 => 'Africell',
);

View File

@@ -0,0 +1,22 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
23320 => 'Vodafone',
23323 => 'Globacom (Zain)',
23324 => 'MTN',
23326 => 'Airtel',
23327 => 'tiGO',
23328 => 'Expresso',
23350 => 'Vodafone',
233553 => 'MTN',
233554 => 'MTN',
233555 => 'MTN',
233556 => 'MTN',
233560 => 'Airtel',
233561 => 'Airtel',
23357 => 'tiGO',
);

View File

@@ -0,0 +1,240 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
234173 => 'Starcomms',
234174 => 'Starcomms',
2341804 => 'Starcomms',
234181 => 'Starcomms',
234182 => 'Starcomms',
234184 => 'Starcomms',
234185 => 'Starcomms',
234187 => 'Starcomms',
2341880 => 'Starcomms',
2341881 => 'Starcomms',
2341882 => 'Starcomms',
2341883 => 'Starcomms',
234189 => 'Starcomms',
234195 => 'Starcomms',
2342870 => 'Starcomms',
2342871 => 'Starcomms',
2342872 => 'Starcomms',
2342873 => 'Starcomms',
2342874 => 'Starcomms',
2342875 => 'Starcomms',
2342876 => 'Starcomms',
2342877 => 'Starcomms',
2343181 => 'Starcomms',
2343182 => 'Starcomms',
2343183 => 'Starcomms',
2343184 => 'Starcomms',
2343185 => 'Starcomms',
2343186 => 'Starcomms',
2343187 => 'Starcomms',
2343188 => 'Starcomms',
2343880 => 'Starcomms',
2343881 => 'Starcomms',
2343882 => 'Starcomms',
2343883 => 'Starcomms',
2343884 => 'Starcomms',
2343885 => 'Starcomms',
2343886 => 'Starcomms',
2343887 => 'Starcomms',
2343961 => 'Starcomms',
2343962 => 'Starcomms',
2343963 => 'Starcomms',
2343964 => 'Starcomms',
2343965 => 'Starcomms',
2343985 => 'Starcomms',
2343986 => 'Starcomms',
2343987 => 'Starcomms',
2343988 => 'Starcomms',
2343989 => 'Starcomms',
2344280 => 'Starcomms',
2344281 => 'Starcomms',
2344282 => 'Starcomms',
2344671 => 'Starcomms',
2344672 => 'Starcomms',
2344673 => 'Starcomms',
2344674 => 'Starcomms',
2344675 => 'Starcomms',
2344676 => 'Starcomms',
2344677 => 'Starcomms',
2344678 => 'Starcomms',
2344679 => 'Starcomms',
2344680 => 'Starcomms',
2344682 => 'Starcomms',
2344683 => 'Starcomms',
2344684 => 'Starcomms',
2344687 => 'Starcomms',
2344880 => 'Starcomms',
2344881 => 'Starcomms',
2344882 => 'Starcomms',
2345277 => 'Starcomms',
2345278 => 'Starcomms',
2345279 => 'Starcomms',
234528 => 'Starcomms',
2345381 => 'Starcomms',
2345382 => 'Starcomms',
2345383 => 'Starcomms',
2345384 => 'Starcomms',
2345385 => 'Starcomms',
2345386 => 'Starcomms',
2345387 => 'Starcomms',
2345389 => 'Starcomms',
2345480 => 'Starcomms',
2345481 => 'Starcomms',
2345482 => 'Starcomms',
2345483 => 'Starcomms',
2345484 => 'Starcomms',
2345485 => 'Starcomms',
2345486 => 'Starcomms',
2345487 => 'Starcomms',
2345684 => 'Starcomms',
2345685 => 'Starcomms',
2345686 => 'Starcomms',
2345687 => 'Starcomms',
2346277 => 'Starcomms',
2346278 => 'Starcomms',
2346279 => 'Starcomms',
234628 => 'Starcomms',
2346437 => 'Starcomms',
2346438 => 'Starcomms',
2346439 => 'Starcomms',
2346461 => 'Starcomms',
2346462 => 'Starcomms',
2346469 => 'Starcomms',
2346470 => 'Starcomms',
2346474 => 'Starcomms',
2346475 => 'Starcomms',
2346476 => 'Starcomms',
2346479 => 'Starcomms',
2346481 => 'Starcomms',
2346482 => 'Starcomms',
2346489 => 'Starcomms',
2346491 => 'Starcomms',
2346492 => 'Starcomms',
2346493 => 'Starcomms',
2346494 => 'Starcomms',
2346495 => 'Starcomms',
2346496 => 'Starcomms',
2346497 => 'Starcomms',
2346498 => 'Starcomms',
2346580 => 'Starcomms',
2346581 => 'Starcomms',
2346582 => 'Starcomms',
2346987 => 'Starcomms',
2346988 => 'Starcomms',
2346989 => 'Starcomms',
2347021 => 'M-Tel',
2347022 => 'M-Tel',
2347025 => 'Visafone',
2347026 => 'Visafone',
2347028 => 'Starcomms',
2347029 => 'Starcomms',
234703 => 'MTN',
234704 => 'Visafone',
234705 => 'Glo',
234706 => 'MTN',
234707 => 'Glo',
234708 => 'Airtel',
2347380 => 'Starcomms',
2347381 => 'Starcomms',
2347382 => 'Starcomms',
2347383 => 'Starcomms',
2347384 => 'Starcomms',
2347385 => 'Starcomms',
2347386 => 'Starcomms',
2347387 => 'Starcomms',
2347691 => 'Starcomms',
2347692 => 'Starcomms',
2347693 => 'Starcomms',
2347694 => 'Starcomms',
2347695 => 'Starcomms',
2347696 => 'Starcomms',
2347697 => 'Starcomms',
2347698 => 'Starcomms',
2347782 => 'Starcomms',
2347783 => 'Starcomms',
2347784 => 'Starcomms',
234802 => 'Airtel',
234803 => 'MTN',
234804 => 'M-Tel',
234805 => 'Glo',
234806 => 'MTN',
234807 => 'Glo',
234808 => 'Airtel',
234809 => 'Etisalat',
234810 => 'MTN',
234811 => 'Glo',
234812 => 'Airtel',
234813 => 'MTN',
234814 => 'MTN',
234815 => 'Glo',
234816 => 'MTN',
234817 => 'Etisalat',
234818 => 'Etisalat',
2348190 => 'Starcomms',
2348191 => 'Starcomms',
2348283 => 'Starcomms',
2348284 => 'Starcomms',
2348285 => 'Starcomms',
2348286 => 'Starcomms',
2348287 => 'Starcomms',
2348288 => 'Starcomms',
2348380 => 'Starcomms',
2348381 => 'Starcomms',
2348382 => 'Starcomms',
2348421 => 'Starcomms',
2348422 => 'Starcomms',
2348431 => 'Starcomms',
2348434 => 'Starcomms',
2348437 => 'Starcomms',
2348438 => 'Starcomms',
2348439 => 'Starcomms',
2348453 => 'Starcomms',
2348454 => 'Starcomms',
2348456 => 'Starcomms',
2348474 => 'Starcomms',
2348475 => 'Starcomms',
2348476 => 'Starcomms',
2348477 => 'Starcomms',
2348478 => 'Starcomms',
2348479 => 'Starcomms',
2348480 => 'Starcomms',
2348481 => 'Starcomms',
2348484 => 'Starcomms',
2348485 => 'Starcomms',
2348486 => 'Starcomms',
2348488 => 'Starcomms',
2348489 => 'Starcomms',
2348490 => 'Starcomms',
2348581 => 'Starcomms',
2348582 => 'Starcomms',
2348583 => 'Starcomms',
2348584 => 'Starcomms',
2348585 => 'Starcomms',
2348586 => 'Starcomms',
2348587 => 'Starcomms',
2348588 => 'Starcomms',
2348782 => 'Starcomms',
2348783 => 'Starcomms',
2348784 => 'Starcomms',
2348785 => 'Starcomms',
2348786 => 'Starcomms',
2348787 => 'Starcomms',
2348788 => 'Starcomms',
2348789 => 'Starcomms',
2348885 => 'Starcomms',
2348886 => 'Starcomms',
2348887 => 'Starcomms',
234902 => 'Airtel',
234903 => 'MTN',
234905 => 'Glo',
234909 => 'Etisalat',
234980 => 'Starcomms',
234987 => 'Starcomms',
);

View File

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

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
23670 => 'TC',
23672 => 'Orange',
23675 => 'CTP',
23677 => 'Nationlink',
);

View File

@@ -0,0 +1,22 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
237650 => 'MTN Cameroon',
237651 => 'MTN Cameroon',
237652 => 'MTN Cameroon',
237653 => 'MTN Cameroon',
237654 => 'MTN Cameroon',
237655 => 'Orange',
237656 => 'Orange',
237657 => 'Orange',
237658 => 'Orange',
237659 => 'Orange',
23766 => 'NEXTTEL',
23767 => 'MTN Cameroon',
23768 => 'MTN Cameroon',
23769 => 'Orange',
);

View File

@@ -0,0 +1,14 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
23891 => 'T+',
23892 => 'T+',
23895 => 'CVMOVEL',
23897 => 'CVMOVEL',
23898 => 'CVMOVEL',
23899 => 'CVMOVEL',
);

View File

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

View File

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

View File

@@ -0,0 +1,29 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
24104 => 'Airtel',
24105 => 'Moov',
24106 => 'Libertis',
24107 => 'Airtel',
24110 => 'Libertis',
24111 => 'Libertis',
24120 => 'Libertis',
24121 => 'Libertis',
24122 => 'Libertis',
24123 => 'Libertis',
24124 => 'Libertis',
24125 => 'Libertis',
24126 => 'Libertis',
24127 => 'Libertis',
2413 => 'Libertis',
2414 => 'Airtel',
2415 => 'Moov',
2416 => 'Libertis',
2417 => 'Airtel',
24195 => 'Libertis',
24197 => 'Libertis',
);

View File

@@ -0,0 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
24201 => 'Equateur Telecom',
24204 => 'Warid',
24205 => 'Celtel',
24206 => 'MTN',
2428001 => 'Hightech Pro',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
24380 => 'Supercell',
24381 => 'Vodacom',
24382 => 'Vodacom',
24384 => 'CCT',
24388 => 'Yozma Timeturns sprl -YTT',
24389 => 'Tigo',
24397 => 'Zain',
24398 => 'Zain',
24399 => 'Zain',
);

View File

@@ -0,0 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
24491 => 'Movicel',
24492 => 'UNITEL',
24493 => 'UNITEL',
24494 => 'UNITEL',
24499 => 'Movicel',
);

View File

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

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
24825 => 'CWS',
24826 => 'CWS',
24827 => 'Airtel',
24828 => 'Airtel',
);

View File

@@ -0,0 +1,14 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
24991 => 'Zain',
24992 => 'MTN',
24993 => 'MTN',
24995 => 'Network of The World Ltd',
24996 => 'Zain',
24999 => 'MTN',
);

View File

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

View File

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

View File

@@ -0,0 +1,19 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
25224 => 'Telesom',
25228 => 'Nationlink',
25262 => 'Somtel',
25263 => 'Telesom',
25265 => 'Somtel',
25266 => 'Somtel',
25267 => 'Nationlink',
25268 => 'Nationlink',
25269 => 'Nationlink',
25279 => 'Somtel',
252907 => 'Golis Telecom',
);

View File

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

View File

@@ -0,0 +1,37 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
25470 => 'Safaricom',
25471 => 'Safaricom',
25472 => 'Safaricom',
25473 => 'Airtel',
25476 => 'Airtel',
254750 => 'Essar',
254751 => 'Essar',
254752 => 'Essar',
254753 => 'Essar',
254754 => 'Essar',
254755 => 'Essar',
254756 => 'Essar',
254770 => 'Telkom',
254771 => 'Telkom',
254772 => 'Telkom',
254773 => 'Telkom',
254774 => 'Telkom',
254775 => 'Telkom',
254780 => 'Airtel',
254781 => 'Airtel',
254782 => 'Airtel',
254785 => 'Airtel',
254786 => 'Airtel',
254787 => 'Airtel',
254788 => 'Airtel',
254789 => 'Airtel',
254790 => 'Safaricom',
254791 => 'Safaricom',
254792 => 'Safaricom',
);

View File

@@ -0,0 +1,21 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
25562 => 'Viettel',
25565 => 'tiGO',
25566 => 'SMILE',
25567 => 'tiGO',
25568 => 'Airtel',
25571 => 'tiGO',
25573 => 'Tanzania Telecom',
25574 => 'Vodacom',
25575 => 'Vodacom',
25576 => 'Vodacom',
25577 => 'Zantel',
25578 => 'Airtel',
25579 => 'Benson Informatics',
);

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
2562030 => 'Afrimax',
25670 => 'Warid',
25671 => 'UTL',
256720 => 'Smile',
256723 => 'Afrimax',
256730 => 'K2',
25674 => 'Sure Telecom',
25675 => 'Airtel',
25676 => 'i-Tel',
25677 => 'MTN',
25678 => 'MTN',
25679 => 'Orange',
);

View File

@@ -0,0 +1,16 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
25729 => 'Leo',
25769 => 'Viettel',
25771 => 'Leo',
25775 => 'Smart Mobile',
25776 => 'Econet',
25777 => 'Onatel',
25778 => 'Tempo',
25779 => 'Leo',
);

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
25882 => 'mcel',
25883 => 'mcel',
25884 => 'Vodacom',
25887 => 'Movitel',
);

View File

@@ -0,0 +1,11 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
26095 => 'ZAMTEL',
26096 => 'MTN',
26097 => 'Airtel',
);

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
26132 => 'Orange',
26133 => 'Airtel',
26134 => 'Telma',
26139 => 'Blueline',
);

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
26371 => 'Net*One',
26373 => 'Telecel',
26377 => 'Econet',
26378 => 'Econet',
);

View File

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

View File

@@ -0,0 +1,48 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
26771 => 'Mascom',
26772 => 'Orange',
26773 => 'BTC Mobile',
267740 => 'Mascom',
267741 => 'Mascom',
267742 => 'Mascom',
267743 => 'Orange',
267744 => 'Orange',
267745 => 'Mascom',
267746 => 'Mascom',
267747 => 'Mascom',
267748 => 'Orange',
267749 => 'BTC Mobile',
267750 => 'Orange',
267751 => 'Orange',
267752 => 'Orange',
267753 => 'Orange',
267754 => 'Mascom',
267755 => 'Mascom',
267756 => 'Mascom',
267757 => 'Orange',
267758 => 'BTC Mobile',
267759 => 'Mascom',
267760 => 'Mascom',
267761 => 'Mascom',
267762 => 'Mascom',
267763 => 'Orange',
267764 => 'Orange',
267765 => 'Orange',
267766 => 'Mascom',
267767 => 'Mascom',
267768 => 'BTC Mobile',
267769 => 'BTC Mobile/Orange',
267770 => 'Mascom',
267771 => 'Mascom',
267774 => 'Orange',
267775 => 'Orange',
267776 => 'Mascom',
267777 => 'Mascom',
267778 => 'Mascom',
);

View File

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

View File

@@ -0,0 +1,59 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
27603 => 'MTN',
27604 => 'MTN',
27605 => 'MTN',
27606 => 'Vodacom',
27607 => 'Vodacom',
27608 => 'Vodacom',
27609 => 'Vodacom',
27610 => 'Cell C',
27611 => 'Cell C',
27612 => 'Cell C',
27613 => 'Cell C',
27614 => 'Telkom Mobile',
27615 => 'Cell C',
27616 => 'Cell C',
27617 => 'Cell C',
27618 => 'Cell C',
27619 => 'Cell C',
27620 => 'Cell C',
27621 => 'Cell C',
27622 => 'Cell C',
27623 => 'Cell C',
27624 => 'Cell C',
27710 => 'MTN',
27711 => 'Vodacom',
27712 => 'Vodacom',
27713 => 'Vodacom',
27714 => 'Vodacom',
27715 => 'Vodacom',
27716 => 'Vodacom',
27717 => 'MTN',
27718 => 'MTN',
27719 => 'MTN',
2772 => 'Vodacom',
2773 => 'MTN',
2774 => 'Cell C',
27741 => 'Virgin Mobile',
2776 => 'Vodacom',
2778 => 'MTN',
2779 => 'Vodacom',
27810 => 'MTN',
27811 => 'Telkom Mobile',
27812 => 'Telkom Mobile',
27813 => 'Telkom Mobile',
27814 => 'Telkom Mobile',
27815 => 'Telkom Mobile',
27816 => 'WBS Mobile',
27817 => 'Telkom Mobile',
27818 => 'Vodacom',
2782 => 'Vodacom',
2783 => 'MTN',
2784 => 'Cell C',
);

View File

@@ -0,0 +1,23 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
29756 => 'SETAR',
297592 => 'SETAR',
297593 => 'SETAR',
297594 => 'SETAR',
297597 => 'SETAR',
297598 => 'SETAR',
297660 => 'SETAR',
297661 => 'SETAR',
297690 => 'SETAR',
29773 => 'Digicel',
29774 => 'Digicel',
297995 => 'SETAR',
297996 => 'SETAR',
297997 => 'SETAR',
297998 => 'SETAR',
);

View File

@@ -0,0 +1,12 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
2982 => 'Faroese Telecom',
2985 => 'Vodafone',
2986 => 'Vodafone',
2987 => 'Vodafone',
);

View File

@@ -0,0 +1,11 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
*/
return array (
2992 => 'TELE Greenland A/S',
2994 => 'TELE Greenland A/S',
2995 => 'TELE Greenland A/S',
);

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