Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -23,43 +23,47 @@ class AlternateFormatsCountryCodeSet {
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,
6 => 39,
7 => 43,
8 => 44,
9 => 49,
10 => 52,
11 => 54,
12 => 55,
13 => 58,
14 => 61,
15 => 62,
16 => 63,
17 => 64,
18 => 66,
19 => 81,
20 => 84,
21 => 90,
22 => 91,
23 => 94,
24 => 95,
25 => 255,
26 => 350,
27 => 351,
28 => 352,
29 => 358,
30 => 359,
31 => 372,
32 => 373,
33 => 380,
34 => 381,
35 => 385,
36 => 505,
37 => 506,
38 => 595,
39 => 675,
40 => 676,
41 => 679,
42 => 855,
43 => 856,
44 => 971,
45 => 972,
46 => 995,
);
}

View File

@@ -0,0 +1,841 @@
<?php
namespace libphonenumber;
/**
* Class AsYouTypeFormatter
* A formatter which formats phone numbers as they are entered.
*
* An AsYouTypeFormatter instance can be created by invoking PhoneNumberUtil::getAsYouTypeFormatter().
* After that, digits can be added by invoking inputDigit() on the formatter instance, and the partially
* formatted phone number will be returned each time a digit is added. clear() can be invokved before
* formatting a new number.
*/
class AsYouTypeFormatter
{
/**
* @var string
*/
private $currentOutput;
/**
* @var string
*/
private $formattingTemplate;
/**
* The pattern from numberFormat that is currently used to create formattingTemplate.
* @var string
*/
private $currentFormattingPattern;
/**
* @var string
*/
private $accruedInput;
/**
* @var string
*/
private $accruedInputWithoutFormatting;
/**
* This indicated whether AsYouTypeFormatter is currently doing the formatting
* @var bool
*/
private $ableToFormat = true;
/**
* Set to true when users enter their own formatting. AsYouTypeFormatter will do no formatting at
* all when this is set to true
* @var bool
*/
private $inputHasFormatting = false;
/**
* This is set to true when we know the user is entering a full national significant number, since
* we have either detected a national prefix or an international dialing prefix. When this is
* true, we will no longer use local formatting patterns.
* @var bool
*/
private $isCompleteNumber = false;
/**
* @var bool
*/
private $isExpectingCountryCallingCode = false;
/**
* @var PhoneNumberUtil
*/
private $phoneUtil;
/**
* @var string
*/
private $defaultCountry;
/**
* @var PhoneMetadata
*/
private $defaultMetadata;
/**
* @var PhoneMetadata
*/
private $currentMetadata;
/**
* @var NumberFormat[]
*/
private $possibleFormats = array();
/**
* @var int
*/
private $lastMatchPosition = 0;
/**
* The position of a digit upon which inputDigitAndRememberPosition is most recently invoked,
* as found in the original sequence of characters the user entered.
* @var int
*/
private $originalPosition = 0;
/**
* The position of a digit upon which inputDigitAndRememberPosition is most recently invoked,
* as found in accruedInputWithoutFormatting
* @var int
*/
private $positionToRemember = 0;
/**
* This contains anything that has been entered so far preceding the national significant number,
* and it is formatted (e.g. with space inserted). For example, this can contain IDD, country code,
* and/or NDD, etc.
* @var string
*/
private $prefixBeforeNationalNumber;
/**
* @var bool
*/
private $shouldAddSpaceAfterNationalPrefix = false;
/**
* This contains the national prefix that has been extracted. It contains only digits without
* formatting
* @var string
*/
private $extractedNationalPrefix = "";
/**
* @var string
*/
private $nationalNumber;
/**
* @var bool
*/
private static $initialised = false;
/**
* Character used when appropriate to separate a prefix, such as a long NDD or a country
* calling code, from the national number.
* @var string
*/
private static $seperatorBeforeNationalNumber = ' ';
/**
* @var PhoneMetadata
*/
private static $emptyMetadata;
/**
* A pattern that is used to match character classes in regular expressions. An example of a
* character class is [1-4]
* @var string
*/
private static $characterClassPattern = "\\[([^\\[\\]])*\\]";
/**
* Any digit in a regular expression that actually denotes a digit. For example, in the regular
* expression 800[0-2]\d{6,10}, the first 2 digits (8 and 0) are standalone digits, but the rest
* are not.
* Two look-aheads are needed before the number following \\d could be a two-digit number, since
* the phone number can be a long as 15 digits.
* @var string
*/
private static $standaloneDigitPattern = "\\d(?=[^,}][^,}])";
/**
* A pattern that is used to determine if a numberFormat under availableFormats is eligible
* to be used by the AYTF. It is eligible when the format element under numberFormat contains
* groups of the dollar sign followed by a single digit, separated by valid phone number punctuation.
* This prevents invalid punctuation (such as the star sign in Israeli star numbers) getting
* into the output of the AYTF.
* @var string
*/
private static $eligibleFormatPattern;
/**
* A set of characters that, if found in the national prefix formatting rules, are an indicator
* to us that we should separate the national prefix from the numbers when formatting.
* @var string
*/
private static $nationalPrefixSeparatorsPattern = "[- ]";
/**
* This is the minimum length of national number accrued that is required to trigger the
* formatter. The first element of the leadingDigitsPattern of each numberFormat contains
* a regular expression that matches up to this number of digits.
* @var int
*/
private static $minLeadingDigitsLength = 3;
/**
* The digits that have not been entered yet will be represented by a \u2008, the punctuation
* space.
* @var string
*/
private static $digitPattern = "\xE2\x80\x88";
private static function init()
{
if (self::$initialised === false) {
self::$initialised = true;
self::$emptyMetadata = new PhoneMetadata();
self::$emptyMetadata->setInternationalPrefix("NA");
self::$eligibleFormatPattern = "[" . PhoneNumberUtil::VALID_PUNCTUATION . "]*"
. "(\\$\\d" . "[" . PhoneNumberUtil::VALID_PUNCTUATION . "]*)+";
}
}
/**
* Constructs as as-you-type formatter. Should be obtained from PhoneNumberUtil->getAsYouTypeFormatter()
* @param string $regionCode The country/region where the phone number is being entered
*/
public function __construct($regionCode)
{
self::init();
$this->phoneUtil = PhoneNumberUtil::getInstance();
$this->defaultCountry = $regionCode;
$this->currentMetadata = $this->getMetadataForRegion($this->defaultCountry);
$this->defaultMetadata = $this->currentMetadata;
}
/**
* The metadata needed by this class is the same for all regions sharing the same country calling
* code. Therefore, we return the metadata for the 'main' region for this country calling code.
* @param string $regionCode
* @return PhoneMetadata
*/
private function getMetadataForRegion($regionCode)
{
$countryCallingCode = $this->phoneUtil->getCountryCodeForRegion($regionCode);
$mainCountry = $this->phoneUtil->getRegionCodeForCountryCode($countryCallingCode);
$metadata = $this->phoneUtil->getMetadataForRegion($mainCountry);
if ($metadata !== null) {
return $metadata;
}
// Set to a default instance of teh metadata. This allows us to function with an incorrect
// region code, even if the formatting only works for numbers specified with "+".
return self::$emptyMetadata;
}
/**
* Returns true if a new template is created as opposed to reusing the existing template.
* @return bool
*/
private function maybeCreateNewTemplate()
{
// When there are multiple available formats, the formatter uses the first format where a
// formatting template could be created.
foreach ($this->possibleFormats as $key => $numberFormat) {
$pattern = $numberFormat->getPattern();
if ($this->currentFormattingPattern == $pattern) {
return false;
}
if ($this->createFormattingTemplate($numberFormat)) {
$this->currentFormattingPattern = $pattern;
$nationalPrefixSeparatorsMatcher = new Matcher(self::$nationalPrefixSeparatorsPattern,
$numberFormat->getNationalPrefixFormattingRule());
$this->shouldAddSpaceAfterNationalPrefix = $nationalPrefixSeparatorsMatcher->find();
// With a new formatting template, the matched position using the old template
// needs to be reset.
$this->lastMatchPosition = 0;
return true;
} else {
// Remove the current number format from $this->possibleFormats
unset($this->possibleFormats[$key]);
}
}
$this->ableToFormat = false;
return false;
}
/**
* @param string $leadingDigits
*/
private function getAvailableFormats($leadingDigits)
{
$formatList = ($this->isCompleteNumber && $this->currentMetadata->intlNumberFormatSize() > 0)
? $this->currentMetadata->intlNumberFormats()
: $this->currentMetadata->numberFormats();
$nationalPrefixIsUsedByCountry = $this->currentMetadata->hasNationalPrefix();
foreach ($formatList as $format) {
if (!$nationalPrefixIsUsedByCountry
|| $this->isCompleteNumber
|| $format->getNationalPrefixOptionalWhenFormatting()
|| PhoneNumberUtil::formattingRuleHasFirstGroupOnly($format->getNationalPrefixFormattingRule())
) {
if ($this->isFormatEligible($format->getFormat())) {
$this->possibleFormats[] = $format;
}
}
}
$this->narrowDownPossibleFormats($leadingDigits);
}
/**
* @param string $format
* @return bool
*/
private function isFormatEligible($format)
{
$eligibleFormatMatcher = new Matcher(self::$eligibleFormatPattern, $format);
return $eligibleFormatMatcher->matches();
}
/**
* @param $leadingDigits
*/
private function narrowDownPossibleFormats($leadingDigits)
{
$indexOfLeadingDigitsPattern = mb_strlen($leadingDigits) - self::$minLeadingDigitsLength;
foreach ($this->possibleFormats as $key => $format) {
if ($format->leadingDigitsPatternSize() === 0) {
// Keep everything that isn't restricted by leading digits.
continue;
}
$lastLeadingDigitsPattern = min($indexOfLeadingDigitsPattern, $format->leadingDigitsPatternSize() - 1);
$leadingDigitsPattern = $format->getLeadingDigitsPattern($lastLeadingDigitsPattern);
$m = new Matcher($leadingDigitsPattern, $leadingDigits);
if (!$m->lookingAt()) {
unset($this->possibleFormats[$key]);
}
}
}
/**
* @param NumberFormat $format
* @return bool
*/
private function createFormattingTemplate(NumberFormat $format)
{
$numberPattern = $format->getPattern();
// The formatter doesn't format numbers when numberPattern contains "|", e.g.
// (20|3)\d{4}. In those cases we quickly return.
if (mb_stripos('|', $numberPattern) !== false) {
return false;
}
// replace anything in the form of [..] with \d
$characterClassMatcher = new Matcher(self::$characterClassPattern, $numberPattern);
$numberPattern = $characterClassMatcher->replaceAll("\\\\d");
// Replace any standalone digit (not the one in d{}) with \d
$standAloneDigitMatcher = new Matcher(self::$standaloneDigitPattern, $numberPattern);
$numberPattern = $standAloneDigitMatcher->replaceAll("\\\\d");
$this->formattingTemplate = "";
$tempTemplate = $this->getFormattingTemplate($numberPattern, $format->getFormat());
if (mb_strlen($tempTemplate) > 0) {
$this->formattingTemplate .= $tempTemplate;
return true;
}
return false;
}
/**
* Gets a formatting template which can be used to efficiently format a partial number where
* digits are added one by one.
* @param string $numberPattern
* @param string $numberFormat
* @return string
*/
private function getFormattingTemplate($numberPattern, $numberFormat)
{
// Creates a phone number consisting only of the digit 9 that matches the
// numberPattern by applying the pattern to the longestPhoneNumber string.
$longestPhoneNumber = "999999999999999";
$m = new Matcher($numberPattern, $longestPhoneNumber);
$m->find();
$aPhoneNumber = $m->group();
// No formatting template can be created if the number of digits entered entered so far
// is longer than the maximum the current formatting rule can accommodate.
if (mb_strlen($aPhoneNumber) < mb_strlen($this->nationalNumber)) {
return "";
}
// Formats the number according to $numberFormat
$template = preg_replace('/' . $numberPattern . '/' . PhoneNumberUtil::REGEX_FLAGS, $numberFormat, $aPhoneNumber);
// Replaces each digit with character self::$digitPlattern
$template = preg_replace("/9/", self::$digitPattern, $template);
return $template;
}
/**
* Clears the internal state of the formatter, so it can be reused.
*/
public function clear()
{
$this->currentOutput = "";
$this->accruedInput = "";
$this->accruedInputWithoutFormatting = "";
$this->formattingTemplate = "";
$this->lastMatchPosition = 0;
$this->currentFormattingPattern = "";
$this->prefixBeforeNationalNumber = "";
$this->extractedNationalPrefix = "";
$this->nationalNumber = "";
$this->ableToFormat = true;
$this->inputHasFormatting = false;
$this->positionToRemember = 0;
$this->originalPosition = 0;
$this->isCompleteNumber = false;
$this->isExpectingCountryCallingCode = false;
$this->possibleFormats = array();
$this->shouldAddSpaceAfterNationalPrefix = false;
if ($this->currentMetadata !== $this->defaultMetadata) {
$this->currentMetadata = $this->getMetadataForRegion($this->defaultCountry);
}
}
/**
* Formats a phone number on-the-fly as each digit is entered.
*
* @param string $nextChar the most recently entered digit of a phone number. Formatting characters
* are allowed, but as soon as they are encountered this method foramts the number as entered
* and not "as you type" anymore. Full width digits and Arabic-indic digits are allowed, and will
* be shown as they are.
* @return string The partially formatted phone number
*/
public function inputDigit($nextChar)
{
$this->currentOutput = $this->inputDigitWithOptionToRememberPosition($nextChar, false);
return $this->currentOutput;
}
/**
* Same as $this->inputDigit(), but remembers the position where $nextChar is inserted, so
* that is can be retrieved later by using $this->getRememberedPosition(). The remembered
* position will be automatically adjusted if additional formatting characters are later
* inserted/removed in front of $nextChar
* @param string $nextChar
* @return string
*/
public function inputDigitAndRememberPosition($nextChar)
{
$this->currentOutput = $this->inputDigitWithOptionToRememberPosition($nextChar, true);
return $this->currentOutput;
}
/**
* @param string $nextChar
* @param bool $rememberPosition
* @return string
*/
private function inputDigitWithOptionToRememberPosition($nextChar, $rememberPosition)
{
$this->accruedInput .= $nextChar;
if ($rememberPosition) {
$this->originalPosition = mb_strlen($this->accruedInput);
}
// We do formatting on-the-fly only when each character entered is either a digit, or a plus
// sign (accepted at the start of the number only).
if (!$this->isDigitOrLeadingPlusSign($nextChar)) {
$this->ableToFormat = false;
$this->inputHasFormatting = true;
} else {
$nextChar = $this->normalizeAndAccrueDigitsAndPlusSign($nextChar, $rememberPosition);
}
if (!$this->ableToFormat) {
// When we are unable to format because of reasons other than that formatting chars have been
// entered, it can be due to really long IDDs or NDDs. If that is the case, we might be able
// to do formatting again after extracting them.
if ($this->inputHasFormatting) {
return $this->accruedInput;
} elseif ($this->attemptToExtractIdd()) {
if ($this->attemptToExtractCountryCallingCode()) {
return $this->attemptToChoosePatternWithPrefixExtracted();
}
} elseif ($this->ableToExtractLongerNdd()) {
// Add an additional space to separate long NDD and national significant number for
// readability. We don't set shouldAddSpaceAfterNationalPrefix to true, since we don't want
// this to change later when we choose formatting templates.
$this->prefixBeforeNationalNumber .= self::$seperatorBeforeNationalNumber;
return $this->attemptToChoosePatternWithPrefixExtracted();
}
return $this->accruedInput;
}
// We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits (the plus
// sign is counted as a digit as well for this purpose) have been entered.
switch (mb_strlen($this->accruedInputWithoutFormatting)) {
case 0:
case 1:
case 2:
return $this->accruedInput;
/** @noinspection PhpMissingBreakStatementInspection */
case 3:
if ($this->attemptToExtractIdd()) {
$this->isExpectingCountryCallingCode = true;
} else {
// No IDD or plus sign is found, might be entering in national format.
$this->extractedNationalPrefix = $this->removeNationalPrefixFromNationalNumber();
return $this->attemptToChooseFormattingPattern();
}
// fall through
default:
if ($this->isExpectingCountryCallingCode) {
if ($this->attemptToExtractCountryCallingCode()) {
$this->isExpectingCountryCallingCode = false;
}
return $this->prefixBeforeNationalNumber . $this->nationalNumber;
}
if (count($this->possibleFormats) > 0) {
// The formatting patterns are already chosen.
$tempNationalNumber = $this->inputDigitHelper($nextChar);
// See if the accrued digits can be formatted properly already. If not, use the results
// from inputDigitHelper, which does formatting based on the formatting pattern chosen.
$formattedNumber = $this->attemptToFormatAccruedDigits();
if (mb_strlen($formattedNumber) > 0) {
return $formattedNumber;
}
$this->narrowDownPossibleFormats($this->nationalNumber);
if ($this->maybeCreateNewTemplate()) {
return $this->inputAccruedNationalNumber();
}
return $this->ableToFormat
? $this->appendNationalNumber($tempNationalNumber)
: $this->accruedInput;
} else {
return $this->attemptToChooseFormattingPattern();
}
}
}
/**
* @return string
*/
private function attemptToChoosePatternWithPrefixExtracted()
{
$this->ableToFormat = true;
$this->isExpectingCountryCallingCode = false;
$this->possibleFormats = array();
$this->lastMatchPosition = 0;
$this->formattingTemplate = "";
$this->currentFormattingPattern = "";
return $this->attemptToChooseFormattingPattern();
}
/**
* @return string
* @internal
*/
public function getExtractedNationalPrefix()
{
return $this->extractedNationalPrefix;
}
/**
* Some national prefixes are a substring of others. If extracting the shorter NDD doesn't result
* in a number we can format, we try to see if we can extract a longer version here.
* @return bool
*/
private function ableToExtractLongerNdd()
{
if (mb_strlen($this->extractedNationalPrefix) > 0) {
// Put the extracted NDD back to the national number before attempting to extract a new NDD.
$this->nationalNumber = $this->extractedNationalPrefix . $this->nationalNumber;
// Remove the previously extracted NDD from prefixBeforeNationalNumber. We cannot simply set
// it to empty string because people sometimes incorrectly enter national prefix after the
// country code, e.g. +44 (0)20-1234-5678.
$indexOfPreviousNdd = mb_strrpos($this->prefixBeforeNationalNumber, $this->extractedNationalPrefix);
$this->prefixBeforeNationalNumber = mb_substr(str_pad($this->prefixBeforeNationalNumber, $indexOfPreviousNdd), 0, $indexOfPreviousNdd);
}
return ($this->extractedNationalPrefix !== $this->removeNationalPrefixFromNationalNumber());
}
/**
* @param string $nextChar
* @return bool
*/
private function isDigitOrLeadingPlusSign($nextChar)
{
$plusCharsMatcher = new Matcher(PhoneNumberUtil::$PLUS_CHARS_PATTERN, $nextChar);
return preg_match('/' . PhoneNumberUtil::DIGITS . '/' . PhoneNumberUtil::REGEX_FLAGS, $nextChar)
|| (mb_strlen($this->accruedInput) === 1 &&
$plusCharsMatcher->matches());
}
/**
* Checks to see if there is an exact pattern match for these digits. If so, we should use this
* instead of any other formatting template whose leadingDigitsPattern also matches the input.
* @return string
*/
public function attemptToFormatAccruedDigits()
{
foreach ($this->possibleFormats as $numberFormat) {
$m = new Matcher($numberFormat->getPattern(), $this->nationalNumber);
if ($m->matches()) {
$nationalPrefixSeparatorsMatcher = new Matcher(self::$nationalPrefixSeparatorsPattern, $numberFormat->getNationalPrefixFormattingRule());
$this->shouldAddSpaceAfterNationalPrefix = $nationalPrefixSeparatorsMatcher->find();
$formattedNumber = $m->replaceAll($numberFormat->getFormat());
return $this->appendNationalNumber($formattedNumber);
}
}
return "";
}
/**
* returns the current position in the partially formatted phone number of the character which was
* previously passed in as a parameter of $this->inputDigitAndRememberPosition().
* @return int
*/
public function getRememberedPosition()
{
if (!$this->ableToFormat) {
return $this->originalPosition;
}
$accruedInputIndex = 0;
$currentOutputIndex = 0;
$currentOutputLength = mb_strlen($this->currentOutput);
while ($accruedInputIndex < $this->positionToRemember && $currentOutputIndex < $currentOutputLength) {
if (mb_substr($this->accruedInputWithoutFormatting, $accruedInputIndex, 1) == mb_substr($this->currentOutput, $currentOutputIndex, 1)) {
$accruedInputIndex++;
}
$currentOutputIndex++;
}
return $currentOutputIndex;
}
/**
* Combines the national number with any prefix (IDD/+ and country code or national prefix) that
* was collected. A space will be inserted between them if the current formatting template
* indicates this to be suitable.
* @param string $nationalNumber
* @return string
*/
private function appendNationalNumber($nationalNumber)
{
$prefixBeforeNationalNumberLength = mb_strlen($this->prefixBeforeNationalNumber);
if ($this->shouldAddSpaceAfterNationalPrefix && $prefixBeforeNationalNumberLength > 0
&& mb_substr($this->prefixBeforeNationalNumber, $prefixBeforeNationalNumberLength - 1, 1)
!= self::$seperatorBeforeNationalNumber
) {
// We want to add a space after the national prefix if the national prefix formatting rule
// indicates that this would normally be done, with the exception of the case where we already
// appended a space because the NDD was surprisingly long.
return $this->prefixBeforeNationalNumber . self::$seperatorBeforeNationalNumber . $nationalNumber;
} else {
return $this->prefixBeforeNationalNumber . $nationalNumber;
}
}
/**
* Attempts to set the formatting template and returns a string which contains the formatted
* version of the digits entered so far.
* @return string
*/
private function attemptToChooseFormattingPattern()
{
// We start to attempt to format only when at least MIN_LEADING_DIGITS_LENGTH digits of national
// number (excluding national prefix) have been entered.
if (mb_strlen($this->nationalNumber) >= self::$minLeadingDigitsLength) {
$this->getAvailableFormats($this->nationalNumber);
// See if the accrued digits can be formatted properly already.
$formattedNumber = $this->attemptToFormatAccruedDigits();
if (mb_strlen($formattedNumber) > 0) {
return $formattedNumber;
}
return $this->maybeCreateNewTemplate() ? $this->inputAccruedNationalNumber() : $this->accruedInput;
} else {
return $this->appendNationalNumber($this->nationalNumber);
}
}
/**
* Invokes inputDigitHelper on each digit of the national number accrued, and returns a formatted
* string in the end
* @return string
*/
private function inputAccruedNationalNumber()
{
$lengthOfNationalNumber = mb_strlen($this->nationalNumber);
if ($lengthOfNationalNumber > 0) {
$tempNationalNumber = "";
for ($i = 0; $i < $lengthOfNationalNumber; $i++) {
$tempNationalNumber = $this->inputDigitHelper(mb_substr($this->nationalNumber, $i, 1));
}
return $this->ableToFormat ? $this->appendNationalNumber($tempNationalNumber) : $this->accruedInput;
} else {
return $this->prefixBeforeNationalNumber;
}
}
/**
* Returns true if the current country is a NANPA country and the national number beings with
* the national prefix
* @return bool
*/
private function isNanpaNumberWithNationalPrefix()
{
// For NANPA numbers beginning with 1[2-9], treat the 1 as the national prefix. The reason is
// that national significant numbers in NANPA always start with [2-9] after the national prefix.
// Numbers beginning with 1[01] can only be short/emergency numbers, which don't need the
// national prefix.
return ($this->currentMetadata->getCountryCode() == 1) && (mb_substr($this->nationalNumber, 0, 1) == '1')
&& (mb_substr($this->nationalNumber, 1, 1) != '0') && (mb_substr($this->nationalNumber, 1, 1) != '1');
}
/**
* Returns the national prefix extracted, or an empty string if it is not present.
* @return string
*/
private function removeNationalPrefixFromNationalNumber()
{
$startOfNationalNumber = 0;
if ($this->isNanpaNumberWithNationalPrefix()) {
$startOfNationalNumber = 1;
$this->prefixBeforeNationalNumber .= "1" . self::$seperatorBeforeNationalNumber;
$this->isCompleteNumber = true;
} elseif ($this->currentMetadata->hasNationalPrefixForParsing()) {
$m = new Matcher($this->currentMetadata->getNationalPrefixForParsing(), $this->nationalNumber);
// Since some national prefix patterns are entirely optional, check that a national prefix
// could actually be extracted.
if ($m->lookingAt() && $m->end() > 0) {
// When the national prefix is detected, we use international formatting rules instead of
// national ones, because national formatting rules could contain local formatting rules
// for numbers entered without area code.
$this->isCompleteNumber = true;
$startOfNationalNumber = $m->end();
$this->prefixBeforeNationalNumber .= mb_substr($this->nationalNumber, 0, $startOfNationalNumber);
}
}
$nationalPrefix = mb_substr($this->nationalNumber, 0, $startOfNationalNumber);
$this->nationalNumber = mb_substr($this->nationalNumber, $startOfNationalNumber);
return $nationalPrefix;
}
/**
* Extracts IDD and plus sign to $this->prefixBeforeNationalNumber when they are available, and places
* the remaining input into $this->nationalNumber.
* @return bool true when $this->accruedInputWithoutFormatting begins with the plus sign or valid IDD
* for $this->defaultCountry.
*/
private function attemptToExtractIdd()
{
$internationalPrefix = "\\" . PhoneNumberUtil::PLUS_SIGN . '|' . $this->currentMetadata->getInternationalPrefix();
$iddMatcher = new Matcher($internationalPrefix, $this->accruedInputWithoutFormatting);
if ($iddMatcher->lookingAt()) {
$this->isCompleteNumber = true;
$startOfCountryCallingCode = $iddMatcher->end();
$this->nationalNumber = mb_substr($this->accruedInputWithoutFormatting, $startOfCountryCallingCode);
$this->prefixBeforeNationalNumber = mb_substr($this->accruedInputWithoutFormatting, 0, $startOfCountryCallingCode);
if (mb_substr($this->accruedInputWithoutFormatting, 0, 1) != PhoneNumberUtil::PLUS_SIGN) {
$this->prefixBeforeNationalNumber .= self::$seperatorBeforeNationalNumber;
}
return true;
}
return false;
}
/**
* Extracts the country calling code from the beginning of $this->nationalNumber to
* $this->prefixBeforeNationalNumber when they are available, and places the remaining input
* into $this->>nationalNumber.
* @return bool true when a valid country calling code can be found
*/
private function attemptToExtractCountryCallingCode()
{
if (mb_strlen($this->nationalNumber) == 0) {
return false;
}
$numberWithoutCountryCallingCode = "";
$countryCode = $this->phoneUtil->extractCountryCode($this->nationalNumber, $numberWithoutCountryCallingCode);
if ($countryCode === 0) {
return false;
}
$this->nationalNumber = $numberWithoutCountryCallingCode;
$newRegionCode = $this->phoneUtil->getRegionCodeForCountryCode($countryCode);
if (PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY == $newRegionCode) {
$this->currentMetadata = $this->phoneUtil->getMetadataForNonGeographicalRegion($countryCode);
} elseif ($newRegionCode != $this->defaultCountry) {
$this->currentMetadata = $this->getMetadataForRegion($newRegionCode);
}
$countryCodeString = (string)$countryCode;
$this->prefixBeforeNationalNumber .= $countryCodeString . self::$seperatorBeforeNationalNumber;
// When we have successfully extracted the IDD, the previously extracted NDD should be cleared
// because it is no longer valid.
$this->extractedNationalPrefix = "";
return true;
}
/**
* Accrues digits and the plus sign to $this->accruedInputWithoutFormatting for later use. If
* $nextChar contains a digit in non-ASCII format (e.g. the full-width version of digits), it
* is first normalized to the ASCII version. The return value is $nextChar itself, or its
* normalized version, if $nextChar is a digit in non-ASCII format. This method assumes its
* input is either a digit or the plus sign.
* @param string $nextChar
* @param bool $rememberPosition
* @return string
*/
private function normalizeAndAccrueDigitsAndPlusSign($nextChar, $rememberPosition)
{
if ($nextChar == PhoneNumberUtil::PLUS_SIGN) {
$normalizedChar = $nextChar;
$this->accruedInputWithoutFormatting .= $nextChar;
} else {
$normalizedChar = PhoneNumberUtil::normalizeDigits($nextChar, false);
$this->accruedInputWithoutFormatting .= $normalizedChar;
$this->nationalNumber .= $normalizedChar;
}
if ($rememberPosition) {
$this->positionToRemember = mb_strlen($this->accruedInputWithoutFormatting);
}
return $normalizedChar;
}
/**
* @param string $nextChar
* @return string
*/
private function inputDigitHelper($nextChar)
{
// Note that formattingTemplate is not guaranteed to have a value, it could be empty, e.g.
// when the next digit is entered after extracting an IDD or NDD.
$digitMatcher = new Matcher(self::$digitPattern, $this->formattingTemplate);
if ($digitMatcher->find($this->lastMatchPosition)) {
$tempTemplate = $digitMatcher->replaceFirst($nextChar);
$this->formattingTemplate = $tempTemplate . mb_substr($this->formattingTemplate, mb_strlen($tempTemplate, "UTF-8"), null, "UTF-8");
$this->lastMatchPosition = $digitMatcher->start();
return mb_substr($this->formattingTemplate, 0, $this->lastMatchPosition + 1);
} else {
if (count($this->possibleFormats) === 1) {
// More digits are entered than we could handle, and there are no other valid patterns to
// try.
$this->ableToFormat = false;
} // else, we just reset the formatting pattern.
$this->currentFormattingPattern = "";
return $this->accruedInput;
}
}
}

