Skip to content

Commit

Permalink
Upstream changes from v5.8.4
Browse files Browse the repository at this point in the history
Metadata changes:
  - Adding a token to indicate which countries have mobile portability.
  • Loading branch information
giggsey committed Sep 20, 2013
1 parent 7fe3f44 commit 5a4a97c
Show file tree
Hide file tree
Showing 535 changed files with 817 additions and 2 deletions.
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_800.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => true,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_979.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_AD.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_AE.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_AO.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_AR.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_AU.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_BR.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_BS.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_BY.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_DE.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_GB.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_GG.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_IT.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => true,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_JP.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,5 +197,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => true,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_KR.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_MX.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_NZ.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_PL.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_RE.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,6 @@
'mainCountryForCode' => NULL,
'leadingDigits' => '262|6(?:9[23]|47)|8',
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_SG.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_US.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@
),
'mainCountryForCode' => true,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions Tests/data/PhoneNumberMetadataForTesting_YT.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,6 @@
'mainCountryForCode' => NULL,
'leadingDigits' => '269|639',
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
10 changes: 8 additions & 2 deletions build/BuildMetadataFromXml.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class BuildMetadataFromXml
const INTL_FORMAT = "intlFormat";
const LEADING_DIGITS = "leadingDigits";
const LEADING_ZERO_POSSIBLE = "leadingZeroPossible";
const MOBILE_NUMBER_PORTABLE_REGION = "mobileNumberPortableRegion";
const MAIN_COUNTRY_FOR_CODE = "mainCountryForCode";
const MOBILE = "mobile";
const NATIONAL_NUMBER_PATTERN = "nationalNumberPattern";
Expand Down Expand Up @@ -191,6 +192,9 @@ private static function loadTerritoryTagMetadata(
if ($element->hasAttribute(self::LEADING_ZERO_POSSIBLE)) {
$metadata->setLeadingZeroPossible(true);
}
if ($element->hasAttribute(self::MOBILE_NUMBER_PORTABLE_REGION)) {
$metadata->setMobileNumberPortableRegion(true);
}
return $metadata;
}

Expand Down Expand Up @@ -369,7 +373,9 @@ private static function loadGeneralDesc(PhoneMetadata $metadata, \DOMElement $el
$metadata->setUan(self::processPhoneNumberDescElement($generalDesc, $element, self::UAN));
$metadata->setEmergency(self::processPhoneNumberDescElement($generalDesc, $element, self::EMERGENCY));
$metadata->setVoicemail(self::processPhoneNumberDescElement($generalDesc, $element, self::VOICEMAIL));
$metadata->setCarrierSpecific(self::processPhoneNumberDescElement($generalDesc, $element, self::CARRIER_SPECIFIC));
$metadata->setCarrierSpecific(
self::processPhoneNumberDescElement($generalDesc, $element, self::CARRIER_SPECIFIC)
);


$metadata->setNoInternationalDialling(
Expand Down Expand Up @@ -452,7 +458,7 @@ public static function buildCountryCodeToRegionCodeMap($metadataCollection)
$countryCode = $metadata->getCountryCode();
if (array_key_exists($countryCode, $countryCodeToRegionCodeMap)) {
if ($metadata->getMainCountryForCode()) {
array_unshift( $countryCodeToRegionCodeMap[$countryCode], $regionCode);
array_unshift($countryCodeToRegionCodeMap[$countryCode], $regionCode);
} else {
$countryCodeToRegionCodeMap[$countryCode][] = $regionCode;
}
Expand Down
19 changes: 19 additions & 0 deletions src/libphonenumber/PhoneMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ public function setLeadingZeroPossible($value) {
return $this;
}

private $mobileNumberPortableRegion = null;

public function hasMobileNumberPortableRegion() {
return isset($this->mobileNumberPortableRegion);
}

public function isMobileNumberPortableRegion() {
return $this->mobileNumberPortableRegion;
}

public function setMobileNumberPortableRegion($value) {
$this->mobileNumberPortableRegion = $value;
return $this;
}

private $generalDesc = null;

public function hasGeneralDesc() {
Expand Down Expand Up @@ -644,6 +659,8 @@ public function toArray() {

$output['leadingZeroPossible'] = $this->isLeadingZeroPossible();

$output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion();

return $output;
}

Expand Down Expand Up @@ -783,6 +800,8 @@ public function fromArray(array $input) {

$this->setLeadingZeroPossible($input['leadingZeroPossible']);

$this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']);

return $this;
}

Expand Down
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_30.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_31.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_34.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_43.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_44.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_49.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,5 +1056,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_55.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
1 change: 1 addition & 0 deletions src/libphonenumber/data/PhoneNumberAlternateFormats_58.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@
),
'mainCountryForCode' => NULL,
'leadingZeroPossible' => NULL,
'mobileNumberPortableRegion' => NULL,
);
/* EOF */
Loading

0 comments on commit 5a4a97c

Please sign in to comment.