View File

@@ -29,4 +29,6 @@ class CountryCodeSource
* parsing the French number "01 42 68 53 00", when defaultCountry is supplied as France.
*/
const FROM_DEFAULT_COUNTRY = 3;
const UNSPECIFIED = 4;
}

View File

@@ -564,6 +564,10 @@ class CountryCodeToRegionCodeMap {
array (
0 => 'ME',
),
383 =>
array (
0 => 'XK',
),
385 =>
array (
0 => 'HR',

View File

@@ -103,6 +103,14 @@ class CountryCodeToRegionCodeMapForTesting {
0 => 'RE',
1 => 'YT',
),
290 =>
array (
0 => 'TA',
),
374 =>
array (
0 => 'AM',
),
375 =>
array (
0 => 'BY',
@@ -115,6 +123,10 @@ class CountryCodeToRegionCodeMapForTesting {
array (
0 => '001',
),
882 =>
array (
0 => '001',
),
971 =>
array (
0 => 'AE',
@@ -123,6 +135,10 @@ class CountryCodeToRegionCodeMapForTesting {
array (
0 => '001',
),
998 =>
array (
0 => 'UZ',
),
);
}

View File

@@ -0,0 +1,31 @@
<?php
namespace libphonenumber;
use libphonenumber\Leniency\Possible;
use libphonenumber\Leniency\StrictGrouping;
use libphonenumber\Leniency\Valid;
use libphonenumber\Leniency\ExactGrouping;
class Leniency
{
public static function POSSIBLE()
{
return new Possible;
}
public static function VALID()
{
return new Valid;
}
public static function STRICT_GROUPING()
{
return new StrictGrouping;
}
public static function EXACT_GROUPING()
{
return new ExactGrouping;
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace libphonenumber\Leniency;
use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberUtil;
abstract class AbstractLeniency
{
/**
* Integer level to compare 'ENUMs'
* @var int
*/
protected static $level;
/**
* Returns true if $number is a verified number according to this leniency
*
* @param PhoneNumber $number
* @param string $candidate
* @param PhoneNumberUtil $util
* @return bool
* @codeCoverageIgnore
*/
public static function verify(PhoneNumber $number, $candidate, PhoneNumberUtil $util)
{
// This can not be called directly
throw new \BadMethodCallException;
}
/**
* Compare against another Leniency
* @param AbstractLeniency $leniency
* @return int
*/
public static function compareTo(AbstractLeniency $leniency)
{
return static::getLevel() - $leniency::getLevel();
}
protected static function getLevel()
{
if (static::$level === null) {
throw new \RuntimeException('$level should be defined');
}
return static::$level;
}
public function __toString()
{
return str_replace('libphonenumber\\Leniency\\', '', get_class($this));
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace libphonenumber\Leniency;
use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberMatcher;
use libphonenumber\PhoneNumberUtil;
class ExactGrouping extends AbstractLeniency
{
protected static $level = 4;
/**
* Phone numbers accepted are PhoneNumberUtil::isValidNumber() valid and are grouped
* in the same way that we would have formatted it, or as a single block. For example,
* a US number written as "650 2530000" is not accepted at this leniency level, whereas
* "650 253 0000" or "6502530000" are.
* Numbers with more than one '/' symbol are also dropped at this level.
*
* Warning: This level might result in lower coverage especially for regions outside of country
* code "+1". If you are not sure about which level to use, email the discussion group
* libphonenumber-discuss@googlegroups.com.
*
* @param PhoneNumber $number
* @param string $candidate
* @param PhoneNumberUtil $util
* @return bool
*/
public static function verify(PhoneNumber $number, $candidate, PhoneNumberUtil $util)
{
if (!$util->isValidNumber($number)
|| !PhoneNumberMatcher::containsOnlyValidXChars($number, $candidate, $util)
|| PhoneNumberMatcher::containsMoreThanOneSlashInNationalNumber($number, $candidate)
|| !PhoneNumberMatcher::isNationalPrefixPresentIfRequired($number, $util)
) {
return false;
}
return PhoneNumberMatcher::checkNumberGroupingIsValid($number, $candidate, $util,
function (PhoneNumberUtil $util, PhoneNumber $number, $normalizedCandidate, $expectedNumberGroups) {
return PhoneNumberMatcher::allNumberGroupsAreExactlyPresent(
$util, $number, $normalizedCandidate, $expectedNumberGroups
);
});
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace libphonenumber\Leniency;
use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberUtil;
class Possible extends AbstractLeniency
{
protected static $level = 1;
/**
* Phone numbers accepted are PhoneNumberUtil::isPossibleNumber(), but not necessarily
* PhoneNumberUtil::isValidNumber().
*
* @param PhoneNumber $number
* @param string $candidate
* @param PhoneNumberUtil $util
* @return bool
*/
public static function verify(PhoneNumber $number, $candidate, PhoneNumberUtil $util)
{
return $util->isPossibleNumber($number);
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace libphonenumber\Leniency;
use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberMatcher;
use libphonenumber\PhoneNumberUtil;
class StrictGrouping extends AbstractLeniency
{
protected static $level = 3;
/**
* Phone numbers accepted are PhoneNumberUtil::isValidNumber() and are grouped
* in a possible way for this locale. For example, a US number written as
* "65 02 53 00 00" and "650253 0000" are not accepted at this leniency level, whereas
* "650 253 0000", "650 2530000" or "6502530000" are.
* Numbers with more than one '/' symbol in the national significant number are also dropped at
* this level.
*
* Warning: This level might result in lower coverage especially for regions outside of country
* code "+1". If you are not sure about which level to use, email the discussion group
* libphonenumber-discuss@googlegroups.com.
*
* @param PhoneNumber $number
* @param string $candidate
* @param PhoneNumberUtil $util
* @return bool
*/
public static function verify(PhoneNumber $number, $candidate, PhoneNumberUtil $util)
{
if (!$util->isValidNumber($number)
|| !PhoneNumberMatcher::containsOnlyValidXChars($number, $candidate, $util)
|| PhoneNumberMatcher::containsMoreThanOneSlashInNationalNumber($number, $candidate)
|| !PhoneNumberMatcher::isNationalPrefixPresentIfRequired($number, $util)
) {
return false;
}
return PhoneNumberMatcher::checkNumberGroupingIsValid(
$number, $candidate, $util,
function (PhoneNumberUtil $util, PhoneNumber $number, $normalizedCandidate, $expectedNumberGroups) {
return PhoneNumberMatcher::allNumberGroupsRemainGrouped(
$util, $number, $normalizedCandidate, $expectedNumberGroups
);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace libphonenumber\Leniency;
use libphonenumber\PhoneNumber;
use libphonenumber\PhoneNumberMatcher;
use libphonenumber\PhoneNumberUtil;
class Valid extends AbstractLeniency
{
protected static $level = 2;
/**
* Phone numbers accepted are PhoneNumberUtil::isPossibleNumber() and PhoneNumberUtil::isValidNumber().
* Numbers written in national format must have their national-prefix present if it is usually written
* for a number of this type.
*
* @param PhoneNumber $number
* @param string $candidate
* @param PhoneNumberUtil $util
* @return bool
*/
public static function verify(PhoneNumber $number, $candidate, PhoneNumberUtil $util)
{
if (!$util->isValidNumber($number)
|| !PhoneNumberMatcher::containsOnlyValidXChars($number, $candidate, $util)) {
return false;
}
return PhoneNumberMatcher::isNationalPrefixPresentIfRequired($number, $util);
}
}

View File

@@ -8,6 +8,8 @@ namespace libphonenumber;
* 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.
*
* @internal
*/
class Matcher
{
@@ -26,6 +28,8 @@ class Matcher
*/
protected $groups = array();
private $searchIndex = 0;
/**
* @param string $pattern
* @param string $subject
@@ -36,7 +40,7 @@ class Matcher
$this->subject = $subject;
}
protected function doMatch($type = 'find')
protected function doMatch($type = 'find', $offset = 0)
{
$final_pattern = '(?:' . $this->pattern . ')';
switch ($type) {
@@ -51,8 +55,28 @@ class Matcher
// no changes
break;
}
$final_pattern = '/' . $final_pattern . '/x';
return (preg_match($final_pattern, $this->subject, $this->groups, PREG_OFFSET_CAPTURE) == 1) ? true : false;
$final_pattern = '/' . $final_pattern . '/ui';
$search = mb_substr($this->subject, $offset);
$result = preg_match($final_pattern, $search, $groups, PREG_OFFSET_CAPTURE);
if ($result === 1) {
// Expand $groups into $this->groups, but being multi-byte aware
$positions = array();
foreach ($groups as $group) {
$positions[] = array(
$group[0],
$offset + mb_strlen(mb_strcut($search, 0, $group[1]))
);
}
$this->groups = $positions;
}
return ($result === 1);
}
/**
@@ -74,9 +98,15 @@ class Matcher
/**
* @return bool
*/
public function find()
public function find($offset = null)
{
return $this->doMatch('find');
if ($offset === null) {
$offset = $this->searchIndex;
}
// Increment search index for the next time we call this
$this->searchIndex++;
return $this->doMatch('find', $offset);
}
/**
@@ -97,7 +127,7 @@ class Matcher
*/
public function group($group = null)
{
if (!isset($group)) {
if (!isset($group) || $group === null) {
$group = 0;
}
return (isset($this->groups[$group][0])) ? $this->groups[$group][0] : null;
@@ -115,12 +145,12 @@ class Matcher
if (!isset($this->groups[$group])) {
return null;
}
return $this->groups[$group][1] + strlen($this->groups[$group][0]);
return $this->groups[$group][1] + mb_strlen($this->groups[$group][0]);
}
public function start($group = null)
{
if (isset($group) || $group === null) {
if (!isset($group) || $group === null) {
$group = 0;
}
if (!isset($this->groups[$group])) {

View File

@@ -9,6 +9,7 @@ namespace libphonenumber;
* matcher and allow different implementations to be swapped in easily.
*
* @package libphonenumber
* @internal
*/
interface MatcherAPIInterface
{
@@ -16,20 +17,10 @@ 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 string $number
* @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);
public function matchNationalNumber($number, PhoneNumberDesc $numberDesc, $allowPrefixMatch);
}

View File

@@ -67,7 +67,15 @@ class NumberFormat
/**
* @return boolean
*/
public function isNationalPrefixOptionalWhenFormatting()
public function hasNationalPrefixOptionalWhenFormatting()
{
return isset($this->nationalPrefixOptionalWhenFormatting);
}
/**
* @return boolean
*/
public function getNationalPrefixOptionalWhenFormatting()
{
return $this->nationalPrefixOptionalWhenFormatting;
}
@@ -229,7 +237,9 @@ class NumberFormat
if ($other->hasDomesticCarrierCodeFormattingRule()) {
$this->setDomesticCarrierCodeFormattingRule($other->getDomesticCarrierCodeFormattingRule());
}
$this->setNationalPrefixOptionalWhenFormatting($other->isNationalPrefixOptionalWhenFormatting());
if ($other->hasNationalPrefixOptionalWhenFormatting()) {
$this->setNationalPrefixOptionalWhenFormatting($other->getNationalPrefixOptionalWhenFormatting());
}
return $this;
}
@@ -253,7 +263,9 @@ class NumberFormat
$output['domesticCarrierCodeFormattingRule'] = $this->getDomesticCarrierCodeFormattingRule();
}
$output['nationalPrefixOptionalWhenFormatting'] = $this->isNationalPrefixOptionalWhenFormatting();
if ($this->hasNationalPrefixOptionalWhenFormatting()) {
$output['nationalPrefixOptionalWhenFormatting'] = $this->getNationalPrefixOptionalWhenFormatting();
}
return $output;
}
@@ -276,6 +288,8 @@ class NumberFormat
$this->setDomesticCarrierCodeFormattingRule($input['domesticCarrierCodeFormattingRule']);
}
$this->setNationalPrefixOptionalWhenFormatting($input['nationalPrefixOptionalWhenFormatting']);
if (isset($input['nationalPrefixOptionalWhenFormatting'])) {
$this->setNationalPrefixOptionalWhenFormatting($input['nationalPrefixOptionalWhenFormatting']);
}
}
}

View File

@@ -56,6 +56,10 @@ class PhoneMetadata
* @var PhoneNumberDesc
*/
protected $carrierSpecific;
/**
* @var PhoneNumberDesc
*/
protected $smsServices;
/**
* @var PhoneNumberDesc
*/
@@ -108,6 +112,12 @@ class PhoneMetadata
return $this;
}
public function clearMainCountryForCode()
{
$this->mainCountryForCode = false;
return $this;
}
public function hasLeadingZeroPossible()
{
return isset($this->leadingZeroPossible);
@@ -221,13 +231,22 @@ class PhoneMetadata
$output['carrierSpecific'] = $this->getCarrierSpecific()->toArray();
}
if ($this->hasSmsServices()) {
$output['smsServices'] = $this->getSmsServices()->toArray();
}
if ($this->hasNoInternationalDialling()) {
$output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray();
}
$output['id'] = $this->getId();
$output['countryCode'] = $this->getCountryCode();
$output['internationalPrefix'] = $this->getInternationalPrefix();
if ($this->hasCountryCode()) {
$output['countryCode'] = $this->getCountryCode();
}
if ($this->hasInternationalPrefix()) {
$output['internationalPrefix'] = $this->getInternationalPrefix();
}
if ($this->hasPreferredInternationalPrefix()) {
$output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix();
@@ -249,7 +268,9 @@ class PhoneMetadata
$output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule();
}
$output['sameMobileAndFixedLinePattern'] = $this->isSameMobileAndFixedLinePattern();
if ($this->hasSameMobileAndFixedLinePattern()) {
$output['sameMobileAndFixedLinePattern'] = $this->getSameMobileAndFixedLinePattern();
}
$output['numberFormat'] = array();
foreach ($this->numberFormats() as $numberFormat) {
@@ -267,9 +288,13 @@ class PhoneMetadata
$output['leadingDigits'] = $this->getLeadingDigits();
}
$output['leadingZeroPossible'] = $this->isLeadingZeroPossible();
if ($this->hasLeadingZeroPossible()) {
$output['leadingZeroPossible'] = $this->isLeadingZeroPossible();
}
$output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion();
if ($this->hasMobileNumberPortableRegion()) {
$output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion();
}
return $output;
}
@@ -550,6 +575,22 @@ class PhoneMetadata
return $this;
}
public function hasSmsServices()
{
return isset($this->smsServices);
}
public function getSmsServices()
{
return $this->smsServices;
}
public function setSmsServices(PhoneNumberDesc $value)
{
$this->smsServices = $value;
return $this;
}
public function hasNoInternationalDialling()
{
return isset($this->noInternationalDialling);
@@ -615,7 +656,7 @@ class PhoneMetadata
public function hasPreferredInternationalPrefix()
{
return isset($this->preferredInternationalPrefix);
return ($this->preferredInternationalPrefix !== null);
}
public function getPreferredInternationalPrefix()
@@ -629,6 +670,12 @@ class PhoneMetadata
return $this;
}
public function clearPreferredInternationalPrefix()
{
$this->preferredInternationalPrefix = null;
return $this;
}
public function hasNationalPrefix()
{
return isset($this->nationalPrefix);
@@ -645,6 +692,12 @@ class PhoneMetadata
return $this;
}
public function clearNationalPrefix()
{
$this->nationalPrefix = '';
return $this;
}
public function hasPreferredExtnPrefix()
{
return isset($this->preferredExtnPrefix);
@@ -661,6 +714,12 @@ class PhoneMetadata
return $this;
}
public function clearPreferredExtnPrefix()
{
$this->preferredExtnPrefix = '';
return $this;
}
public function hasNationalPrefixForParsing()
{
return isset($this->nationalPrefixForParsing);
@@ -693,7 +752,13 @@ class PhoneMetadata
return $this;
}
public function isSameMobileAndFixedLinePattern()
public function clearNationalPrefixTransformRule()
{
$this->nationalPrefixTransformRule = '';
return $this;
}
public function getSameMobileAndFixedLinePattern()
{
return $this->sameMobileAndFixedLinePattern;
}
@@ -704,6 +769,12 @@ class PhoneMetadata
return $this;
}
public function clearSameMobileAndFixedLinePattern()
{
$this->sameMobileAndFixedLinePattern = false;
return $this;
}
/**
* @return NumberFormat[]
*/
@@ -747,6 +818,12 @@ class PhoneMetadata
return $this;
}
public function clearLeadingZeroPossible()
{
$this->leadingZeroPossible = false;
return $this;
}
public function isMobileNumberPortableRegion()
{
return $this->mobileNumberPortableRegion;
@@ -758,6 +835,12 @@ class PhoneMetadata
return $this;
}
public function clearMobileNumberPortableRegion()
{
$this->mobileNumberPortableRegion = false;
return $this;
}
/**
* @param array $input
* @return PhoneMetadata
@@ -839,6 +922,11 @@ class PhoneMetadata
$this->setCarrierSpecific($desc->fromArray($input['carrierSpecific']));
}
if (isset($input['smsServices'])) {
$desc = new PhoneNumberDesc();
$this->setSmsServices($desc->fromArray($input['smsServices']));
}
if (isset($input['noInternationalDialling'])) {
$desc = new PhoneNumberDesc();
$this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling']));
@@ -888,9 +976,13 @@ class PhoneMetadata
$this->setLeadingDigits($input['leadingDigits']);
}
$this->setLeadingZeroPossible($input['leadingZeroPossible']);
if (isset($input['leadingZeroPossible'])) {
$this->setLeadingZeroPossible($input['leadingZeroPossible']);
}
$this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']);
if (isset($input['mobileNumberPortableRegion'])) {
$this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']);
}
return $this;
}

View File

@@ -68,7 +68,7 @@ class PhoneNumber implements \Serializable
*
* @var int|null
*/
protected $countryCodeSource = null;
protected $countryCodeSource = CountryCodeSource::UNSPECIFIED;
/**
* The carrier selection code that is preferred when calling this phone number domestically. This
* also includes codes that need to be dialed in some countries when calling from landlines to
@@ -187,7 +187,7 @@ class PhoneNumber implements \Serializable
*/
public function clearCountryCodeSource()
{
$this->countryCodeSource = null;
$this->countryCodeSource = CountryCodeSource::UNSPECIFIED;
return $this;
}
@@ -282,7 +282,7 @@ class PhoneNumber implements \Serializable
}
/**
* Returns the country code of this phone number.
* Returns the national number of this phone number.
*
* @return string|null The national number, or null if not set.
*/
@@ -444,7 +444,7 @@ class PhoneNumber implements \Serializable
*/
public function hasCountryCodeSource()
{
return isset($this->countryCodeSource);
return $this->countryCodeSource !== CountryCodeSource::UNSPECIFIED;
}
/**
@@ -597,6 +597,8 @@ class PhoneNumber implements \Serializable
$this->preferredDomesticCarrierCode
) = $data;
$this->hasNumberOfLeadingZeros = true;
if ($this->numberOfLeadingZeros > 1) {
$this->hasNumberOfLeadingZeros = true;
}
}
}

View File

@@ -9,8 +9,6 @@ class PhoneNumberDesc
{
protected $hasNationalNumberPattern = false;
protected $nationalNumberPattern = "";
protected $hasPossibleNumberPattern = false;
protected $possibleNumberPattern = "";
protected $hasExampleNumber = false;
protected $exampleNumber = "";
/**
@@ -32,11 +30,10 @@ class PhoneNumberDesc
*/
public function clear()
{
$this->nationalNumberPattern = "";
$this->possibleNumberPattern = "";
$this->clearNationalNumberPattern();
$this->clearPossibleLength();
$this->clearPossibleLengthLocalOnly();
$this->exampleNumber = "";
$this->clearExampleNumber();
return $this;
}
@@ -126,30 +123,12 @@ class PhoneNumberDesc
}
/**
* @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)
public function clearNationalNumberPattern()
{
$this->hasPossibleNumberPattern = true;
$this->possibleNumberPattern = $value;
$this->hasNationalNumberPattern = false;
$this->nationalNumberPattern = '';
return $this;
}
@@ -181,6 +160,17 @@ class PhoneNumberDesc
return $this;
}
/**
* @return PhoneNumberDesc
*/
public function clearExampleNumber()
{
$this->hasExampleNumber = false;
$this->exampleNumber = '';
return $this;
}
/**
* @param PhoneNumberDesc $other
* @return PhoneNumberDesc
@@ -190,9 +180,6 @@ class PhoneNumberDesc
if ($other->hasNationalNumberPattern()) {
$this->setNationalNumberPattern($other->getNationalNumberPattern());
}
if ($other->hasPossibleNumberPattern()) {
$this->setPossibleNumberPattern($other->getPossibleNumberPattern());
}
if ($other->hasExampleNumber()) {
$this->setExampleNumber($other->getExampleNumber());
}
@@ -209,7 +196,6 @@ class PhoneNumberDesc
public function exactlySameAs(PhoneNumberDesc $other)
{
return $this->nationalNumberPattern === $other->nationalNumberPattern &&
$this->possibleNumberPattern === $other->possibleNumberPattern &&
$this->exampleNumber === $other->exampleNumber;
}
@@ -222,9 +208,6 @@ class PhoneNumberDesc
if ($this->hasNationalNumberPattern()) {
$data['NationalNumberPattern'] = $this->getNationalNumberPattern();
}
if ($this->hasPossibleNumberPattern()) {
$data['PossibleNumberPattern'] = $this->getPossibleNumberPattern();
}
if ($this->hasExampleNumber()) {
$data['ExampleNumber'] = $this->getExampleNumber();
}
@@ -244,9 +227,6 @@ class PhoneNumberDesc
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']);
}

View File

@@ -0,0 +1,88 @@
<?php
namespace libphonenumber;
class PhoneNumberMatch
{
/**
* The start index into the text.
* @var int
*/
private $start;
/**
* The raw substring matched.
* @var string
*/
private $rawString;
/**
* The matched phone number.
* @var PhoneNumber
*/
private $number;
/**
* Creates a new match
*
* @param int $start The start index into the target text
* @param string $rawString The matched substring of the target text
* @param PhoneNumber $number The matched phone number
* @throws \NullPointerException
*/
public function __construct($start, $rawString, PhoneNumber $number)
{
if ($start < 0) {
throw new \InvalidArgumentException("Start index must be >= 0.");
}
if ($rawString === null) {
throw new \NullPointerException;
}
$this->start = $start;
$this->rawString = $rawString;
$this->number = $number;
}
/**
* Returns the phone number matched by the receiver.
* @return PhoneNumber
*/
public function number()
{
return $this->number;
}
/**
* Returns the start index of the matched phone number within the searched text.
* @return int
*/
public function start()
{
return $this->start;
}
/**
* Returns the exclusive end index of the matched phone number within the searched text.
* @return int
*/
public function end()
{
return $this->start + mb_strlen($this->rawString);
}
/**
* Returns the raw string matched as a phone number in the searched text.
* @return string
*/
public function rawString()
{
return $this->rawString;
}
public function __toString()
{
return "PhoneNumberMatch [{$this->start()},{$this->end()}) {$this->rawString}";
}
}

View File

@@ -0,0 +1,937 @@
<?php
namespace libphonenumber;
use libphonenumber\Leniency\AbstractLeniency;
/**
* A class that finds and extracts telephone numbers from $text.
* Instances can be created using PhoneNumberUtil::findNumbers()
*
* Vanity numbers (phone numbers using alphabetic digits such as '1-800-SIX-FLAGS' are
* not found.
*
* @package libphonenumber
*/
class PhoneNumberMatcher implements \Iterator
{
protected static $initialized = false;
/**
* The phone number pattern used by $this->find(), similar to
* PhoneNumberUtil::VALID_PHONE_NUMBER, but with the following differences:
* <ul>
* <li>All captures are limited in order to place an upper bound to the text matched by the
* pattern.
* <ul>
* <li>Leading punctuation / plus signs are limited.
* <li>Consecutive occurrences of punctuation are limited.
* <li>Number of digits is limited.
* </ul>
* <li>No whitespace is allowed at the start or end.
* <li>No alpha digits (vanity numbers such as 1-800-SIX-FLAGS) are currently supported.
* </ul>
*
* @var string
*/
protected static $pattern;
/**
* Matches strings that look like publication pages. Example:
* <pre>Computing Complete Answers to Queries in the Presence of Limited Access Patterns.
* Chen Li. VLDB J. 12(3): 211-227 (2003).</pre>
*
* The string "211-227 (2003)" is not a telephone number.
*
* @var string
*/
protected static $pubPages = "\\d{1,5}-+\\d{1,5}\\s{0,4}\\(\\d{1,4}";
/**
* Matches strings that look like dates using "/" as a separator. Examples 3/10/2011, 31/10/2011 or
* 08/31/95.
*
* @var string
*/
protected static $slashSeparatedDates = "(?:(?:[0-3]?\\d/[01]?\\d)|(?:[01]?\\d/[0-3]?\\d))/(?:[12]\\d)?\\d{2}";
/**
* Matches timestamps. Examples: "2012-01-02 08:00". Note that the reg-ex does not include the
* trailing ":\d\d" -- that is covered by timeStampsSuffix.
*
* @var string
*/
protected static $timeStamps = "[12]\\d{3}[-/]?[01]\\d[-/]?[0-3]\\d +[0-2]\\d$";
protected static $timeStampsSuffix = ":[0-5]\\d";
/**
* Pattern to check that brackets match. Opening brackets should be closed within a phone number.
* This also checks that there is something inside the brackets. Having no brackets at all is also
* fine.
*
* @var string
*/
protected static $matchingBrackets;
/**
* Patterns used to extract phone numbers from a larger phone-number-like pattern. These are
* ordered according to specificity. For example, white-space is last since that is frequently
* used in numbers, not just to separate two numbers. We have separate patterns since we don't
* want to break up the phone-number-like text on more than one different kind of symbol at one
* time, although symbols of the same type (e.g. space) can be safely grouped together.
*
* Note that if there is a match, we will always check any text found up to the first match as
* well.
*
* @var string[]
*/
protected static $innerMatches = array();
/**
* Punctuation that may be at the start of a phone number - brackets and plus signs.
*
* @var string
*/
protected static $leadClass;
/**
* Prefix of the files
* @var string
*/
protected static $alternateFormatsFilePrefix;
const META_DATA_FILE_PREFIX = 'PhoneNumberAlternateFormats';
protected static function init()
{
static::$alternateFormatsFilePrefix = dirname(__FILE__) . '/data/' . static::META_DATA_FILE_PREFIX;
static::$innerMatches = array(
// Breaks on the slash - e.g. "651-234-2345/332-445-1234"
"/+(.*)",
// Note that the bracket here is inside the capturing group, since we consider it part of the
// phone number. Will match a pattern like "(650) 223 3345 (754) 223 3321".
"(\\([^(]*)",
// Breaks on a hyphen - e.g. "12345 - 332-445-1234 is my number."
// We require a space on either side of the hyphen for it to be considered a separator.
"(?:\\p{Z}-|-\\p{Z})\\p{Z}*(.+)",
// Various types of wide hyphens. Note we have decided not to enforce a space here, since it's
// possible that it's supposed to be used to break two numbers without spaces, and we haven't
// seen many instances of it used within a number.
"[-―-]\\p{Z}*(.+)",
// Breaks on a full stop - e.g. "12345. 332-445-1234 is my number."
"\\.+\\p{Z}*([^.]+)",
// Breaks on space - e.g. "3324451234 8002341234"
"\\p{Z}+(\\P{Z}+)"
);
/*
* Builds the matchingBrackets and pattern regular expressions. The building blocks exist
* to make the pattern more easily understood.
*/
$openingParens = "(\\[\xEF\xBC\x88\xEF\xBC\xBB";
$closingParens = ")\\]\xEF\xBC\x89\xEF\xBC\xBD";
$nonParens = "[^" . $openingParens . $closingParens . "]";
// Limit on the number of pairs of brackets in a phone number.
$bracketPairLimit = static::limit(0, 3);
/*
* An opening bracket at the beginning may not be closed, but subsequent ones should be. It's
* also possible that the leading bracket was dropped, so we shouldn't be surprised if we see a
* closing bracket first. We limit the sets of brackets in a phone number to four.
*/
static::$matchingBrackets =
"(?:[" . $openingParens . "])?" . "(?:" . $nonParens . "+" . "[" . $closingParens . "])?"
. $nonParens . "+"
. "(?:[" . $openingParens . "]" . $nonParens . "+[" . $closingParens . "])" . $bracketPairLimit
. $nonParens . "*";
// Limit on the number of leading (plus) characters.
$leadLimit = static::limit(0, 2);
// Limit on the number of consecutive punctuation characters.
$punctuationLimit = static::limit(0, 4);
/*
* The maximum number of digits allowed in a digit-separated block. As we allow all digits in a
* single block, set high enough to accommodate the entire national number and the international
* country code
*/
$digitBlockLimit = PhoneNumberUtil::MAX_LENGTH_FOR_NSN + PhoneNumberUtil::MAX_LENGTH_COUNTRY_CODE;
/*
* Limit on the number of blocks separated by the punctuation. Uses digitBlockLimit since some
* formats use spaces to separate each digit
*/
$blockLimit = static::limit(0, $digitBlockLimit);
// A punctuation sequence allowing white space
$punctuation = '[' . PhoneNumberUtil::VALID_PUNCTUATION . ']' . $punctuationLimit;
// A digits block without punctuation.
$digitSequence = "\\p{Nd}" . static::limit(1, $digitBlockLimit);
$leadClassChars = $openingParens . PhoneNumberUtil::PLUS_CHARS;
$leadClass = '[' . $leadClassChars . ']';
static::$leadClass = $leadClass;
// Init extension patterns from PhoneNumberUtil
PhoneNumberUtil::initCapturingExtnDigits();
PhoneNumberUtil::initExtnPatterns();
// Phone number pattern allowing optional punctuation.
static::$pattern = "(?:" . $leadClass . $punctuation . ")" . $leadLimit
. $digitSequence . "(?:" . $punctuation . $digitSequence . ")" . $blockLimit
. "(?:" . PhoneNumberUtil::$EXTN_PATTERNS_FOR_MATCHING . ")?";
static::$initialized = true;
}
/**
* Helper function to generate regular expression with an upper and lower limit.
*
* @param int $lower
* @param int $upper
* @return string
*/
protected static function limit($lower, $upper)
{
if (($lower < 0) || ($upper <= 0) || ($upper < $lower)) {
throw new \InvalidArgumentException();
}
return '{' . $lower . ',' . $upper . '}';
}
/**
* The phone number utility.
* @var PhoneNumberUtil
*/
protected $phoneUtil;
/**
* The text searched for phone numbers.
* @var string
*/
protected $text;
/**
* The region (country) to assume for phone numbers without an international prefix, possibly
* null.
* @var string
*/
protected $preferredRegion;
/**
* The degrees of validation requested.
* @var AbstractLeniency
*/
protected $leniency;
/**
* The maximum number of retires after matching an invalid number.
* @var int
*/
protected $maxTries;
/**
* One of:
* - NOT_READY
* - READY
* - DONE
* @var string
*/
protected $state = 'NOT_READY';
/**
* The last successful match, null unless $this->state = READY
* @var PhoneNumberMatch
*/
protected $lastMatch;
/**
* The next index to start searching at. Undefined when $this->state = DONE
* @var int
*/
protected $searchIndex = 0;
/**
* Creates a new instance. See the factory methods in PhoneNumberUtil on how to obtain a new instance.
*
*
* @param PhoneNumberUtil $util The Phone Number Util to use
* @param string|null $text The text that we will search, null for no text
* @param string|null $country The country to assume for phone numbers not written in international format.
* (with a leading plus, or with the international dialling prefix of the specified region).
* May be null, or "ZZ" if only numbers with a leading plus should be considered.
* @param AbstractLeniency $leniency The leniency to use when evaluating candidate phone numbers
* @param int $maxTries The maximum number of invalid numbers to try before giving up on the text.
* This is to cover degenerate cases where the text has a lot of false positives in it. Must be >= 0
* @throws \NullPointerException
* @throws \InvalidArgumentException
*/
public function __construct(PhoneNumberUtil $util, $text, $country, AbstractLeniency $leniency, $maxTries)
{
if ($maxTries < 0) {
throw new \InvalidArgumentException();
}
$this->phoneUtil = $util;
$this->text = ($text !== null) ? $text : "";
$this->preferredRegion = $country;
$this->leniency = $leniency;
$this->maxTries = $maxTries;
if (static::$initialized === false) {
static::init();
}
}
/**
* Attempts to find the next subsequence in the searched sequence on or after {@code searchIndex}
* that represents a phone number. Returns the next match, null if none was found.
*
* @param int $index The search index to start searching at
* @return PhoneNumberMatch|null The Phone Number Match found, null if none can be found
*/
protected function find($index)
{
$matcher = new Matcher(static::$pattern, $this->text);
while (($this->maxTries > 0) && $matcher->find($index)) {
$start = $matcher->start();
$cutLength = $matcher->end() - $start;
$candidate = mb_substr($this->text, $start, $cutLength);
// Check for extra numbers at the end.
// TODO: This is the place to start when trying to support extraction of multiple phone number
// from split notations (+41 49 123 45 67 / 68).
$candidate = static::trimAfterFirstMatch(PhoneNumberUtil::$SECOND_NUMBER_START_PATTERN, $candidate);
$match = $this->extractMatch($candidate, $start);
if ($match !== null) {
return $match;
}
$index = $start + mb_strlen($candidate);
$this->maxTries--;
}
return null;
}
/**
* Trims away any characters after the first match of $pattern in $candidate,
* returning the trimmed version.
*
* @param string $pattern
* @param string $candidate
* @return string
*/
protected static function trimAfterFirstMatch($pattern, $candidate)
{
$trailingCharsMatcher = new Matcher($pattern, $candidate);
if ($trailingCharsMatcher->find()) {
$startChar = $trailingCharsMatcher->start();
$candidate = mb_substr($candidate, 0, $startChar);
}
return $candidate;
}
/**
* Helper method to determine if a character is a Latin-script letter or not. For our purposes,
* combining marks should also return true since we assume they have been added to a preceding
* Latin character.
*
* @param string $letter
* @return bool
* @internal
*/
public static function isLatinLetter($letter)
{
// Combining marks are a subset of non-spacing-mark.
if (preg_match('/\p{L}/u', $letter) !== 1 && preg_match('/\p{Mn}/u', $letter) !== 1) {
return false;
}
return (preg_match('/\p{Latin}/u', $letter) === 1)
|| (preg_match('/\pM+/u', $letter) === 1);
}
/**
* @param string $character
* @return bool
*/
protected static function isInvalidPunctuationSymbol($character)
{
return $character == '%' || preg_match('/\p{Sc}/u', $character);
}
/**
* Attempts to extract a match from a $candidate.
*
* @param string $candidate The candidate text that might contain a phone number
* @param int $offset The offset of $candidate within $this->text
* @return PhoneNumberMatch|null The match found, null if none can be found
*/
protected function extractMatch($candidate, $offset)
{
// Skip a match that is more likely to be a date.
$dateMatcher = new Matcher(static::$slashSeparatedDates, $candidate);
if ($dateMatcher->find()) {
return null;
}
// Skip potential time-stamps.
$timeStampMatcher = new Matcher(static::$timeStamps, $candidate);
if ($timeStampMatcher->find()) {
$followingText = mb_substr($this->text, $offset + mb_strlen($candidate));
$timeStampSuffixMatcher = new Matcher(static::$timeStampsSuffix, $followingText);
if ($timeStampSuffixMatcher->lookingAt()) {
return null;
}
}
// Try to come up with a valid match given the entire candidate.
$match = $this->parseAndVerify($candidate, $offset);
if ($match !== null) {
return $match;
}
// If that failed, try to find an "inner match" - there might be a phone number within this
// candidate.
return $this->extractInnerMatch($candidate, $offset);
}
/**
* Attempts to extract a match from $candidate if the whole candidate does not qualify as a
* match.
*
* @param string $candidate The candidate text that might contact a phone number
* @param int $offset The current offset of $candidate within $this->text
* @return PhoneNumberMatch|null The match found, null if none can be found
*/
protected function extractInnerMatch($candidate, $offset)
{
foreach (static::$innerMatches as $possibleInnerMatch) {
$groupMatcher = new Matcher($possibleInnerMatch, $candidate);
$isFirstMatch = true;
while ($groupMatcher->find() && $this->maxTries > 0) {
if ($isFirstMatch) {
// We should handle any group before this one too.
$group = static::trimAfterFirstMatch(PhoneNumberUtil::$UNWANTED_END_CHAR_PATTERN,
mb_substr($candidate, 0, $groupMatcher->start()));
$match = $this->parseAndVerify($group, $offset);
if ($match !== null) {
return $match;
}
$this->maxTries--;
$isFirstMatch = false;
}
$group = static::trimAfterFirstMatch(PhoneNumberUtil::$UNWANTED_END_CHAR_PATTERN,
$groupMatcher->group(1));
$match = $this->parseAndVerify($group, $offset + $groupMatcher->start(1));
if ($match !== null) {
return $match;
}
$this->maxTries--;
}
}
return null;
}
/**
* Parses a phone number from the $candidate} using PhoneNumberUtil::parse() and
* verifies it matches the requested leniency. If parsing and verification succeed, a
* corresponding PhoneNumberMatch is returned, otherwise this method returns null.
*
* @param string $candidate The candidate match
* @param int $offset The offset of $candidate within $this->text
* @return PhoneNumberMatch|null The parsed and validated phone number match, or null
*/
protected function parseAndVerify($candidate, $offset)
{
try {
// Check the candidate doesn't contain any formatting which would indicate that it really
// isn't a phone number
$matchingBracketsMatcher = new Matcher(static::$matchingBrackets, $candidate);
$pubPagesMatcher = new Matcher(static::$pubPages, $candidate);
if (!$matchingBracketsMatcher->matches() || $pubPagesMatcher->find()) {
return null;
}
// If leniency is set to VALID or stricter, we also want to skip numbers that are surrounded
// by Latin alphabetic characters, to skip cases like abc8005001234 or 8005001234def.
if ($this->leniency->compareTo(Leniency::VALID()) >= 0) {
// If the candidate is not at the start of the text, and does not start with phone-number
// punctuation, check the previous character.
$leadClassMatcher = new Matcher(static::$leadClass, $candidate);
if ($offset > 0 && !$leadClassMatcher->lookingAt()) {
$previousChar = mb_substr($this->text, $offset - 1, 1);
// We return null if it is a latin letter or an invalid punctuation symbol.
if (static::isInvalidPunctuationSymbol($previousChar) || static::isLatinLetter($previousChar)) {
return null;
}
}
$lastCharIndex = $offset + mb_strlen($candidate);
if ($lastCharIndex < mb_strlen($this->text)) {
$nextChar = mb_substr($this->text, $lastCharIndex, 1);
if (static::isInvalidPunctuationSymbol($nextChar) || static::isLatinLetter($nextChar)) {
return null;
}
}
}
$number = $this->phoneUtil->parseAndKeepRawInput($candidate, $this->preferredRegion);
// Check Israel * numbers: these are a special case in that they are four-digit numbers that
// our library supports, but they can only be dialled with a leading *. Since we don't
// actually store or detect the * in our phone number library, this means in practice we
// detect most four digit numbers as being valid for Israel. We are considering moving these
// numbers to ShortNumberInfo instead, in which case this problem would go away, but in the
// meantime we want to restrict the false matches so we only allow these numbers if they are
// preceded by a star. We enforce this for all leniency levels even though these numbers are
// technically accepted by isPossibleNumber and isValidNumber since we consider it to be a
// deficiency in those methods that they accept these numbers without the *.
// TODO: Remove this or make it significantly less hacky once we've decided how to
// handle these short codes going forward in ShortNumberInfo. We could use the formatting
// rules for instance, but that would be slower.
if ($this->phoneUtil->getRegionCodeForCountryCode($number->getCountryCode()) == "IL"
&& mb_strlen($this->phoneUtil->getNationalSignificantNumber($number)) === 4
&& ($offset === 0 || ($offset > 0 && mb_substr($this->text, $offset - 1, 1) != '*'))
) {
// No match.
return null;
}
if ($this->leniency->verify($number, $candidate, $this->phoneUtil)) {
// We used parseAndKeepRawInput to create this number, but for now we don't return the extra
// values parsed. TODO: stop clearing all values here and switch all users over
// to using rawInput() rather than the rawString() of PhoneNumberMatch
$number->clearCountryCodeSource();
$number->clearRawInput();
$number->clearPreferredDomesticCarrierCode();
return new PhoneNumberMatch($offset, $candidate, $number);
}
} catch (NumberParseException $e) {
// ignore and continue
}
return null;
}
/**
* @param PhoneNumberUtil $util
* @param PhoneNumber $number
* @param string $normalizedCandidate
* @param string[] $formattedNumberGroups
* @return bool
*/
public static function allNumberGroupsRemainGrouped(
PhoneNumberUtil $util,
PhoneNumber $number,
$normalizedCandidate,
$formattedNumberGroups
) {
$fromIndex = 0;
if ($number->getCountryCodeSource() !== CountryCodeSource::FROM_DEFAULT_COUNTRY) {
// First skip the country code if the normalized candidate contained it.
$countryCode = $number->getCountryCode();
$fromIndex = mb_strpos($normalizedCandidate, $countryCode) + mb_strlen($countryCode);
}
// Check each group of consecutive digits are not broken into separate groupings in the
// $normalizedCandidate string.
$formattedNumberGroupsLength = count($formattedNumberGroups);
for ($i = 0; $i < $formattedNumberGroupsLength; $i++) {
// Fails if the substring of $normalizedCandidate starting from $fromIndex
// doesn't contain the consecutive digits in $formattedNumberGroups[$i].
$fromIndex = mb_strpos($normalizedCandidate, $formattedNumberGroups[$i], $fromIndex);
if ($fromIndex === false) {
return false;
}
// Moves $fromIndex forward.
$fromIndex += mb_strlen($formattedNumberGroups[$i]);
if ($i === 0 && $fromIndex < mb_strlen($normalizedCandidate)) {
// We are at the position right after the NDC. We get the region used for formatting
// information based on the country code in the phone number, rather than the number itself,
// as we do not need to distinguish between different countries with the same country
// calling code and this is faster.
$region = $util->getRegionCodeForCountryCode($number->getCountryCode());
if ($util->getNddPrefixForRegion($region, true) !== null
&& is_int(mb_substr($normalizedCandidate, $fromIndex, 1))
) {
// This means there is no formatting symbol after the NDC. In this case, we only
// accept the number if there is no formatting symbol at all in the number, except
// for extensions. This is only important for countries with national prefixes.
$nationalSignificantNumber = $util->getNationalSignificantNumber($number);
return mb_substr(
mb_substr($normalizedCandidate, $fromIndex - mb_strlen($formattedNumberGroups[$i])),
mb_strlen($nationalSignificantNumber)
) === $nationalSignificantNumber;
}
}
}
// The check here makes sure that we haven't mistakenly already used the extension to
// match the last group of the subscriber number. Note the extension cannot have
// formatting in-between digits
if ($number->hasExtension()) {
return mb_strpos(mb_substr($normalizedCandidate, $fromIndex), $number->getExtension()) !== false;
}
return true;
}
/**
* @param PhoneNumberUtil $util
* @param PhoneNumber $number
* @param string $normalizedCandidate
* @param string[] $formattedNumberGroups
* @return bool
*/
public static function allNumberGroupsAreExactlyPresent(
PhoneNumberUtil $util,
PhoneNumber $number,
$normalizedCandidate,
$formattedNumberGroups
) {
$candidateGroups = preg_split(PhoneNumberUtil::NON_DIGITS_PATTERN, $normalizedCandidate);
// Set this to the last group, skipping it if the number has an extension.
$candidateNumberGroupIndex = $number->hasExtension() ? count($candidateGroups) - 2 : count($candidateGroups) - 1;
// First we check if the national significant number is formatted as a block.
// We use contains and not equals, since the national significant number may be present with
// a prefix such as a national number prefix, or the country code itself.
if (count($candidateGroups) == 1
|| mb_strpos($candidateGroups[$candidateNumberGroupIndex],
$util->getNationalSignificantNumber($number)) !== false
) {
return true;
}
// Starting from the end, go through in reverse, excluding the first group, and check the
// candidate and number groups are the same.
for ($formattedNumberGroupIndex = (count($formattedNumberGroups) - 1);
$formattedNumberGroupIndex > 0 && $candidateNumberGroupIndex >= 0;
$formattedNumberGroupIndex--, $candidateNumberGroupIndex--) {
if ($candidateGroups[$candidateNumberGroupIndex] != $formattedNumberGroups[$formattedNumberGroupIndex]) {
return false;
}
}
// Now check the first group. There may be a national prefix at the start, so we only check
// that the candidate group ends with the formatted number group.
return ($candidateNumberGroupIndex >= 0
&& mb_substr($candidateGroups[$candidateNumberGroupIndex],
-mb_strlen($formattedNumberGroups[0])) == $formattedNumberGroups[0]);
}
/**
* Helper method to get the national-number part of a number, formatted without any national
* prefix, and return it as a set of digit blocks that would be formatted together.
*
* @param PhoneNumberUtil $util
* @param PhoneNumber $number
* @param NumberFormat $formattingPattern
* @return string[]
*/
protected static function getNationalNumberGroups(
PhoneNumberUtil $util,
PhoneNumber $number,
NumberFormat $formattingPattern = null
) {
if ($formattingPattern === null) {
// This will be in the format +CC-DG;ext=EXT where DG represents groups of digits.
$rfc3966Format = $util->format($number, PhoneNumberFormat::RFC3966);
// We remove the extension part from the formatted string before splitting it into different
// groups.
$endIndex = mb_strpos($rfc3966Format, ';');
if ($endIndex === false) {
$endIndex = mb_strlen($rfc3966Format);
}
// The country-code will have a '-' following it.
$startIndex = mb_strpos($rfc3966Format, '-') + 1;
return explode('-', mb_substr($rfc3966Format, $startIndex, $endIndex - $startIndex));
} else {
// We format the NSN only, and split that according to the separator.
$nationalSignificantNumber = $util->getNationalSignificantNumber($number);
return explode('-', $util->formatNsnUsingPattern($nationalSignificantNumber, $formattingPattern,
PhoneNumberFormat::RFC3966));
}
}
/**
* @param PhoneNumber $number
* @param string $candidate
* @param PhoneNumberUtil $util
* @param \Closure $checker
* @return bool
*/
public static function checkNumberGroupingIsValid(
PhoneNumber $number,
$candidate,
PhoneNumberUtil $util,
\Closure $checker
) {
// TODO: Evaluate how this works for other locales (testing has been limited to NANPA regions)
// and optimise if necessary.
$normalizedCandidate = PhoneNumberUtil::normalizeDigits($candidate, true /* keep non-digits */);
$formattedNumberGroups = static::getNationalNumberGroups($util, $number, null);
if ($checker($util, $number, $normalizedCandidate, $formattedNumberGroups)) {
return true;
}
// If this didn't pass, see if there are any alternative formats, and try them instead.
$alternateFormats = static::getAlternateFormatsForCountry($number->getCountryCode());
if ($alternateFormats !== null) {
foreach ($alternateFormats->numberFormats() as $alternateFormat) {
$formattedNumberGroups = static::getNationalNumberGroups($util, $number, $alternateFormat);
if ($checker($util, $number, $normalizedCandidate, $formattedNumberGroups)) {
return true;
}
}
}
return false;
}
/**
* @param PhoneNumber $number
* @param string $candidate
* @return bool
*/
public static function containsMoreThanOneSlashInNationalNumber(PhoneNumber $number, $candidate)
{
$firstSlashInBodyIndex = mb_strpos($candidate, '/');
if ($firstSlashInBodyIndex === false) {
// No slashes, this is okay
return false;
}
// Now look for a second one.
$secondSlashInBodyIndex = mb_strpos($candidate, '/', $firstSlashInBodyIndex + 1);
if ($secondSlashInBodyIndex === false) {
// Only one slash, this is okay
return false;
}
// If the first slash is after the country calling code, this is permitted
$candidateHasCountryCode = ($number->getCountryCodeSource() === CountryCodeSource::FROM_NUMBER_WITH_PLUS_SIGN
|| $number->getCountryCodeSource() === CountryCodeSource::FROM_NUMBER_WITHOUT_PLUS_SIGN);
if ($candidateHasCountryCode
&& PhoneNumberUtil::normalizeDigitsOnly(
mb_substr($candidate, 0, $firstSlashInBodyIndex)
) == $number->getCountryCode()
) {
// Any more slashes and this is illegal
return (mb_strpos(mb_substr($candidate, $secondSlashInBodyIndex + 1), '/') !== false);
}
return true;
}
/**
* @param PhoneNumber $number
* @param string $candidate
* @param PhoneNumberUtil $util
* @return bool
*/
public static function containsOnlyValidXChars(PhoneNumber $number, $candidate, PhoneNumberUtil $util)
{
// The characters 'x' and 'X' can be (1) a carrier code, in which case they always precede the
// national significant number or (2) an extension sign, in which case they always precede the
// extension number. We assume a carrier code is more than 1 digit, so the first case has to
// have more than 1 consecutive 'x' or 'X', whereas the second case can only have exactly 1 'x'
// or 'X'. We ignore the character if it appears as the last character of the string.
$candidateLength = mb_strlen($candidate);
for ($index = 0; $index < $candidateLength - 1; $index++) {
$charAtIndex = mb_substr($candidate, $index, 1);
if ($charAtIndex == 'x' || $charAtIndex == 'X') {
$charAtNextIndex = mb_substr($candidate, $index + 1, 1);
if ($charAtNextIndex == 'x' || $charAtNextIndex == 'X') {
// This is the carrier code case, in which the 'X's always precede the national
// significant number.
$index++;
if ($util->isNumberMatch($number, mb_substr($candidate, $index)) != MatchType::NSN_MATCH) {
return false;
}
} elseif (!PhoneNumberUtil::normalizeDigitsOnly(mb_substr($candidate,
$index)) == $number->getExtension()
) {
// This is the extension sign case, in which the 'x' or 'X' should always precede the
// extension number
return false;
}
}
}
return true;
}
/**
* @param PhoneNumber $number
* @param PhoneNumberUtil $util
* @return bool
*/
public static function isNationalPrefixPresentIfRequired(PhoneNumber $number, PhoneNumberUtil $util)
{
// First, check how we deduced the country code. If it was written in international format, then
// the national prefix is not required.
if ($number->getCountryCodeSource() !== CountryCodeSource::FROM_DEFAULT_COUNTRY) {
return true;
}
$phoneNumberRegion = $util->getRegionCodeForCountryCode($number->getCountryCode());
$metadata = $util->getMetadataForRegion($phoneNumberRegion);
if ($metadata === null) {
return true;
}
// Check if a national prefix should be present when formatting this number.
$nationalNumber = $util->getNationalSignificantNumber($number);
$formatRule = $util->chooseFormattingPatternForNumber($metadata->numberFormats(), $nationalNumber);
// To do this, we check that a national prefix formatting rule was present and that it wasn't
// just the first-group symbol ($1) with punctuation.
if (($formatRule !== null) && mb_strlen($formatRule->getNationalPrefixFormattingRule()) > 0) {
if ($formatRule->getNationalPrefixOptionalWhenFormatting()) {
// The national-prefix is optional in these cases, so we don't need to check if it was
// present.
return true;
}
if (PhoneNumberUtil::formattingRuleHasFirstGroupOnly($formatRule->getNationalPrefixFormattingRule())) {
// National Prefix not needed for this number.
return true;
}
// Normalize the remainder.
$rawInputCopy = PhoneNumberUtil::normalizeDigitsOnly($number->getRawInput());
$rawInput = $rawInputCopy;
// Check if we found a national prefix and/or carrier code at the start of the raw input, and
// return the result.
$carrierCode = null;
return $util->maybeStripNationalPrefixAndCarrierCode($rawInput, $metadata, $carrierCode);
}
return true;
}
/**
* Storage for Alternate Formats
* @var PhoneMetadata[]
*/
protected static $callingCodeToAlternateFormatsMap = array();
/**
* @param $countryCallingCode
* @return PhoneMetadata|null
*/
protected static function getAlternateFormatsForCountry($countryCallingCode)
{
$countryCodeSet = AlternateFormatsCountryCodeSet::$alternateFormatsCountryCodeSet;
if (!in_array($countryCallingCode, $countryCodeSet)) {
return null;
}
if (!isset(static::$callingCodeToAlternateFormatsMap[$countryCallingCode])) {
static::loadAlternateFormatsMetadataFromFile($countryCallingCode);
}
return static::$callingCodeToAlternateFormatsMap[$countryCallingCode];
}
/**
* @param string $countryCallingCode
* @throws \Exception
*/
protected static function loadAlternateFormatsMetadataFromFile($countryCallingCode)
{
$fileName = static::$alternateFormatsFilePrefix . '_' . $countryCallingCode . '.php';
if (!is_readable($fileName)) {
throw new \Exception('missing metadata: ' . $fileName);
}
$metadataLoader = new DefaultMetadataLoader();
$data = $metadataLoader->loadMetadata($fileName);
$metadata = new PhoneMetadata();
$metadata->fromArray($data);
static::$callingCodeToAlternateFormatsMap[$countryCallingCode] = $metadata;
}
/**
* Return the current element
* @link http://php.net/manual/en/iterator.current.php
* @return PhoneNumberMatch|null
*/
public function current()
{
return $this->lastMatch;
}
/**
* Move forward to next element
* @link http://php.net/manual/en/iterator.next.php
* @return void Any returned value is ignored.
*/
public function next()
{
$this->lastMatch = $this->find($this->searchIndex);
if ($this->lastMatch === null) {
$this->state = 'DONE';
} else {
$this->searchIndex = $this->lastMatch->end();
$this->state = 'READY';
}
$this->searchIndex++;
}
/**
* Return the key of the current element
* @link http://php.net/manual/en/iterator.key.php
* @return mixed scalar on success, or null on failure.
* @since 5.0.0
*/
public function key()
{
return $this->searchIndex;
}
/**
* Checks if current position is valid
* @link http://php.net/manual/en/iterator.valid.php
* @return boolean The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
* @since 5.0.0
*/
public function valid()
{
return $this->state === 'READY';
}
/**
* Rewind the Iterator to the first element
* @link http://php.net/manual/en/iterator.rewind.php
* @return void Any returned value is ignored.
* @since 5.0.0
*/
public function rewind()
{
$this->searchIndex = 0;
$this->next();
}
}

View File

@@ -32,7 +32,7 @@ class PhoneNumberToCarrierMapper
protected function __construct($phonePrefixDataDirectory)
{
$this->prefixFileReader = new PrefixFileReader(dirname(__FILE__) . $phonePrefixDataDirectory);
$this->prefixFileReader = new PrefixFileReader(__DIR__ . DIRECTORY_SEPARATOR . $phonePrefixDataDirectory);
$this->phoneUtil = PhoneNumberUtil::getInstance();
}

View File

@@ -90,7 +90,7 @@ class PhoneNumberToTimeZonesMapper
if ($numberType === PhoneNumberType::UNKNOWN) {
return $this->unknownTimeZoneList;
} elseif (!!PhoneNumberUtil::getInstance()->isNumberGeographical($numberType, $number->getCountryCode())) {
} elseif (!PhoneNumberUtil::getInstance()->isNumberGeographical($numberType, $number->getCountryCode())) {
return $this->getCountryLevelTimeZonesforNumber($number);
}

View File

@@ -44,4 +44,25 @@ class PhoneNumberType
// Standard Rate
const STANDARD_RATE = 30;
public static function values()
{
return array(
self::FIXED_LINE => 'FIXED_LINE',
self::MOBILE => 'MOBILE',
self::FIXED_LINE_OR_MOBILE => 'FIXED_LINE_OR_MOBILE',
self::TOLL_FREE => 'TOLL_FREE',
self::PREMIUM_RATE => 'PREMIUM_RATE',
self::SHARED_COST => 'SHARED_COST',
self::VOIP => 'VOIP',
self::PERSONAL_NUMBER => 'PERSONAL_NUMBER',
self::PAGER => 'PAGER',
self::UAN => 'UAN',
self::UNKNOWN => 'UNKNOWN',
self::EMERGENCY => 'EMERGENCY',
self::VOICEMAIL => 'VOICEMAIL',
self::SHORT_CODE => 'SHORT_CODE',
self::STANDARD_RATE => 'STANDARD_RATE',
);
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace libphonenumber;
/**
* Class RegexBasedMatcher
* @package libphonenumber
* @internal
*/
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 $number
* @param PhoneNumberDesc $numberDesc
* @param boolean $allowPrefixMatch
* @return boolean
*/
public function matchNationalNumber($number, PhoneNumberDesc $numberDesc, $allowPrefixMatch)
{
$nationalNumberPattern = $numberDesc->getNationalNumberPattern();
// We don't want to consider it a prefix match when matching non-empty input against an empty
// pattern
if (strlen($nationalNumberPattern) === 0) {
return false;
}
return $this->match($number, $nationalNumberPattern, $allowPrefixMatch);
}
/**
* @param string $number
* @param string $pattern
* @param $allowPrefixMatch
* @return bool
*/
private function match($number, $pattern, $allowPrefixMatch)
{
$matcher = new Matcher($pattern, $number);
if (!$matcher->lookingAt()) {
return false;
} else {
return ($matcher->matches()) ? true : $allowPrefixMatch;
}
}
}

View File

@@ -56,6 +56,7 @@ class RegionCode
const SE = "SE";
const SG = "SG";
const US = "US";
const UZ = 'UZ';
const YT = "YT";
const ZW = "ZW";
// Official code for the unknown region.

View File

@@ -149,15 +149,17 @@ class ShortNumberInfo
$fileName = $filePrefix . '_' . ($isNonGeoRegion ? $countryCallingCode : $regionCode) . '.php';
if (!is_readable($fileName)) {
throw new \Exception('missing metadata: ' . $fileName);
}
$metadataLoader = new DefaultMetadataLoader();
$data = $metadataLoader->loadMetadata($fileName);
$metadata = new PhoneMetadata();
$metadata->fromArray($data);
if ($isNonGeoRegion) {
$this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode] = $metadata;
} else {
$data = include $fileName;
$metadata = new PhoneMetadata();
$metadata->fromArray($data);
if ($isNonGeoRegion) {
$this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode] = $metadata;
} else {
$this->regionToMetadataMap[$regionCode] = $metadata;
}
$this->regionToMetadataMap[$regionCode] = $metadata;
}
}
@@ -248,18 +250,19 @@ class ShortNumberInfo
&& !in_array($regionCode, static::$regionsWhereEmergencyNumbersMustBeExact)
);
return $this->matcherAPI->matchesNationalNumber($normalizedNumber, $emergencyDesc, $allowPrefixMatchForRegion);
return $this->matcherAPI->matchNationalNumber($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
* implied about its validity). Carrier-specific numbers may connect to a different end-point, or
* not connect at all, depending on the user's carrier. 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).
* @return boolean whether the short number is carrier-specific, assuming the input was a valid short
* number
*/
public function isCarrierSpecific(PhoneNumber $number)
{
@@ -274,6 +277,59 @@ class ShortNumberInfo
));
}
/**
* Given a valid short number, determines whether it is carrier-specific when dialed from the
* given region (however, nothing is implied about its validity). Carrier-specific numbers may
* connect to a different end-point, or not connect at all, depending on the user's carrier. If
* it is important that the number is valid, then its validity must first be checked using
* {@link #isValidShortNumber} or {@link #isValidShortNumberForRegion}. Returns false if the
* number doesn't match the region provided.
* @param PhoneNumber $number The valid short number to check
* @param string $regionDialingFrom The region from which the number is dialed
* @return bool Whether the short number is carrier-specific in the provided region, assuming the
* input was a valid short number
*/
public function isCarrierSpecificForRegion(PhoneNumber $number, $regionDialingFrom)
{
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return false;
}
$nationalNumber = $this->getNationalSignificantNumber($number);
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
return ($phoneMetadata !== null)
&& ($this->matchesPossibleNumberAndNationalNumber($nationalNumber, $phoneMetadata->getCarrierSpecific()));
}
/**
* Given a valid short number, determines whether it is an SMS service (however, nothing is
* implied about its validity). An SMS service is where the primary or only intended usage is to
* receive and/or send text messages (SMSs). This includes MMS as MMS numbers downgrade to SMS if
* the other party isn't MMS-capable. If it is important that the number is valid, then its
* validity must first be checked using {@link #isValidShortNumber} or {@link
* #isValidShortNumberForRegion}. Returns false if the number doesn't match the region provided.
*
* @param PhoneNumber $number The valid short number to check
* @param string $regionDialingFrom The region from which the number is dialed
* @return bool Whether the short number is an SMS service in the provided region, assuming the input
* was a valid short number.
*/
public function isSmsServiceForRegion(PhoneNumber $number, $regionDialingFrom)
{
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return false;
}
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
return ($phoneMetadata !== null)
&& $this->matchesPossibleNumberAndNationalNumber(
$this->getNationalSignificantNumber($number),
$phoneMetadata->getSmsServices()
);
}
/**
* 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
@@ -317,7 +373,7 @@ class ShortNumberInfo
public function isPossibleShortNumber(PhoneNumber $number)
{
$regionCodes = $this->getRegionCodesForCountryCode($number->getCountryCode());
$shortNumber = $this->getNationalSignificantNumber($number);
$shortNumberLength = strlen($this->getNationalSignificantNumber($number));
foreach ($regionCodes as $region) {
$phoneMetadata = $this->getMetadataForRegion($region);
@@ -326,7 +382,7 @@ class ShortNumberInfo
continue;
}
if ($this->matcherAPI->matchesPossibleNumber($shortNumber, $phoneMetadata->getGeneralDesc())) {
if (in_array($shortNumberLength, $phoneMetadata->getGeneralDesc()->getPossibleLength())) {
return true;
}
}
@@ -339,39 +395,24 @@ class ShortNumberInfo
* 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 PhoneNumber $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)
public function isPossibleShortNumberForRegion(PhoneNumber $shortNumber, $regionDialingFrom)
{
if ($shortNumber instanceof PhoneNumber) {
if (!$this->regionDialingFromMatchesNumber($shortNumber, $regionDialingFrom)) {
return false;
}
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());
}
$numberLength = strlen($this->getNationalSignificantNumber($shortNumber));
return in_array($numberLength, $phoneMetadata->getGeneralDesc()->getPossibleLength());
}
/**
@@ -401,16 +442,14 @@ class ShortNumberInfo
* 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 PhoneNumber $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)
public function isValidShortNumberForRegion(PhoneNumber $number, $regionDialingFrom)
{
if ($number instanceof PhoneNumber) {
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return false;
}
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return false;
}
$phoneMetadata = $this->getMetadataForRegion($regionDialingFrom);
@@ -418,18 +457,7 @@ class ShortNumberInfo
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;
}
$shortNumber = $this->getNationalSignificantNumber($number);
$generalDesc = $phoneMetadata->getGeneralDesc();
@@ -450,26 +478,24 @@ class ShortNumberInfo
* Example usage:
* <pre>{@code
* $shortInfo = ShortNumberInfo::getInstance();
* $shortNumber = "110";
* $shortNumber = PhoneNumberUtil::parse("110", "US);
* $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,
* @param PhoneNumber $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)
public function getExpectedCostForRegion(PhoneNumber $number, $regionDialingFrom)
{
if ($number instanceof PhoneNumber) {
if (!$this->regionDialingFromMatchesNumber($number, $regionDialingFrom)) {
return ShortNumberCost::UNKNOWN_COST;
}
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);
@@ -477,17 +503,13 @@ class ShortNumberInfo
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;
$shortNumber = $this->getNationalSignificantNumber($number);
// The possible lengths are not present for a particular sub-type if they match the general
// description; for this reason, we check the possible lengths against the general description
// first to allow an early exit if possible.
if (!in_array(strlen($shortNumber), $phoneMetadata->getGeneralDesc()->getPossibleLength())) {
return ShortNumberCost::UNKNOWN_COST;
}
// The cost categories are tested in order of decreasing expense, since if for some reason the
@@ -611,15 +633,18 @@ class ShortNumberInfo
}
/**
* // TODO: Once we have benchmarked ShortnumberInfo, consider if it is worth keeping
* this performance optimization, and if so move this into the matcher implementation
* TODO: Once we have benchmarked ShortnumberInfo, consider if it is worth keeping
* this performance optimization.
* @param string $number
* @param PhoneNumberDesc $numberDesc
* @return bool
*/
protected function matchesPossibleNumberAndNationalNumber($number, PhoneNumberDesc $numberDesc)
{
return ($this->matcherAPI->matchesPossibleNumber($number, $numberDesc)
&& $this->matcherAPI->matchesNationalNumber($number, $numberDesc, false));
if (count($numberDesc->getPossibleLength()) > 0 && !in_array(strlen($number), $numberDesc->getPossibleLength())) {
return false;
}
return $this->matcherAPI->matchNationalNumber($number, $numberDesc, false);
}
}

View File

@@ -193,68 +193,70 @@ class ShortNumbersRegionCodeSet {
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',
176 => 'PS',
177 => 'PT',
178 => 'PW',
179 => 'PY',
180 => 'QA',
181 => 'RE',
182 => 'RO',
183 => 'RS',
184 => 'RU',
185 => 'RW',
186 => 'SA',
187 => 'SB',
188 => 'SC',
189 => 'SD',
190 => 'SE',
191 => 'SG',
192 => 'SH',
193 => 'SI',
194 => 'SJ',
195 => 'SK',
196 => 'SL',
197 => 'SM',
198 => 'SN',
199 => 'SO',
200 => 'SR',
201 => 'ST',
202 => 'SV',
203 => 'SX',
204 => 'SY',
205 => 'SZ',
206 => 'TC',
207 => 'TD',
208 => 'TG',
209 => 'TH',
210 => 'TJ',
211 => 'TL',
212 => 'TM',
213 => 'TN',
214 => 'TO',
215 => 'TR',
216 => 'TT',
217 => 'TV',
218 => 'TW',
219 => 'TZ',
220 => 'UA',
221 => 'UG',
222 => 'US',
223 => 'UY',
224 => 'UZ',
225 => 'VA',
226 => 'VC',
227 => 'VE',
228 => 'VG',
229 => 'VI',
230 => 'VN',
231 => 'VU',
232 => 'WF',
233 => 'WS',
234 => 'XK',
235 => 'YE',
236 => 'YT',
237 => 'ZA',
238 => 'ZM',
239 => 'ZW',
);
}

View File

@@ -0,0 +1,45 @@
<?php
namespace libphonenumber;
/**
* Possible outcomes when testing if a PhoneNumber is possible.
*/
class ValidationResult
{
/**
* The number length matches that of valid numbers for this region
*/
const IS_POSSIBLE = 0;
/**
* The number has an invalid country calling code.
*/
const INVALID_COUNTRY_CODE = 1;
/**
* The number is shorter than all valid numbers for this region.
*/
const TOO_SHORT = 2;
/**
* The number is longer than all valid numbers for this region.
*/
const TOO_LONG = 3;
/**
* The number length matches that of local numbers for this region only (i.e. numbers that may
* be able to be dialled within an area, but do not have all the information to be dialled from
* anywhere inside or outside the country).
*/
const IS_POSSIBLE_LOCAL_ONLY = 4;
/**
* The number is longer than the shortest valid numbers for this region, shorter than the
* longest valid numbers for this region, and does not itself have a number length that matches
* valid numbers for this region. This can also be returned in the case where
* isPossibleNumberForTypeWithReason was called, and there are no numbers of this type at all
* for this region.
*/
const INVALID_LENGTH = 5;
}

View File

@@ -0,0 +1,228 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
'ar' =>
array (
0 => 965,
),
'be' =>
array (
0 => 375,
),
'en' =>
array (
0 => 1,
1 => 20,
2 => 211,
3 => 212,
4 => 213,
5 => 216,
6 => 220,
7 => 221,
8 => 222,
9 => 223,
10 => 224,
11 => 225,
12 => 226,
13 => 227,
14 => 228,
15 => 229,
16 => 230,
17 => 231,
18 => 232,
19 => 233,
20 => 234,
21 => 235,
22 => 236,
23 => 237,
24 => 238,
25 => 239,
26 => 240,
27 => 241,
28 => 242,
29 => 243,
30 => 244,
31 => 245,
32 => 248,
33 => 249,
34 => 250,
35 => 251,
36 => 252,
37 => 253,
38 => 254,
39 => 255,
40 => 256,
41 => 257,
42 => 258,
43 => 260,
44 => 261,
45 => 262,
46 => 263,
47 => 264,
48 => 265,
49 => 267,
50 => 268,
51 => 269,
52 => 27,
53 => 297,
54 => 298,
55 => 299,
56 => 30,
57 => 31,
58 => 32,
59 => 33,
60 => 34,
61 => 350,
62 => 351,
63 => 352,
64 => 353,
65 => 354,
66 => 355,
67 => 356,
68 => 357,
69 => 358,
70 => 359,
71 => 36,
72 => 370,
73 => 372,
74 => 373,
75 => 374,
76 => 375,
77 => 376,
78 => 380,
79 => 381,
80 => 382,
81 => 383,
82 => 385,
83 => 386,
84 => 387,
85 => 389,
86 => 39,
87 => 40,
88 => 41,
89 => 420,
90 => 421,
91 => 423,
92 => 43,
93 => 44,
94 => 45,
95 => 47,
96 => 48,
97 => 49,
98 => 501,
99 => 502,
100 => 503,
101 => 505,
102 => 506,
103 => 507,
104 => 508,
105 => 509,
106 => 51,
107 => 53,
108 => 54,
109 => 55,
110 => 56,
111 => 57,
112 => 58,
113 => 590,
114 => 591,
115 => 592,
116 => 593,
117 => 594,
118 => 595,
119 => 596,
120 => 597,
121 => 598,
122 => 599,
123 => 60,
124 => 61,
125 => 62,
126 => 63,
127 => 64,
128 => 65,
129 => 66,
130 => 670,
131 => 673,
132 => 674,
133 => 675,
134 => 676,
135 => 677,
136 => 678,
137 => 679,
138 => 680,
139 => 685,
140 => 686,
141 => 688,
142 => 689,
143 => 7,
144 => 84,
145 => 852,
146 => 853,
147 => 855,
148 => 856,
149 => 86,
150 => 880,
151 => 886,
152 => 90,
153 => 91,
154 => 92,
155 => 93,
156 => 94,
157 => 95,
158 => 960,
159 => 961,
160 => 962,
161 => 963,
162 => 964,
163 => 965,
164 => 966,
165 => 967,
166 => 968,
167 => 970,
168 => 971,
169 => 972,
170 => 973,
171 => 974,
172 => 975,
173 => 976,
174 => 977,
175 => 98,
176 => 992,
177 => 993,
178 => 994,
179 => 995,
180 => 996,
181 => 998,
),
'fa' =>
array (
0 => 93,
1 => 98,
),
'ru' =>
array (
0 => 374,
1 => 375,
2 => 7,
),
'zh' =>
array (
0 => 852,
1 => 86,
),
'zh_Hant' =>
array (
0 => 852,
1 => 86,
),
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
9655 => 'فيفا',
9656 => 'الوطنية',
9659 => 'زين',
);

View File

@@ -0,0 +1,21 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
37525 => 'БеСТ',
375292 => 'МТС',
375294 => 'БелСел',
375295 => 'МТС',
375297 => 'МТС',
375298 => 'МТС',
37533 => 'МТС',
);

View File

@@ -0,0 +1,740 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
1242357 => 'BaTelCo',
1242359 => 'BaTelCo',
1242375 => 'BaTelCo',
1242376 => 'BaTelCo',
1242395 => 'BaTelCo',
1242421 => 'BaTelCo',
1242422 => 'BaTelCo',
1242423 => 'BaTelCo',
1242424 => 'BaTelCo',
1242425 => 'BaTelCo',
1242426 => 'BaTelCo',
1242427 => 'BaTelCo',
1242428 => 'BaTelCo',
1242429 => 'BaTelCo',
1242431 => 'BaTelCo',
1242432 => 'BaTelCo',
1242433 => 'BaTelCo',
1242434 => 'BaTelCo',
1242435 => 'BaTelCo',
1242436 => 'BaTelCo',
1242437 => 'BaTelCo',
1242438 => 'BaTelCo',
1242439 => 'BaTelCo',
1242441 => 'BaTelCo',
1242442 => 'BaTelCo',
1242443 => 'BaTelCo',
1242445 => 'BaTelCo',
1242446 => 'BaTelCo',
1242447 => 'BaTelCo',
1242448 => 'BaTelCo',
1242449 => 'BaTelCo',
1242451 => 'BaTelCo',
1242452 => 'BaTelCo',
1242453 => 'BaTelCo',
1242454 => 'BaTelCo',
1242455 => 'BaTelCo',
1242456 => 'BaTelCo',
1242457 => 'BaTelCo',
1242458 => 'BaTelCo',
1242462 => 'BaTelCo',
1242463 => 'BaTelCo',
1242464 => 'BaTelCo',
1242465 => 'BaTelCo',
1242466 => 'BaTelCo',
1242467 => 'BaTelCo',
1242468 => 'BaTelCo',
124247 => 'BaTelCo',
1242481 => 'BaTelCo',
1242524 => 'BaTelCo',
1242525 => 'BaTelCo',
1242533 => 'BaTelCo',
1242535 => 'BaTelCo',
1242544 => 'BaTelCo',
1242551 => 'BaTelCo',
1242552 => 'BaTelCo',
1242553 => 'BaTelCo',
1242554 => 'BaTelCo',
1242556 => 'BaTelCo',
1242557 => 'BaTelCo',
1242558 => 'BaTelCo',
1242559 => 'BaTelCo',
1242565 => 'BaTelCo',
1242577 => 'BaTelCo',
1242636 => 'BaTelCo',
1242646 => 'BaTelCo',
1242727 => 'BaTelCo',
1242738 => 'aliv',
1242801 => 'aliv',
1242802 => 'aliv',
1242803 => 'aliv',
1242804 => 'aliv',
1242805 => 'aliv',
1242806 => 'aliv',
1242807 => 'aliv',
1242808 => 'aliv',
1242809 => 'aliv',
1242810 => 'aliv',
1242812 => 'aliv',
1242813 => 'aliv',
1242814 => 'aliv',
1242815 => 'aliv',
1242816 => 'aliv',
1242817 => 'aliv',
1242818 => 'aliv',
1242819 => 'aliv',
124282 => 'aliv',
1242889 => 'aliv',
1242899 => 'aliv',
124623 => 'LIME',
124624 => 'LIME',
1246250 => 'LIME',
1246251 => 'LIME',
1246252 => 'LIME',
1246253 => 'LIME',
1246254 => 'LIME',
1246255 => 'LIME',
1246256 => 'Digicel',
1246257 => 'Digicel',
1246258 => 'Digicel',
1246259 => 'Digicel',
124626 => 'Digicel',
124628 => 'LIME',
124645 => 'Sunbeach Communications',
1246695 => 'Ozone',
1246696 => 'Ozone',
1246697 => 'Ozone',
124682 => 'Digicel',
124683 => 'Digicel',
124684 => 'Digicel',
124685 => 'Digicel',
1246883 => 'Digicel',
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',
1268713 => 'Digicel',
1268714 => 'Digicel',
1268715 => 'Digicel',
1268716 => 'Digicel',
1268717 => 'Digicel',
1268718 => 'Digicel',
1268719 => 'Digicel',
1268720 => 'Digicel',
1268721 => 'Digicel',
1268722 => 'Digicel',
1268724 => 'Digicel',
1268725 => 'Digicel',
1268726 => 'Digicel',
1268727 => 'APUA',
1268729 => 'APUA',
1268732 => 'Digicel',
1268734 => 'Digicel',
1268736 => 'Digicel',
1268773 => 'APUA',
1268774 => 'APUA',
1268775 => 'APUA',
1268780 => 'APUA',
1268781 => 'APUA',
1268783 => 'Digicel',
1268785 => 'Digicel',
1268788 => 'Digicel',
1284300 => 'Digicel',
1284340 => 'Digicel',
1284341 => 'Digicel',
1284342 => 'Digicel',
1284343 => 'Digicel',
1284344 => 'Digicel',
1284345 => 'Digicel',
1284346 => 'Digicel',
1284347 => 'Digicel',
1284368 => 'Digicel',
1284393 => 'Digicel',
1284394 => 'Digicel',
1284440 => 'CCT',
1284441 => 'CCT',
1284442 => 'CCT',
1284443 => 'CCT',
1284444 => 'CCT',
1284445 => 'CCT',
1284446 => 'CCT',
12844689 => 'CCT',
12844966 => 'CCT',
12844967 => 'CCT',
12844968 => 'CCT',
12844969 => 'CCT',
1284499 => 'CCT',
1345321 => 'Digicel',
1345322 => 'Digicel',
1345323 => 'Digicel',
1345324 => 'Digicel',
1345325 => 'Digicel',
1345326 => 'Digicel',
1345327 => 'Digicel',
1345328 => 'Digicel',
1345329 => 'Digicel',
1345516 => 'Digicel',
1345517 => 'Digicel',
1345525 => 'Digicel',
1345526 => 'Digicel',
1345527 => 'Digicel',
1345529 => 'Digicel',
1345546 => 'Digicel',
1345547 => 'Digicel',
1345548 => 'Digicel',
1345549 => 'Digicel',
1345550 => 'Digicel',
1345649 => 'Digicel',
14413 => 'Mobility',
144150 => 'Digicel Bermuda',
144151 => 'Digicel Bermuda',
144152 => 'Digicel Bermuda',
144153 => 'Digicel Bermuda',
144159 => 'Digicel Bermuda',
14417 => 'Cellular One',
1473402 => 'Affordable Island Communications',
147341 => 'Digicel Grenada',
1473420 => 'Digicel Grenada',
1473421 => 'Digicel Grenada',
1473422 => 'Digicel Grenada',
1473423 => 'Digicel Grenada',
1473424 => 'Digicel Grenada',
1473425 => 'Digicel Grenada',
1473520 => 'Affordable Island Communications',
1473521 => 'Affordable Island Communications',
147353 => 'AWS Grenada',
1473901 => 'Affordable Island Communications',
164923 => 'C&W',
164924 => 'C&W',
164933 => 'Digicel',
164934 => 'Digicel',
164943 => 'Islandcom',
1671480 => 'GTA',
1671482 => 'GTA',
1671483 => 'GTA',
1671486 => 'GTA',
1671487 => 'GTA',
1671488 => 'GTA',
1671489 => 'GTA',
1671747 => 'PTI PACIFICA',
1671838 => 'i CAN_GSM',
1671848 => 'i CAN_GSM',
1671858 => 'i CAN_GSM',
1671864 => 'GTA',
1671868 => 'Choice Phone',
1671878 => 'Choice Phone',
1671888 => 'Choice Phone',
1671898 => 'Choice Phone',
1684252 => 'Blue Sky',
1684254 => 'Blue Sky',
1684256 => 'Blue Sky',
1684258 => 'Blue Sky',
1684272 => 'Blue Sky',
1684731 => 'ASTCA',
1684733 => 'ASTCA',
1684770 => 'ASTCA',
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',
1758518 => 'Digicel',
1758519 => 'Digicel',
175852 => 'AT&T',
1758520 => 'Digicel',
1758584 => 'Cable & Wireless',
17587 => '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',
1767315 => 'Digicel',
1767316 => 'Digicel',
1767317 => 'Digicel',
1767611 => 'Digicel',
1767612 => 'Digicel',
1767613 => 'Digicel',
1767614 => 'Digicel',
1767615 => 'Digicel',
1767616 => 'Digicel',
1767617 => 'Digicel',
1784430 => 'AT&T',
1784431 => 'AT&T',
1784432 => 'AT&T',
1784433 => 'Digicel',
1784434 => 'Digicel',
1784435 => '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',
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',
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',
1868266 => 'bmobile',
1868267 => 'bmobile',
1868268 => 'bmobile',
1868269 => 'bmobile',
186827 => 'bmobile',
186828 => 'bmobile',
186829 => 'bmobile',
18683 => 'Digicel',
18684 => 'bmobile',
18686 => 'bmobile',
18687 => 'bmobile',
1869556 => 'CariGlobe St. Kitts',
1869557 => 'CariGlobe St. Kitts',
1869558 => 'CariGlobe St. Kitts',
1869565 => 'The Cable St. Kitts',
1869566 => 'The Cable St. Kitts',
1869567 => 'The Cable St. Kitts',
1869660 => 'Cable & Wireless',
1869661 => 'Cable & Wireless',
1869662 => 'Cable & Wireless',
1869663 => 'Cable & Wireless',
1869664 => 'Cable & Wireless',
1869665 => 'Cable & Wireless',
1869667 => 'Cable & Wireless',
1869668 => 'Cable & Wireless',
1869669 => 'Cable & Wireless',
1869760 => 'Digicel',
1869762 => 'Digicel',
1869763 => 'Digicel',
1869764 => 'Digicel',
1869765 => 'Digicel',
1869766 => 'Digicel',
187624 => 'Digicel',
187625 => 'Digicel',
187626 => 'Digicel',
1876275 => 'Digicel',
1876276 => 'Digicel',
1876277 => 'Digicel',
1876278 => 'Digicel',
1876279 => 'Digicel',
187628 => 'Digicel',
187629 => 'Digicel',
187630 => 'Digicel',
187635 => 'Digicel',
187636 => 'Digicel',
187637 => 'Digicel',
187638 => 'Digicel',
187639 => 'Digicel',
187640 => 'Digicel',
187641 => 'Digicel',
187642 => 'Digicel',
187643 => 'Digicel',
1876440 => 'Digicel',
1876441 => 'Digicel',
1876442 => 'Digicel',
1876443 => 'Digicel',
1876445 => 'Digicel',
1876446 => 'Digicel',
1876447 => 'Digicel',
1876448 => 'Digicel',
1876449 => 'Digicel',
187645 => 'Digicel',
187646 => 'Digicel',
187647 => 'Digicel',
187648 => 'Digicel',
187649 => 'Digicel',
1876503 => 'Digicel',
1876504 => 'Digicel',
1876505 => 'Digicel',
1876506 => 'Digicel',
1876507 => 'Digicel',
1876508 => 'Digicel',
1876509 => 'Digicel',
187652 => 'Digicel',
1876550 => 'Digicel',
1876551 => 'Digicel',
1876552 => 'Digicel',
1876553 => 'Digicel',
1876554 => 'Digicel',
1876556 => 'Digicel',
1876557 => 'Digicel',
1876558 => 'Digicel',
1876559 => 'Digicel',
1876560 => 'Digicel',
1876561 => 'Digicel',
1876562 => 'Digicel',
1876564 => 'Digicel',
1876565 => 'Digicel',
1876566 => 'Digicel',
1876567 => 'Digicel',
1876568 => 'Digicel',
1876569 => 'Digicel',
187657 => 'Digicel',
187658 => 'Digicel',
187659 => 'Digicel',
187684 => 'Digicel',
187685 => 'Digicel',
187686 => 'Digicel',
187687 => 'Digicel',
187688 => 'Digicel',
187689 => 'Digicel',
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,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2010 => 'Vodafone',
2011 => 'Etisalat',
2012 => 'Orange',
2015 => 'TE',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
21191 => 'Zain',
21192 => 'MTN',
21195 => 'Vivacell',
21197 => 'Gemtel',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
@@ -104,9 +110,13 @@ return array (
212698 => 'Inwi',
212699 => 'Inwi',
212700 => 'Inwi',
212706 => 'Inwi',
212707 => 'Inwi',
212761 => 'Maroc Telecom',
212762 => 'Maroc Telecom',
212766 => 'Maroc Telecom',
212767 => 'Maroc Telecom',
212770 => 'Méditel',
212771 => 'Méditel',
212777 => 'Méditel',
);

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
21354 => 'Ooredoo',
21355 => 'Ooredoo',
21356 => 'Ooredoo',
2136 => 'Mobilis',
21377 => 'Djezzy',
21379 => 'Djezzy',
);

View File

@@ -0,0 +1,24 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2162 => 'Ooredoo',
21640 => 'Tunisie Telecom',
21641 => 'Tunisie Telecom',
21642 => 'Tunisie Telecom',
21643 => 'Lyca Mobile',
21644 => 'Tunisie Telecom',
21645 => 'Watany Ettisalat',
21646 => 'Ooredoo',
2165 => 'Orange',
2169 => 'Tunisie Telecom',
);

View File

@@ -0,0 +1,19 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2202 => 'Africell',
2203 => 'QCell',
2206 => 'Comium',
2207 => 'Africell',
2209 => 'Gamcel',
);

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
22170 => 'Expresso',
22172 => 'HAYO',
22176 => 'Tigo',
22177 => 'Orange',
22178 => 'Orange',
22179 => 'ADIE',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2222 => 'Chinguitel',
2223 => 'Mattel',
2224 => 'Mauritel',
);

View File

@@ -0,0 +1,32 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2232079 => 'Sotelma',
223217 => 'Sotelma',
22350 => 'Atel',
2236 => 'Sotelma',
2237 => 'Orange',
22382 => 'Orange',
22383 => 'Orange',
22389 => 'Sotelma',
22390 => 'Orange',
22391 => 'Orange',
22392 => 'Orange',
22393 => 'Orange',
22394 => 'Orange',
22395 => 'Sotelma',
22396 => 'Sotelma',
22397 => 'Sotelma',
22398 => 'Sotelma',
22399 => 'Sotelma',
);

View File

@@ -0,0 +1,19 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
22460 => 'Sotelgui',
22462 => 'Orange',
22463 => 'Intercel',
22465 => 'Cellcom',
22466 => 'Areeba',
);

View File

@@ -0,0 +1,66 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
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',
22550 => 'Moov',
22551 => 'Moov',
22552 => 'Moov',
22553 => 'Moov',
22554 => 'MTN',
22555 => 'MTN',
22556 => 'MTN',
22557 => 'Orange',
22558 => 'Orange',
22559 => 'Orange',
22560 => 'GreenN',
22561 => 'GreenN',
22564 => 'MTN',
22565 => 'MTN',
22566 => 'MTN',
22567 => 'Orange',
22568 => 'Orange',
22569 => 'Aircom',
22571 => 'Moov',
22572 => 'Moov',
22573 => 'Moov',
22574 => 'MTN',
22575 => 'MTN',
22576 => 'MTN',
22577 => 'Orange',
22578 => 'Orange',
22579 => 'Orange',
22584 => 'MTN',
22585 => 'MTN',
22586 => 'MTN',
22587 => 'Orange',
22588 => 'Orange',
22589 => 'Orange',
);

View File

@@ -0,0 +1,41 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
22651 => 'Telmob',
22652 => 'Telmob',
22654 => 'Orange',
22655 => 'Airtel',
22656 => 'Airtel',
22657 => 'Orange',
22658 => 'Telecel Faso',
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,26 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
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,24 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
22870 => 'TOGOCEL',
22879 => 'Moov',
22890 => 'TOGOCEL',
22891 => 'TOGOCEL',
22892 => 'TOGOCEL',
22893 => 'TOGOCEL',
22896 => 'Moov',
22897 => 'TOGOCEL',
22898 => 'Moov',
22899 => 'Moov',
);

View File

@@ -0,0 +1,31 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
22960 => 'Moov',
22961 => 'MTN',
22962 => 'MTN',
22963 => 'Moov',
22964 => 'Moov',
22965 => 'Moov',
22966 => 'MTN',
22967 => 'MTN',
22968 => 'Moov',
22969 => 'MTN',
22990 => 'Libercom',
22993 => 'BLK',
22994 => 'Moov',
22995 => 'Moov',
22997 => 'MTN',
22998 => 'Moov',
22999 => 'Moov',
);

View File

@@ -1,11 +1,18 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
230525 => 'Cellplus',
230528 => 'MTML',
230529 => 'MTML',
2305421 => 'Emtel',
2305422 => 'Emtel',
@@ -13,7 +20,7 @@ return array (
2305428 => 'Emtel',
2305429 => 'Emtel',
230544 => 'Emtel',
2305471 => 'Mauritius Telecom',
2305471 => 'Cellplus',
2305472 => 'Emtel',
2305473 => 'Emtel',
2305474 => 'Emtel',
@@ -22,6 +29,7 @@ return array (
2305477 => 'Emtel',
2305478 => 'Emtel',
2305479 => 'Emtel',
230548 => 'Emtel',
230549 => 'Emtel',
230570 => 'Cellplus',
230571 => 'Emtel',
@@ -36,6 +44,8 @@ return array (
230580 => 'Cellplus',
230581 => 'Cellplus',
230582 => 'Cellplus',
230583 => 'Cellplus',
230584 => 'Emtel',
230585 => 'Emtel',
230586 => 'MTML',
2305871 => 'MTML',

View File

@@ -0,0 +1,19 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
23120 => 'LIBTELCO',
231330 => 'West Africa Telecom',
231555 => 'Novafone',
23177 => 'Cellcom',
23188 => 'Lonestar Cell',
);

View File

@@ -0,0 +1,34 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
23221 => 'Sierratel',
23225 => 'Sierratel',
23230 => 'Africell',
23231 => 'QCELL',
23233 => 'Comium',
23234 => 'QCELL',
23235 => 'IPTEL',
23240 => 'Datatel/Cellcom',
23244 => 'Intergroup',
23250 => 'Datatel/Cellcom',
23255 => 'AFCOM',
23266 => 'Onlime',
23275 => 'Orange',
23276 => 'Airtel',
23277 => 'Africell',
23278 => 'Airtel',
23279 => 'Airtel',
23280 => 'Africell',
23288 => 'Africell',
23299 => 'Africell',
);

View File

@@ -0,0 +1,31 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
23320 => 'Vodafone',
23323 => 'Globacom (Zain)',
23324 => 'MTN',
23326 => 'Airtel',
23327 => 'tiGO',
23328 => 'Expresso',
23350 => 'Vodafone',
23354 => 'MTN',
233553 => 'MTN',
233554 => 'MTN',
233555 => 'MTN',
233556 => 'MTN',
233557 => 'MTN',
233558 => 'MTN',
233560 => 'Airtel',
233561 => 'Airtel',
23357 => 'tiGO',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
@@ -144,6 +150,7 @@ return array (
234704 => 'Visafone',
234705 => 'Glo',
234706 => 'MTN',
234707 => 'Zoom',
234708 => 'Airtel',
234709 => 'Multilinks',
2347380 => 'Starcomms',
@@ -174,7 +181,7 @@ return array (
234806 => 'MTN',
234807 => 'Glo',
234808 => 'Airtel',
234809 => 'Etisalat',
234809 => '9mobile',
234810 => 'MTN',
234811 => 'Glo',
234812 => 'Airtel',
@@ -182,8 +189,8 @@ return array (
234814 => 'MTN',
234815 => 'Glo',
234816 => 'MTN',
234817 => 'Etisalat',
234818 => 'Etisalat',
234817 => '9mobile',
234818 => '9mobile',
2348190 => 'Starcomms',
2348191 => 'Starcomms',
2348283 => 'Starcomms',
@@ -241,9 +248,10 @@ return array (
234902 => 'Airtel',
234903 => 'MTN',
234905 => 'Glo',
234906 => 'MTN',
234907 => 'Airtel',
234908 => 'Etisalat',
234909 => 'Etisalat',
234908 => '9mobile',
234909 => '9mobile',
234980 => 'Starcomms',
234987 => 'Starcomms',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2356 => 'Airtel',
23577 => 'Sotel',
2359 => 'Millicom',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
23670 => 'TC',
23672 => 'Orange',
23675 => 'CTP',
23677 => 'Nationlink',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (

View File

@@ -0,0 +1,30 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
23833 => 'T+',
23836 => 'CVMOVEL',
23843 => 'T+',
23846 => 'CVMOVEL',
23851 => 'T+',
23852 => 'T+',
23853 => 'T+',
23858 => 'CVMOVEL',
23859 => 'CVMOVEL',
23891 => 'T+',
23892 => 'T+',
23893 => 'T+',
23895 => 'CVMOVEL',
23897 => 'CVMOVEL',
23898 => 'CVMOVEL',
23899 => 'CVMOVEL',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
23990 => 'Unitel',
23998 => 'CSTmovel',
23999 => 'CSTmovel',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2405 => 'Orange GQ',
2406 => 'Orange GQ',
2407 => 'Orange GQ',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (

View File

@@ -0,0 +1,19 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
24201 => 'Equateur Telecom',
24204 => 'Warid',
24205 => 'Celtel',
24206 => 'MTN',
2428001 => 'Hightech Pro',
);

View File

@@ -0,0 +1,25 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
24380 => 'Supercell',
24381 => 'Vodacom',
24382 => 'Vodacom',
24384 => 'CCT',
24388 => 'Yozma Timeturns sprl -YTT',
24389 => 'Tigo',
24390 => 'Africell',
24391 => 'Africell',
24397 => 'Zain',
24398 => 'Zain',
24399 => 'Zain',
);

View File

@@ -0,0 +1,19 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
24491 => 'Movicel',
24492 => 'UNITEL',
24493 => 'UNITEL',
24494 => 'UNITEL',
24499 => 'Movicel',
);

View File

@@ -0,0 +1,19 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
24595 => 'Orange',
245965 => 'Spacetel',
245966 => 'Spacetel',
245969 => 'Spacetel',
245977 => 'Guinetel',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
24825 => 'CWS',
24826 => 'CWS',
24827 => 'Airtel',
24828 => 'Airtel',
);

View File

@@ -0,0 +1,24 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
24910 => 'Sudatel',
24911 => 'Sudatel',
24912 => 'Sudatel',
24990 => 'Zain',
24991 => 'Zain',
24992 => 'MTN',
24993 => 'MTN',
24995 => 'Network of The World Ltd',
24996 => 'Zain',
24999 => 'MTN',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25072 => 'TIGO',
25073 => 'Airtel',
25078 => 'MTN',
);

View File

@@ -0,0 +1,15 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2519 => 'Ethio Telecom',
);

View File

@@ -0,0 +1,41 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25224 => 'Telesom',
25228 => 'Nationlink',
25235 => 'AirSom',
25239 => 'AirSom',
25248 => 'AirSom',
25249 => 'AirSom',
25262 => 'Somtel',
25263 => 'Telesom',
25264 => 'Somali Networks',
25265 => 'Somtel',
25266 => 'Somtel',
25267 => 'Nationlink',
25268 => 'Nationlink',
25269 => 'Nationlink',
25279 => 'Somtel',
25280 => 'Somali Networks',
25288 => 'Somali Networks',
252906 => 'Golis Telecom',
252907 => 'Golis Telecom',
25292 => 'STG',
25293 => 'STG',
25294 => 'STG',
25295 => 'STG',
25296 => 'STG',
25297 => 'STG',
25298 => 'STG',
25299 => 'STG',
);

View File

@@ -0,0 +1,15 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25377 => 'Evatis',
);

View File

@@ -0,0 +1,45 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25470 => 'Safaricom',
25471 => 'Safaricom',
25472 => 'Safaricom',
25473 => 'Airtel',
254740 => 'Safaricom',
254741 => 'Safaricom',
254742 => 'Safaricom',
254743 => 'Safaricom',
254744 => 'Homeland Media',
254745 => 'Safaricom',
254746 => 'Safaricom',
254747 => 'JTL',
254748 => 'Safaricom',
254749 => 'WiAfrica',
25475 => 'Airtel',
254757 => 'Safaricom',
254758 => 'Safaricom',
254759 => 'Safaricom',
254760 => 'Mobile Pay',
254761 => 'Airtel',
254762 => 'Airtel',
254763 => 'Finserve',
254764 => 'Finserve',
254765 => 'Finserve',
254766 => 'Finserve',
254767 => 'Sema Mobile',
254768 => 'Airtel',
254769 => 'Airtel',
25477 => 'Telkom',
25478 => 'Airtel',
25479 => 'Safaricom',
);

View File

@@ -0,0 +1,29 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25562 => 'Viettel',
25563 => 'MTC',
25564 => 'Cootel',
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,25 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25670 => 'Airtel',
25671 => 'UTL',
256720 => 'Smile',
256723 => 'Afrimax',
2567260 => 'Tangerine',
256730 => 'K2',
25674 => 'Sure Telecom',
25675 => 'Airtel',
25677 => 'MTN',
25678 => 'MTN',
25679 => 'Africell',
);

View File

@@ -0,0 +1,26 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25729 => 'Leo',
25731 => 'Viettel',
25761 => 'Viettel',
25768 => 'Viettel',
25769 => 'Viettel',
25771 => 'Leo',
25772 => 'Leo',
25775 => 'Smart Mobile',
25776 => 'Leo',
25777 => 'Onatel',
25778 => 'Smart Mobile',
25779 => 'Leo',
);

View File

@@ -0,0 +1,20 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
25882 => 'mcel',
25883 => 'mcel',
25884 => 'Vodacom',
25885 => 'Vodacom',
25886 => 'Movitel',
25887 => 'Movitel',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
26095 => 'ZAMTEL',
26096 => 'MTN',
26097 => 'Airtel',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
26132 => 'Orange',
26133 => 'Airtel',
26134 => 'Telma',
26139 => 'Blueline',
);

View File

@@ -0,0 +1,122 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
26263900 => 'Orange',
26263901 => 'Orange',
26263902 => 'Orange',
26263903 => 'Only',
26263904 => 'Only',
26263905 => 'Only',
26263906 => 'Only',
26263907 => 'Only',
26263909 => 'SFR',
26263910 => 'SFR',
26263911 => 'SFR',
26263919 => 'Only',
2626392 => 'SFR',
26263926 => 'Only',
26263930 => 'BJT',
26263939 => 'Only',
26263940 => 'SFR',
26263950 => 'BJT',
26263960 => 'Orange',
26263961 => 'Orange',
26263962 => 'Orange',
26263963 => 'Orange',
26263964 => 'Orange',
26263965 => 'SFR',
26263966 => 'SFR',
26263967 => 'SFR',
26263968 => 'SFR',
26263969 => 'SFR',
26263970 => 'BJT',
26263971 => 'Only',
26263972 => 'Only',
26263973 => 'Only',
26263974 => 'Only',
26263975 => 'Only',
26263976 => 'Orange',
26263990 => 'BJT',
26263994 => 'Only',
26263995 => 'Only',
26263996 => 'Only',
26263997 => 'Only',
26263999 => 'Orange',
2626920 => 'Orange',
26269206 => 'SFR',
2626921 => 'SFR',
2626922 => 'Orange',
2626923 => 'Orange',
26269240 => 'Orange',
26269241 => 'Orange',
26269242 => 'Orange',
26269243 => 'Orange',
26269244 => 'Orange',
26269245 => 'SFR',
26269246 => 'SFR',
26269247 => 'SFR',
26269248 => 'SFR',
26269249 => 'SFR',
2626925 => 'SFR',
2626926 => 'SFR',
2626927 => 'SFR',
2626928 => 'SFR',
26269290 => 'SFR',
26269291 => 'SFR',
26269292 => 'Only',
26269293 => 'Only',
26269294 => 'Only',
26269295 => 'SFR',
26269296 => 'SFR',
26269297 => 'SFR',
26269298 => 'SFR',
26269299 => 'SFR',
26269300 => 'Orange',
26269301 => 'SFR',
26269302 => 'SFR',
26269303 => 'SFR',
26269304 => 'SFR',
26269306 => 'Orange',
26269310 => 'SFR',
26269311 => 'Orange',
26269313 => 'SFR',
26269320 => 'SFR',
26269321 => 'Orange',
26269322 => 'Orange',
26269330 => 'Only',
26269331 => 'Only',
26269332 => 'Only',
26269333 => 'Orange',
26269339 => 'Orange',
2626934 => 'Only',
26269350 => 'Only',
26269355 => 'Orange',
26269360 => 'Only',
26269366 => 'Orange',
26269370 => 'Only',
26269371 => 'Only',
26269372 => 'Only',
26269377 => 'Orange',
26269380 => 'Only',
26269381 => 'Only',
26269382 => 'Only',
26269383 => 'Only',
26269388 => 'Orange',
26269390 => 'Orange',
26269391 => 'Orange',
26269392 => 'Orange',
26269393 => 'Orange',
26269394 => 'SFR',
26269397 => 'SFR',
26269399 => 'Orange',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
26371 => 'Net*One',
26373 => 'Telecel',
26377 => 'Econet',
26378 => 'Econet',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
26460 => 'Telecom Namibia',
26481 => 'MTC',
26482 => 'Telecom Namibia',
26485 => 'TN Mobile',
);

View File

@@ -0,0 +1,16 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
26588 => 'TNM',
26599 => 'Airtel',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
26876 => 'Swazi MTN',
26877 => 'SPTC',
26878 => 'Swazi MTN',
26879 => 'Swazi MTN',
);

View File

@@ -0,0 +1,16 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2693 => 'Comores Telecom',
2694 => 'TELCO',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
@@ -41,6 +47,14 @@ return array (
27645 => 'Cell C',
27646 => 'Vodacom',
27647 => 'Vodacom',
27648 => 'Vodacom',
27649 => 'Vodacom',
27660 => 'Vodacom',
27661 => 'Vodacom',
27662 => 'Vodacom',
27663 => 'Vodacom',
27664 => 'Vodacom',
27665 => 'Vodacom',
27710 => 'MTN',
27711 => 'Vodacom',
27712 => 'Vodacom',

View File

@@ -0,0 +1,31 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
297290 => 'Digicel',
29756 => 'SETAR',
29759 => 'SETAR',
297630 => 'Digicel',
297640 => 'Digicel',
297641 => 'Digicel',
297642 => 'Digicel',
29766 => 'SETAR',
29769 => 'SETAR',
29773 => 'Digicel',
29774 => 'Digicel',
297770 => 'SETAR',
297777 => 'SETAR',
297995 => 'SETAR',
297996 => 'SETAR',
297997 => 'SETAR',
297998 => 'SETAR',
);

View File

@@ -0,0 +1,18 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2982 => 'Faroese Telecom',
2985 => 'Vodafone',
2986 => 'Vodafone',
2987 => 'Vodafone',
);

View File

@@ -0,0 +1,17 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
2992 => 'TELE Greenland A/S',
2994 => 'TELE Greenland A/S',
2995 => 'TELE Greenland A/S',
);

View File

@@ -0,0 +1,92 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
30685185 => 'Cyta',
3068519 => 'Cyta',
30685500 => 'Cyta',
30685501 => 'BWS',
30685505 => 'Cyta',
30685550 => 'Cyta',
30685555 => 'Cyta',
30685585 => 'Cyta',
30687500 => 'BWS',
30688500 => 'BWS',
30689900 => 'OTEGlobe',
306900 => 'BWS',
30690100 => 'MI Carrier Services',
30690199 => 'BWS',
30690200 => 'MI Carrier Services',
30690299 => 'BWS',
30690300 => 'MI Carrier Services',
30690399 => 'BWS',
30690400 => 'MI Carrier Services',
30690499 => 'BWS',
30690500 => 'MI Carrier Services',
30690555 => 'AMD Telecom',
30690574 => 'BWS',
30690599 => 'BWS',
306906 => 'Wind',
306907 => 'Wind',
306908 => 'Wind',
306909 => 'Wind',
30691000 => 'BWS',
30691234 => 'M-STAT',
30691345 => 'Nova',
30691400 => 'AMD Telecom',
30691600 => 'Compatel',
30691700 => 'Inter Telecom',
30691888 => 'OSE',
30692354 => 'Premium Net International',
30692428 => 'Premium Net International',
30693 => 'Wind',
30694 => 'Vodafone',
306950 => 'Vodafone',
306951 => 'Vodafone',
30695200 => 'Compatel',
30695210 => 'MI Carrier Services',
3069522 => 'Vodafone',
3069523 => 'Vodafone',
30695290 => 'MI Carrier Services',
30695299 => 'BWS',
3069530 => 'Cyta',
30695310 => 'MI Carrier Services',
30695328 => 'Premium Net International',
30695330 => 'Apifon',
30695340 => 'AMD Telecom',
30695355 => 'Cyta',
30695400 => 'AMD Telecom',
30695410 => 'MI Carrier Services',
30695490 => 'MI Carrier Services',
30695499 => 'M-STAT',
306955 => 'Vodafone',
306956 => 'Vodafone',
306957 => 'Vodafone',
306958 => 'Vodafone',
306959 => 'Vodafone',
3069601 => 'OTE',
30697 => 'Cosmote',
30698 => 'Cosmote',
3069900 => 'Wind',
30699022 => 'Yuboto',
30699046 => 'Premium Net International',
30699048 => 'AMD Telecom',
306991 => 'Wind',
306992 => 'Wind',
306993 => 'Wind',
306994 => 'Wind',
306995 => 'Wind',
306996 => 'Wind',
306997 => 'Wind',
306998 => 'Wind',
306999 => 'Wind',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (

View File

@@ -0,0 +1,54 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
32456 => 'JIM Mobile',
32460 => 'Proximus',
324618 => 'N.M.B.S.',
324630 => 'TISMI BV',
324651 => 'Lycamobile',
324652 => 'Lycamobile',
324653 => 'Lycamobile',
324654 => 'Lycamobile',
324655 => 'Lycamobile',
324656 => 'Lycamobile',
324657 => 'Lycamobile',
324659 => 'Lycamobile',
324660 => 'Lycamobile',
324661 => 'Lycamobile',
324662 => 'Lycamobile',
324663 => 'Lycamobile',
324664 => 'Lycamobile',
324665 => 'Vectone',
324666 => 'Vectone',
324667 => 'Vectone',
324669 => 'Voxbone SA',
324671 => 'Join Experience Belgium',
324672 => 'Join Experience Belgium',
324676 => 'Lycamobile',
324681 => 'Telenet',
324682 => 'Telenet',
324683 => 'Telenet',
324684 => 'Telenet',
324685 => 'Telenet',
324687 => 'Premium Routing GmbH',
324688 => 'Premium Routing GmbH',
3247 => 'Proximus',
32483 => 'Telenet',
32484 => 'Telenet',
32485 => 'Telenet',
32486 => 'Telenet',
32487 => 'Telenet',
32488 => 'Telenet',
32489 => 'Telenet',
3249 => 'Orange',
);

View File

@@ -1,7 +1,13 @@
<?php
/**
* This file is automatically @generated by {@link GeneratePhonePrefixData}.
* Please don't modify it directly.
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (

View File

@@ -0,0 +1,358 @@
<?php
/**
* This file has been @generated by a phing task by {@link GeneratePhonePrefixData}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
34600 => 'Vodafone',
346010 => 'Vodafone',
346011 => 'Vodafone',
346012 => 'Vodafone',
346013 => 'Vodafone',
346014 => 'Vodafone',
346015 => 'HITS',
346016 => 'Lcrcom',
346017 => 'Vodafone',
346020 => 'Lycamobile',
346021 => 'Lycamobile',
3460221 => 'Ion mobile',
3460222 => 'Vozelia',
3460224 => 'Oceans',
3460225 => 'VozTelecom',
3460229 => 'Boutique',
346023 => 'Lycamobile',
346024 => 'Lebara',
346025 => 'Lebara',
346026 => 'Lebara',
346027 => 'Lebara',
346028 => 'Lycamobile',
346029 => 'DIA',
346030 => 'Vodafone',
3460305 => 'Lebara',
3460306 => 'Lebara',
3460307 => 'Lebara',
3460308 => 'Lebara',
3460309 => 'Lebara',
346031 => 'Lebara',
346032 => 'Lebara',
346033 => 'Lebara',
346034 => 'Vodafone',
346035 => 'Vodafone',
346036 => 'Vodafone',
346037 => 'Vodafone',
346038 => 'Vodafone',
346039 => 'Lebara',
346040 => 'R',
346041 => 'Lebara',
346042 => 'Lebara',
346043 => 'Lebara',
34605 => 'Orange',
3460529 => 'MasMovil',
34606 => 'Movistar',
34607 => 'Vodafone',
34608 => 'Movistar',
34609 => 'Movistar',
34610 => 'Vodafone',
346110 => 'Republica Movil',
346112 => 'Lebara',
346113 => 'Lebara',
346120 => 'Syma',
346121 => 'Syma',
346122 => 'Lycamobile',
346124 => 'Lycamobile',
346125 => 'Lycamobile',
34615 => 'Orange',
34616 => 'Movistar',
34617 => 'Vodafone',
34618 => 'Movistar',
34619 => 'Movistar',
34620 => 'Movistar',
346212 => 'Ion mobile',
34622 => 'Yoigo',
346230 => 'Yoigo',
346231 => 'Yoigo',
34625 => 'Orange',
3462529 => 'MasMovil',
34626 => 'Movistar',
34627 => 'Vodafone',
34628 => 'Movistar',
34629 => 'Movistar',
34630 => 'Movistar',
34631 => 'Lycamobile',
34632 => 'Lycamobile',
34633 => 'Yoigo',
346340 => 'Lebara',
346341 => 'Lebara',
346342 => 'Vodafone',
346343 => 'HITS',
346344 => 'Eroski movil',
346345 => 'PepePhone',
346346 => 'Vodafone',
346347 => 'Vodafone',
346348 => 'Vodafone',
346349 => 'Vodafone',
34635 => 'Orange',
3463529 => 'MasMovil',
34636 => 'Movistar',
34637 => 'Vodafone',
34638 => 'Movistar',
34639 => 'Movistar',
346400 => 'Orange',
346401 => 'Orange',
346402 => 'Orange',
346403 => 'Orange',
346404 => 'MasMovil',
346405 => 'Orange',
346406 => 'Orange',
346407 => 'Orange',
346408 => 'Orange',
346409 => 'Orange',
34642 => 'DigiMobil',
346430 => 'DigiMobil',
346431 => 'DigiMobil',
346432 => 'DigiMobil',
346433 => 'DigiMobil',
346434 => 'DigiMobil',
346435 => 'DigiMobil',
346436 => 'DigiMobil',
34644 => 'Simyo',
34645 => 'Orange',
3464529 => 'MasMovil',
34646 => 'Movistar',
34647 => 'Vodafone',
34648 => 'Movistar',
34649 => 'Movistar',
34650 => 'Movistar',
34651 => 'Orange',
34652 => 'Orange',
3465229 => 'MasMovil',
34653 => 'Orange',
3465329 => 'DIA',
34654 => 'Orange',
3465429 => 'DIA',
34655 => 'Orange',
3465529 => 'DIA',
34656 => 'Orange',
34657 => 'Orange',
3465729 => 'DIA',
34658 => 'Orange',
3465829 => 'DIA',
34659 => 'Movistar',
34660 => 'Movistar',
34661 => 'Vodafone',
34662 => 'Vodafone',
34663 => 'Vodafone',
34664 => 'Vodafone',
34665 => 'Orange',
34666 => 'Vodafone',
34667 => 'Vodafone',
346681 => 'Truphone',
346685 => 'Carrefour',
346686 => 'Parlem',
346688 => 'Parlem',
34669 => 'Movistar',
34670 => 'Vodafone',
34671 => 'Vodafone',
34672 => 'Vodafone',
346725 => 'Lebara',
346728 => 'Lebara',
346729 => 'Lebara',
34673 => 'Vodafone',
34674 => 'Vodafone',
34675 => 'Orange',
34676 => 'Movistar',
34677 => 'Vodafone',
34678 => 'Vodafone',
34679 => 'Movistar',
34680 => 'Movistar',
346810 => 'Movistar',
346811 => 'Movistar',
346812 => 'Movistar',
346813 => 'Movistar',
346814 => 'Movistar',
346815 => 'Movistar',
346816 => 'MasMovil',
34682 => 'Movistar',
34683 => 'Movistar',
346840 => 'Tuenti',
346841 => 'Tuenti',
346842 => 'Tuenti',
346843 => 'Tuenti',
3468440 => 'Eurona',
3468441 => 'Lemonvil',
3468442 => 'BluePhone',
3468443 => 'BT',
3468444 => 'BT',
3468445 => 'Ion mobile',
3468447 => 'Quattre',
3468448 => 'Nethits',
346845 => 'Tuenti',
346846 => 'Telecable',
34685 => 'Orange',
3468529 => 'Carrefour',
34686 => 'Movistar',
34687 => 'Vodafone',
34688 => 'Euskaltel',
346880 => 'YouMobile',
346881 => 'YouMobile',
346882 => 'MasMovil',
346883 => 'MasMovil',
346884 => 'MasMovil',
346885 => 'YouMobile',
346886 => 'Euskaltel',
346887 => 'Euskaltel',
3468870 => 'OpenMovil',
346888 => 'Euskaltel',
3468883 => 'Sarenet',
346889 => 'PepePhone',
34689 => 'Movistar',
34690 => 'Movistar',
34691 => 'Orange',
3469190 => 'MasMovil',
3469191 => 'MasMovil',
3469192 => 'MasMovil',
3469193 => 'MasMovil',
3469194 => 'MasMovil',
3469195 => 'MasMovil',
3469196 => 'MasMovil',
3469197 => 'MasMovil',
3469198 => 'Carrefour',
3469199 => 'Carrefour',
34692 => 'Orange',
3469229 => 'Carrefour',
3469274 => 'Carrefour',
3469275 => 'Carrefour',
3469276 => 'Carrefour',
3469277 => 'Carrefour',
3469278 => 'Carrefour',
3469279 => 'Carrefour',
3469300 => 'MasMovil',
3469301 => 'MasMovil',
3469302 => 'MasMovil',
3469303 => 'MasMovil',
3469304 => 'MasMovil',
3469305 => 'MasMovil',
3469306 => 'MasMovil',
346931 => 'Orange',
3469310 => 'MasMovil',
346932 => 'Orange',
3469320 => 'Carrefour',
3469321 => 'Carrefour',
3469322 => 'MasMovil',
3469323 => 'MasMovil',
3469324 => 'MasMovil',
3469325 => 'MasMovil',
3469326 => 'MasMovil',
3469327 => 'MasMovil',
3469328 => 'MasMovil',
346933 => 'Orange',
3469330 => 'Carrefour',
3469331 => 'Carrefour',
3469332 => 'Carrefour',
3469333 => 'Carrefour',
3469334 => 'Carrefour',
3469335 => 'Carrefour',
3469336 => 'MasMovil',
3469337 => 'MasMovil',
3469338 => 'Carrefour',
3469339 => 'Carrefour',
346934 => 'Orange',
3469340 => 'DIA',
3469341 => 'DIA',
3469342 => 'DIA',
3469343 => 'DIA',
3469344 => 'DIA',
3469345 => 'MasMovil',
3469346 => 'MasMovil',
3469347 => 'MasMovil',
3469348 => 'MasMovil',
3469349 => 'MasMovil',
346935 => 'MasMovil',
3469360 => 'DIA',
3469361 => 'DIA',
3469362 => 'DIA',
3469363 => 'DIA',
3469364 => 'DIA',
3469365 => 'Carrefour',
3469366 => 'Carrefour',
3469367 => 'MasMovil',
3469368 => 'MasMovil',
3469369 => 'MasMovil',
346937 => 'MasMovil',
346938 => 'Orange',
3469380 => 'MasMovil',
3469381 => 'MasMovil',
3469382 => 'MasMovil',
3469383 => 'Carrefour',
3469384 => 'Carrefour',
3469385 => 'MasMovil',
3469386 => 'MasMovil',
3469387 => 'Carrefour',
3469388 => 'Carrefour',
3469391 => 'MasMovil',
3469392 => 'MasMovil',
3469393 => 'MasMovil',
3469394 => 'MasMovil',
3469395 => 'MasMovil',
3469396 => 'MasMovil',
3469397 => 'MasMovil',
3469398 => 'MasMovil',
3469399 => 'MasMovil',
34694 => 'Movistar',
346944 => 'MasMovil',
34695 => 'Orange',
34696 => 'Movistar',
34697 => 'Vodafone',
346980 => 'MasMovil',
346981 => 'R',
346982 => 'MasMovil',
346983 => 'MasMovil',
346984 => 'MasMovil',
346985 => 'MasMovil',
346986 => 'MasMovil',
346987 => 'MasMovil',
346988 => 'MasMovil',
346989 => 'Eroski movil',
34699 => 'Movistar',
347110 => 'Zinnia',
347111 => 'Vodafone',
347117 => 'Vodafone',
347121 => 'Yoigo',
347122 => 'Yoigo',
347123 => 'Yoigo',
347124 => 'Yoigo',
347125 => 'Yoigo',
347126 => 'Yoigo',
347127 => 'Yoigo',
347128 => 'Yoigo',
347170 => 'Movistar',
347171 => 'Vodafone',
347177 => 'Movistar',
3471770 => 'PepePhone',
3471771 => 'PepePhone',
3471777 => 'PepePhone',
347221 => 'Yoigo',
347222 => 'Yoigo',
347223 => 'Yoigo',
347224 => 'Yoigo',
347225 => 'Yoigo',
347226 => 'Yoigo',
3472260 => 'MasMovil',
347227 => 'Yoigo',
347228 => 'Yoigo',
347277 => 'Vodafone',
3474442 => 'Deion',
3474443 => 'InfoVOIP',
3474448 => 'Ion mobile',
3474449 => 'Alai',
347446 => 'PTV',
347477 => 'Orange',
347478 => 'Orange',
);

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