From 58acf94c96d166f55c46211a051a9874cff6911b Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 6 Feb 2024 13:21:06 +0800 Subject: [PATCH 01/12] MDL-81924 core: Include Spatie\Cloneable Originally implemented as MDL-80960. --- lib/classes/component.php | 2 + lib/spatie/php-cloneable/LICENSE.md | 21 +++++ lib/spatie/php-cloneable/README.md | 105 +++++++++++++++++++++ lib/spatie/php-cloneable/readme_moodle.txt | 14 +++ lib/spatie/php-cloneable/src/Cloneable.php | 40 ++++++++ lib/thirdpartylibs.xml | 7 ++ 6 files changed, 189 insertions(+) create mode 100644 lib/spatie/php-cloneable/LICENSE.md create mode 100644 lib/spatie/php-cloneable/README.md create mode 100644 lib/spatie/php-cloneable/readme_moodle.txt create mode 100644 lib/spatie/php-cloneable/src/Cloneable.php diff --git a/lib/classes/component.php b/lib/classes/component.php index 03591308ed5..644f416bb91 100644 --- a/lib/classes/component.php +++ b/lib/classes/component.php @@ -149,6 +149,8 @@ class component { \Invoker::class => 'lib/php-di/invoker/src', \FastRoute::class => 'lib/nikic/fast-route/src', \Slim::class => 'lib/slim/slim/Slim', + \libphonenumber::class => 'lib/giggsey/libphonenumber-for-php-lite/src', + \Spatie\Cloneable::class => 'lib/spatie/php-cloneable/src', ]; /** diff --git a/lib/spatie/php-cloneable/LICENSE.md b/lib/spatie/php-cloneable/LICENSE.md new file mode 100644 index 00000000000..bccf12495d2 --- /dev/null +++ b/lib/spatie/php-cloneable/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) spatie + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/lib/spatie/php-cloneable/README.md b/lib/spatie/php-cloneable/README.md new file mode 100644 index 00000000000..cb798343550 --- /dev/null +++ b/lib/spatie/php-cloneable/README.md @@ -0,0 +1,105 @@ +# A trait that allows you to clone readonly properties in PHP 8.1 + +[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/php-cloneable.svg?style=flat-square)](https://packagist.org/packages/spatie/php-cloneable) +[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/spatie/php-cloneable/run-tests.yml?label=tests&branch=main)](https://github.com/spatie/php-cloneable/actions?query=workflow%3ATests+branch%3Amaster) +[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/spatie/php-cloneable/php-cs-fixer.yml?label=code%20style&branch=main)](https://github.com/spatie/php-cloneable/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amaster) +[![Total Downloads](https://img.shields.io/packagist/dt/spatie/php-cloneable.svg?style=flat-square)](https://packagist.org/packages/spatie/php-cloneable) + +This package provides a trait that allows you to clone objects with readonly properties in PHP 8.1. You can read an in-depth explanation as to why this is necessary [here](https://stitcher.io/blog/cloning-readonly-properties-in-php-81). + +## Support us + +[](https://spatie.be/github-ad-click/php-cloneable) + +We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). + +We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards). + +## Installation + +You can install the package via composer: + +```bash +composer require spatie/php-cloneable +``` + +## Usage + +In PHP 8.1, readonly properties aren't allowed to be overridden as soon as they are initialized. That also means that cloning an object and changing one of its readonly properties isn't allowed. It's likely that PHP will get some kind of `clone with` functionality in the future, but for now you can work around this issue by using this package. + +```php +class Post +{ + use Cloneable; + + public readonly string $title; + + public readonly string $author; + + public function __construct(string $title, string $author) + { + $this->title = $title; + $this->author = $author; + } +} +``` + +The `Spatie\Cloneable\Cloneable` adds a `with` method to whatever class you want to be cloneable, which you can pass one or more parameters. Note that you're required to use named arguments. + +```php +$postA = new Post(title: 'a', author: 'Brent'); + +$postB = $postA->with(title: 'b'); +$postC = $postA->with(title: 'c', author: 'Freek'); +``` + +A common practice would be to implement specific `with*` methods on the classes themselves: + +```php +class Post +{ + // … + + public function withTitle(string $title): self + { + return $this->with(title: $title); + } + + public function withAuthor(string $author): self + { + return $this->with(author: $author); + } +} +``` + +### Caveats + +- This package will skip calling the constructor when cloning an object, meaning any logic in the constructor won't be executed. +- The `with` method will do a shallow clone, meaning that nested objects aren't cloned as well. + +## Testing + +```bash +composer test +``` + +## Changelog + +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. + +## Contributing + +Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details. + +## Security Vulnerabilities + +Please review [our security policy](../../security/policy) on how to report security vulnerabilities. + +## Credits + +- [Brent Roose](https://github.com/brendt_gd) +- [All Contributors](../../contributors) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/lib/spatie/php-cloneable/readme_moodle.txt b/lib/spatie/php-cloneable/readme_moodle.txt new file mode 100644 index 00000000000..9a15e24aabd --- /dev/null +++ b/lib/spatie/php-cloneable/readme_moodle.txt @@ -0,0 +1,14 @@ +# Spatie's Cloneable trait + +## Installation + +1. Visit https://github.com/spatie/php-cloneable/ +2. Download the latest release +3. Unzip in this folder +4. Update `thirdpartylibs.xml` +5. Remove any unnecessary files, including: + - Any tests + - CHANGELOG.md + - composer.json + - psalm.xml.dist + - undo_configure.sh diff --git a/lib/spatie/php-cloneable/src/Cloneable.php b/lib/spatie/php-cloneable/src/Cloneable.php new file mode 100644 index 00000000000..d4fe416b792 --- /dev/null +++ b/lib/spatie/php-cloneable/src/Cloneable.php @@ -0,0 +1,40 @@ +newInstanceWithoutConstructor(); + + foreach ($refClass->getProperties() as $property) { + if ($property->isStatic()) { + continue; + } + + $objectField = $property->getName(); + + if (array_key_exists($objectField, $values)) { + $objectValue = $values[$objectField]; + } elseif ($property->isInitialized($this)) { + $objectValue = $property->getValue($this); + } else { + continue; + } + + $declarationScope = $property->getDeclaringClass()->getName(); + if ($declarationScope === self::class) { + $clone->$objectField = $objectValue; + } else { + (fn () => $this->$objectField = $objectValue) + ->bindTo($clone, $declarationScope)(); + } + } + + return $clone; + } +} diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index fac4ef056cc..94fe3d6f50c 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -808,4 +808,11 @@ All rights reserved. 3-Clause https://github.com/nikic/FastRoute + + spatie/php-cloneable + PHP Cloneable + 1.0.2 + MIT + https://github.com/spatie/php-cloneable + From 11ab65db5e679d3303a156f6bf0a787e2748ac49 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 6 Feb 2024 13:21:40 +0800 Subject: [PATCH 02/12] MDL-81924 core: Include libphonenumber lite Originally implemented as MDL-80960. --- lib/classes/di.php | 3 + .../libphonenumber-for-php-lite/LICENSE | 177 + .../libphonenumber-for-php-lite/README.md | 146 + .../readme_moodle.txt | 12 + .../src/CountryCodeSource.php | 34 + .../src/CountryCodeToRegionCodeMap.php | 920 +++++ .../src/DefaultMetadataLoader.php | 13 + .../src/MatchType.php | 16 + .../src/Matcher.php | 156 + .../src/MatcherAPIInterface.php | 23 + .../src/MetadataLoaderInterface.php | 18 + .../src/MetadataSourceInterface.php | 22 + .../src/MultiFileMetadataSourceImpl.php | 95 + .../src/NumberFormat.php | 252 ++ .../src/NumberParseException.php | 60 + .../src/PhoneMetadata.php | 907 +++++ .../src/PhoneNumber.php | 586 +++ .../src/PhoneNumberDesc.php | 216 + .../src/PhoneNumberFormat.php | 23 + .../src/PhoneNumberMatch.php | 76 + .../src/PhoneNumberType.php | 71 + .../src/PhoneNumberUtil.php | 3575 +++++++++++++++++ .../src/RegexBasedMatcher.php | 52 + .../src/ValidationResult.php | 45 + .../src/data/PhoneNumberMetadata_800.php | 114 + .../src/data/PhoneNumberMetadata_808.php | 114 + .../src/data/PhoneNumberMetadata_870.php | 115 + .../src/data/PhoneNumberMetadata_878.php | 114 + .../src/data/PhoneNumberMetadata_881.php | 127 + .../src/data/PhoneNumberMetadata_882.php | 211 + .../src/data/PhoneNumberMetadata_883.php | 166 + .../src/data/PhoneNumberMetadata_888.php | 113 + .../src/data/PhoneNumberMetadata_979.php | 122 + .../src/data/PhoneNumberMetadata_AC.php | 111 + .../src/data/PhoneNumberMetadata_AD.php | 152 + .../src/data/PhoneNumberMetadata_AE.php | 173 + .../src/data/PhoneNumberMetadata_AF.php | 153 + .../src/data/PhoneNumberMetadata_AG.php | 114 + .../src/data/PhoneNumberMetadata_AI.php | 112 + .../src/data/PhoneNumberMetadata_AL.php | 191 + .../src/data/PhoneNumberMetadata_AM.php | 152 + .../src/data/PhoneNumberMetadata_AO.php | 112 + .../src/data/PhoneNumberMetadata_AR.php | 377 ++ .../src/data/PhoneNumberMetadata_AS.php | 110 + .../src/data/PhoneNumberMetadata_AT.php | 353 ++ .../src/data/PhoneNumberMetadata_AU.php | 328 ++ .../src/data/PhoneNumberMetadata_AW.php | 106 + .../src/data/PhoneNumberMetadata_AX.php | 131 + .../src/data/PhoneNumberMetadata_AZ.php | 197 + .../src/data/PhoneNumberMetadata_BA.php | 210 + .../src/data/PhoneNumberMetadata_BB.php | 118 + .../src/data/PhoneNumberMetadata_BD.php | 162 + .../src/data/PhoneNumberMetadata_BE.php | 167 + .../src/data/PhoneNumberMetadata_BF.php | 112 + .../src/data/PhoneNumberMetadata_BG.php | 341 ++ .../src/data/PhoneNumberMetadata_BH.php | 106 + .../src/data/PhoneNumberMetadata_BI.php | 112 + .../src/data/PhoneNumberMetadata_BJ.php | 108 + .../src/data/PhoneNumberMetadata_BL.php | 98 + .../src/data/PhoneNumberMetadata_BM.php | 110 + .../src/data/PhoneNumberMetadata_BN.php | 110 + .../src/data/PhoneNumberMetadata_BO.php | 158 + .../src/data/PhoneNumberMetadata_BQ.php | 101 + .../src/data/PhoneNumberMetadata_BR.php | 274 ++ .../src/data/PhoneNumberMetadata_BS.php | 112 + .../src/data/PhoneNumberMetadata_BT.php | 180 + .../src/data/PhoneNumberMetadata_BW.php | 176 + .../src/data/PhoneNumberMetadata_BY.php | 198 + .../src/data/PhoneNumberMetadata_BZ.php | 135 + .../src/data/PhoneNumberMetadata_CA.php | 129 + .../src/data/PhoneNumberMetadata_CC.php | 133 + .../src/data/PhoneNumberMetadata_CD.php | 151 + .../src/data/PhoneNumberMetadata_CF.php | 110 + .../src/data/PhoneNumberMetadata_CG.php | 122 + .../src/data/PhoneNumberMetadata_CH.php | 161 + .../src/data/PhoneNumberMetadata_CI.php | 124 + .../src/data/PhoneNumberMetadata_CK.php | 112 + .../src/data/PhoneNumberMetadata_CL.php | 329 ++ .../src/data/PhoneNumberMetadata_CM.php | 131 + .../src/data/PhoneNumberMetadata_CN.php | 459 +++ .../src/data/PhoneNumberMetadata_CO.php | 195 + .../src/data/PhoneNumberMetadata_CR.php | 140 + .../src/data/PhoneNumberMetadata_CU.php | 171 + .../src/data/PhoneNumberMetadata_CV.php | 108 + .../src/data/PhoneNumberMetadata_CW.php | 130 + .../src/data/PhoneNumberMetadata_CX.php | 133 + .../src/data/PhoneNumberMetadata_CY.php | 102 + .../src/data/PhoneNumberMetadata_CZ.php | 169 + .../src/data/PhoneNumberMetadata_DE.php | 408 ++ .../src/data/PhoneNumberMetadata_DJ.php | 112 + .../src/data/PhoneNumberMetadata_DK.php | 108 + .../src/data/PhoneNumberMetadata_DM.php | 110 + .../src/data/PhoneNumberMetadata_DO.php | 109 + .../src/data/PhoneNumberMetadata_DZ.php | 151 + .../src/data/PhoneNumberMetadata_EC.php | 210 + .../src/data/PhoneNumberMetadata_EE.php | 165 + .../src/data/PhoneNumberMetadata_EG.php | 175 + .../src/data/PhoneNumberMetadata_EH.php | 97 + .../src/data/PhoneNumberMetadata_ER.php | 122 + .../src/data/PhoneNumberMetadata_ES.php | 165 + .../src/data/PhoneNumberMetadata_ET.php | 122 + .../src/data/PhoneNumberMetadata_FI.php | 276 ++ .../src/data/PhoneNumberMetadata_FJ.php | 136 + .../src/data/PhoneNumberMetadata_FK.php | 100 + .../src/data/PhoneNumberMetadata_FM.php | 112 + .../src/data/PhoneNumberMetadata_FO.php | 107 + .../src/data/PhoneNumberMetadata_FR.php | 167 + .../src/data/PhoneNumberMetadata_GA.php | 143 + .../src/data/PhoneNumberMetadata_GB.php | 244 ++ .../src/data/PhoneNumberMetadata_GD.php | 110 + .../src/data/PhoneNumberMetadata_GE.php | 153 + .../src/data/PhoneNumberMetadata_GF.php | 122 + .../src/data/PhoneNumberMetadata_GG.php | 130 + .../src/data/PhoneNumberMetadata_GH.php | 185 + .../src/data/PhoneNumberMetadata_GI.php | 112 + .../src/data/PhoneNumberMetadata_GL.php | 108 + .../src/data/PhoneNumberMetadata_GM.php | 112 + .../src/data/PhoneNumberMetadata_GN.php | 135 + .../src/data/PhoneNumberMetadata_GP.php | 122 + .../src/data/PhoneNumberMetadata_GQ.php | 120 + .../src/data/PhoneNumberMetadata_GR.php | 164 + .../src/data/PhoneNumberMetadata_GT.php | 137 + .../src/data/PhoneNumberMetadata_GU.php | 110 + .../src/data/PhoneNumberMetadata_GW.php | 135 + .../src/data/PhoneNumberMetadata_GY.php | 106 + .../src/data/PhoneNumberMetadata_HK.php | 177 + .../src/data/PhoneNumberMetadata_HN.php | 151 + .../src/data/PhoneNumberMetadata_HR.php | 217 + .../src/data/PhoneNumberMetadata_HT.php | 108 + .../src/data/PhoneNumberMetadata_HU.php | 158 + .../src/data/PhoneNumberMetadata_ID.php | 393 ++ .../src/data/PhoneNumberMetadata_IE.php | 254 ++ .../src/data/PhoneNumberMetadata_IL.php | 233 ++ .../src/data/PhoneNumberMetadata_IM.php | 102 + .../src/data/PhoneNumberMetadata_IN.php | 390 ++ .../src/data/PhoneNumberMetadata_IO.php | 112 + .../src/data/PhoneNumberMetadata_IQ.php | 159 + .../src/data/PhoneNumberMetadata_IR.php | 180 + .../src/data/PhoneNumberMetadata_IS.php | 140 + .../src/data/PhoneNumberMetadata_IT.php | 410 ++ .../src/data/PhoneNumberMetadata_JE.php | 99 + .../src/data/PhoneNumberMetadata_JM.php | 109 + .../src/data/PhoneNumberMetadata_JO.php | 171 + .../src/data/PhoneNumberMetadata_JP.php | 418 ++ .../src/data/PhoneNumberMetadata_KE.php | 156 + .../src/data/PhoneNumberMetadata_KG.php | 155 + .../src/data/PhoneNumberMetadata_KH.php | 152 + .../src/data/PhoneNumberMetadata_KI.php | 109 + .../src/data/PhoneNumberMetadata_KM.php | 118 + .../src/data/PhoneNumberMetadata_KN.php | 110 + .../src/data/PhoneNumberMetadata_KP.php | 154 + .../src/data/PhoneNumberMetadata_KR.php | 379 ++ .../src/data/PhoneNumberMetadata_KW.php | 135 + .../src/data/PhoneNumberMetadata_KY.php | 108 + .../src/data/PhoneNumberMetadata_KZ.php | 130 + .../src/data/PhoneNumberMetadata_LA.php | 158 + .../src/data/PhoneNumberMetadata_LB.php | 131 + .../src/data/PhoneNumberMetadata_LC.php | 110 + .../src/data/PhoneNumberMetadata_LI.php | 160 + .../src/data/PhoneNumberMetadata_LK.php | 132 + .../src/data/PhoneNumberMetadata_LR.php | 151 + .../src/data/PhoneNumberMetadata_LS.php | 110 + .../src/data/PhoneNumberMetadata_LT.php | 138 + .../src/data/PhoneNumberMetadata_LU.php | 234 ++ .../src/data/PhoneNumberMetadata_LV.php | 106 + .../src/data/PhoneNumberMetadata_LY.php | 122 + .../src/data/PhoneNumberMetadata_MA.php | 144 + .../src/data/PhoneNumberMetadata_MC.php | 197 + .../src/data/PhoneNumberMetadata_MD.php | 128 + .../src/data/PhoneNumberMetadata_ME.php | 135 + .../src/data/PhoneNumberMetadata_MF.php | 98 + .../src/data/PhoneNumberMetadata_MG.php | 121 + .../src/data/PhoneNumberMetadata_MH.php | 112 + .../src/data/PhoneNumberMetadata_MK.php | 142 + .../src/data/PhoneNumberMetadata_ML.php | 135 + .../src/data/PhoneNumberMetadata_MM.php | 240 ++ .../src/data/PhoneNumberMetadata_MN.php | 183 + .../src/data/PhoneNumberMetadata_MO.php | 135 + .../src/data/PhoneNumberMetadata_MP.php | 110 + .../src/data/PhoneNumberMetadata_MQ.php | 122 + .../src/data/PhoneNumberMetadata_MR.php | 110 + .../src/data/PhoneNumberMetadata_MS.php | 110 + .../src/data/PhoneNumberMetadata_MT.php | 102 + .../src/data/PhoneNumberMetadata_MU.php | 155 + .../src/data/PhoneNumberMetadata_MV.php | 140 + .../src/data/PhoneNumberMetadata_MW.php | 143 + .../src/data/PhoneNumberMetadata_MX.php | 242 ++ .../src/data/PhoneNumberMetadata_MY.php | 203 + .../src/data/PhoneNumberMetadata_MZ.php | 135 + .../src/data/PhoneNumberMetadata_NA.php | 157 + .../src/data/PhoneNumberMetadata_NC.php | 135 + .../src/data/PhoneNumberMetadata_NE.php | 120 + .../src/data/PhoneNumberMetadata_NF.php | 138 + .../src/data/PhoneNumberMetadata_NG.php | 236 ++ .../src/data/PhoneNumberMetadata_NI.php | 110 + .../src/data/PhoneNumberMetadata_NL.php | 320 ++ .../src/data/PhoneNumberMetadata_NO.php | 144 + .../src/data/PhoneNumberMetadata_NP.php | 211 + .../src/data/PhoneNumberMetadata_NR.php | 112 + .../src/data/PhoneNumberMetadata_NU.php | 117 + .../src/data/PhoneNumberMetadata_NZ.php | 204 + .../src/data/PhoneNumberMetadata_OM.php | 146 + .../src/data/PhoneNumberMetadata_PA.php | 148 + .../src/data/PhoneNumberMetadata_PE.php | 179 + .../src/data/PhoneNumberMetadata_PF.php | 153 + .../src/data/PhoneNumberMetadata_PG.php | 140 + .../src/data/PhoneNumberMetadata_PH.php | 233 ++ .../src/data/PhoneNumberMetadata_PK.php | 235 ++ .../src/data/PhoneNumberMetadata_PL.php | 214 + .../src/data/PhoneNumberMetadata_PM.php | 145 + .../src/data/PhoneNumberMetadata_PR.php | 109 + .../src/data/PhoneNumberMetadata_PS.php | 160 + .../src/data/PhoneNumberMetadata_PT.php | 108 + .../src/data/PhoneNumberMetadata_PW.php | 112 + .../src/data/PhoneNumberMetadata_PY.php | 233 ++ .../src/data/PhoneNumberMetadata_QA.php | 141 + .../src/data/PhoneNumberMetadata_RE.php | 106 + .../src/data/PhoneNumberMetadata_RO.php | 165 + .../src/data/PhoneNumberMetadata_RS.php | 160 + .../src/data/PhoneNumberMetadata_RU.php | 266 ++ .../src/data/PhoneNumberMetadata_RW.php | 147 + .../src/data/PhoneNumberMetadata_SA.php | 187 + .../src/data/PhoneNumberMetadata_SB.php | 121 + .../src/data/PhoneNumberMetadata_SC.php | 109 + .../src/data/PhoneNumberMetadata_SD.php | 114 + .../src/data/PhoneNumberMetadata_SE.php | 392 ++ .../src/data/PhoneNumberMetadata_SG.php | 231 ++ .../src/data/PhoneNumberMetadata_SH.php | 108 + .../src/data/PhoneNumberMetadata_SI.php | 170 + .../src/data/PhoneNumberMetadata_SJ.php | 120 + .../src/data/PhoneNumberMetadata_SK.php | 260 ++ .../src/data/PhoneNumberMetadata_SL.php | 122 + .../src/data/PhoneNumberMetadata_SM.php | 186 + .../src/data/PhoneNumberMetadata_SN.php | 116 + .../src/data/PhoneNumberMetadata_SO.php | 188 + .../src/data/PhoneNumberMetadata_SR.php | 143 + .../src/data/PhoneNumberMetadata_SS.php | 114 + .../src/data/PhoneNumberMetadata_ST.php | 112 + .../src/data/PhoneNumberMetadata_SV.php | 152 + .../src/data/PhoneNumberMetadata_SX.php | 110 + .../src/data/PhoneNumberMetadata_SY.php | 141 + .../src/data/PhoneNumberMetadata_SZ.php | 140 + .../src/data/PhoneNumberMetadata_TA.php | 103 + .../src/data/PhoneNumberMetadata_TC.php | 112 + .../src/data/PhoneNumberMetadata_TD.php | 113 + .../src/data/PhoneNumberMetadata_TG.php | 112 + .../src/data/PhoneNumberMetadata_TH.php | 156 + .../src/data/PhoneNumberMetadata_TJ.php | 164 + .../src/data/PhoneNumberMetadata_TK.php | 103 + .../src/data/PhoneNumberMetadata_TL.php | 139 + .../src/data/PhoneNumberMetadata_TM.php | 139 + .../src/data/PhoneNumberMetadata_TN.php | 106 + .../src/data/PhoneNumberMetadata_TO.php | 149 + .../src/data/PhoneNumberMetadata_TR.php | 244 ++ .../src/data/PhoneNumberMetadata_TT.php | 112 + .../src/data/PhoneNumberMetadata_TV.php | 147 + .../src/data/PhoneNumberMetadata_TW.php | 190 + .../src/data/PhoneNumberMetadata_TZ.php | 139 + .../src/data/PhoneNumberMetadata_UA.php | 172 + .../src/data/PhoneNumberMetadata_UG.php | 147 + .../src/data/PhoneNumberMetadata_US.php | 168 + .../src/data/PhoneNumberMetadata_UY.php | 195 + .../src/data/PhoneNumberMetadata_UZ.php | 115 + .../src/data/PhoneNumberMetadata_VA.php | 140 + .../src/data/PhoneNumberMetadata_VC.php | 112 + .../src/data/PhoneNumberMetadata_VE.php | 120 + .../src/data/PhoneNumberMetadata_VG.php | 110 + .../src/data/PhoneNumberMetadata_VI.php | 110 + .../src/data/PhoneNumberMetadata_VN.php | 299 ++ .../src/data/PhoneNumberMetadata_VU.php | 123 + .../src/data/PhoneNumberMetadata_WF.php | 137 + .../src/data/PhoneNumberMetadata_WS.php | 151 + .../src/data/PhoneNumberMetadata_XK.php | 147 + .../src/data/PhoneNumberMetadata_YE.php | 145 + .../src/data/PhoneNumberMetadata_YT.php | 98 + .../src/data/PhoneNumberMetadata_ZA.php | 190 + .../src/data/PhoneNumberMetadata_ZM.php | 169 + .../src/data/PhoneNumberMetadata_ZW.php | 248 ++ lib/thirdpartylibs.xml | 7 + 279 files changed, 47715 insertions(+) create mode 100644 lib/giggsey/libphonenumber-for-php-lite/LICENSE create mode 100644 lib/giggsey/libphonenumber-for-php-lite/README.md create mode 100644 lib/giggsey/libphonenumber-for-php-lite/readme_moodle.txt create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/CountryCodeSource.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/CountryCodeToRegionCodeMap.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/DefaultMetadataLoader.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/MatchType.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/Matcher.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/MatcherAPIInterface.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/MetadataLoaderInterface.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/MetadataSourceInterface.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/MultiFileMetadataSourceImpl.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/NumberFormat.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/NumberParseException.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/PhoneMetadata.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumber.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberDesc.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberFormat.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberMatch.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberType.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberUtil.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/RegexBasedMatcher.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/ValidationResult.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_800.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_808.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_870.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_878.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_881.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_882.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_883.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_888.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_979.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AD.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AX.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BB.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BD.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BJ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BQ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CD.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CV.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CX.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DJ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ER.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ES.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ET.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FJ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GB.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GD.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GP.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GQ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ID.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IQ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JP.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KP.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LB.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LV.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MD.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ME.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ML.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MP.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MQ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MV.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MX.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NP.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_OM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_QA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SB.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SD.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SJ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ST.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SV.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SX.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TD.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TH.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TJ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TL.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TO.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TR.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TV.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TW.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_US.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UY.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UZ.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VC.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VG.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VI.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VN.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VU.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WF.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WS.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_XK.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YE.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YT.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZA.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZM.php create mode 100644 lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZW.php diff --git a/lib/classes/di.php b/lib/classes/di.php index c8c1147c9d0..2be5626f824 100644 --- a/lib/classes/di.php +++ b/lib/classes/di.php @@ -122,6 +122,9 @@ class di { // Alias the PSR-20 clock interface to the Moodle clock. They are compatible. \core\clock::class => fn() => new \core\system_clock(), \Psr\Clock\ClockInterface::class => \DI\get(\core\clock::class), + + // Note: libphonenumber PhoneNumberUtil uses a singleton. + \libphonenumber\PhoneNumberUtil::class => fn() => \libphonenumber\PhoneNumberUtil::getInstance(), ]); // Add any additional definitions using hooks. diff --git a/lib/giggsey/libphonenumber-for-php-lite/LICENSE b/lib/giggsey/libphonenumber-for-php-lite/LICENSE new file mode 100644 index 00000000000..66a27ec5ff9 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/LICENSE @@ -0,0 +1,177 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + diff --git a/lib/giggsey/libphonenumber-for-php-lite/README.md b/lib/giggsey/libphonenumber-for-php-lite/README.md new file mode 100644 index 00000000000..7a56b1185ed --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/README.md @@ -0,0 +1,146 @@ +# libphonenumber for PHP (Lite) [![Build Status](https://github.com/giggsey/libphonenumber-for-php-lite/workflows/Tests/badge.svg)](https://github.com/giggsey/libphonenumber-for-php-lite/actions?query=workflow%3A%22Tests%22) [![codecov](https://codecov.io/gh/giggsey/libphonenumber-for-php-lite/branch/main/graph/badge.svg?token=S0TV2TAXOQ)](https://codecov.io/gh/giggsey/libphonenumber-for-php-lite) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fgiggsey%2Flibphonenumber-for-php-lite%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/giggsey/libphonenumber-for-php-lite/main) + + +[![Total Downloads](https://poser.pugx.org/giggsey/libphonenumber-for-php-lite/downloads?format=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php-lite) +[![Downloads per month](https://img.shields.io/packagist/dm/giggsey/libphonenumber-for-php-lite.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php-lite) +[![Latest Stable Version](https://img.shields.io/packagist/v/giggsey/libphonenumber-for-php-lite.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php-lite) +[![License](https://img.shields.io/badge/license-Apache%202.0-red.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php-lite) + +## What is it? +A PHP library for parsing, formatting, storing and validating international phone numbers. This library is based on Google's [libphonenumber](https://github.com/google/libphonenumber). + +This is a lite version that only includes the core Phone Number Utils. To make full use of the library, including geolocation, carrier information and short number info, use [giggsey/libphonenumber-for-php](https://github.com/giggsey/libphonenumber-for-php) + + - [Installation](#installation) + - [Documentation](#documentation) + - [Highlights of functionality](#highlights-of-functionality) + - [Versioning](#versioning) + - [Quick Examples](#quick-examples) + - [FAQ](#faq) + - [Problems with Invalid Numbers?](#problems-with-invalid-numbers) + - [Generating data](#generating-data) + +## Installation + +PHP versions 8.0 and above are supported. + +The PECL [mbstring](http://php.net/mbstring) extension is required. + +It is recommended to use [composer](https://getcomposer.org) to install the library. + +```bash +$ composer require giggsey/libphonenumber-for-php-lite +``` + +You can also use any other [PSR-4](http://www.php-fig.org/psr/psr-4/) compliant autoloader. + +### PHP Version Policy + +This library will be updated to use [supported versions of PHP](https://www.php.net/supported-versions.php) only. At the moment, the main [giggsey/libphonenumber-for-php](https://github.com/giggsey/libphonenumber-for-php) library supports older PHP versions. + +## Documentation + + - [PhoneNumber Util](docs/PhoneNumberUtil.md) + +# Highlights of functionality +* Parsing/formatting/validating phone numbers for all countries/regions of the world. +* `getNumberType` - gets the type of the number based on the number itself; able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP and Personal Numbers (whenever feasible). +* `isNumberMatch` - gets a confidence level on whether two numbers could be the same. +* `getExampleNumber`/`getExampleNumberByType` - provides valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed. +* `isValidNumber` - full validation of a phone number for a region using length and prefix information. + +## Versioning + +This library will try to follow the same version numbers as Google. There could be additional releases where needed to fix critical issues that can not wait until the next release from Google. + +This does mean that this project may not follow [Semantic Versioning](http://semver.org/), but instead Google's version policy. As a result, jumps in major versions may not actually contain any backwards +incompatible changes. Please read the release notes for such releases. + +Google try to release their versions according to Semantic Versioning, as laid out of in their [Versioning Guide](https://github.com/google/libphonenumber#versioning-and-announcements). + +## Quick Examples +Let's say you have a string representing a phone number from Switzerland. This is how you parse/normalize it into a PhoneNumber object: + +```php +$swissNumberStr = "044 668 18 00"; +$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance(); +try { + $swissNumberProto = $phoneUtil->parse($swissNumberStr, "CH"); + var_dump($swissNumberProto); +} catch (\libphonenumber\NumberParseException $e) { + var_dump($e); +} +``` + +At this point, swissNumberProto contains: + + class libphonenumber\PhoneNumber#9 (7) { + private $countryCode => + int(41) + private $nationalNumber => + double(446681800) + private $extension => + NULL + private $italianLeadingZero => + NULL + private $rawInput => + NULL + private $countryCodeSource => + NULL + private $preferredDomesticCarrierCode => + NULL + } + +Now let us validate whether the number is valid: + +```php +$isValid = $phoneUtil->isValidNumber($swissNumberProto); +var_dump($isValid); // true +``` + +There are a few formats supported by the formatting method, as illustrated below: + +```php +// Produces "+41446681800" +echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::E164); + +// Produces "044 668 18 00" +echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::NATIONAL); + +// Produces "+41 44 668 18 00" +echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL); +``` + +You could also choose to format the number in the way it is dialled from another country: + +```php +// Produces "011 41 44 668 1800", the number when it is dialled in the United States. +echo $phoneUtil->formatOutOfCountryCallingNumber($swissNumberProto, "US"); + +// Produces "00 41 44 668 18 00", the number when it is dialled in Great Britain. +echo $phoneUtil->formatOutOfCountryCallingNumber($swissNumberProto, "GB"); +``` + +## FAQ + +#### Problems with Invalid Numbers? + +This library uses phone number metadata from Google's [libphonenumber](https://github.com/google/libphonenumber). If this library is working as intended, it should provide the same result as the Java version of Google's project. + +If you believe that a phone number is returning an incorrect result, first test it with [libphonenumber](https://github.com/google/libphonenumber) via their [Online Demo](https://libphonenumber.appspot.com/). If that returns the same result as this project, and you feel it is in error, raise it as an Issue with the libphonenumber project. + +If Google's [Online Demo](https://libphonenumber.appspot.com/) gives a different result to the [libphonenumber-for-php demo](http://giggsey.com/libphonenumber/), then please raise an Issue on the [giggsey/libphonenumber-for-php](https://github.com/giggsey/libphonenumber-for-php) project. + +If [giggsey/libphonenumber-for-php](https://github.com/giggsey/libphonenumber-for-php) differs from this library, please raise an issue here instead. + +## Generating data + +Generating the data is not normally needed, as this repository will generally always have the up to data metadata. + +If you do need to generate the data, the commands are provided by [Phing](https://www.phing.info). Ensure you have all the dev composer dependencies installed, then run + +```bash +$ vendor/bin/phing compile +``` + +This compile process clones the [libphonenumber](https://github.com/google/libphonenumber) project at the version specified in [METADATA-VERSION.txt](METADATA-VERSION.txt). diff --git a/lib/giggsey/libphonenumber-for-php-lite/readme_moodle.txt b/lib/giggsey/libphonenumber-for-php-lite/readme_moodle.txt new file mode 100644 index 00000000000..06005295580 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/readme_moodle.txt @@ -0,0 +1,12 @@ +# libphonenumber-for-php-lite + +## Installation + +1. Visit https://github.com/giggsey/libphonenumber-for-php-lite/ +2. Download the latest release +3. Unzip in this folder +4. Update `thirdpartylibs.xml` +5. Remove any unnecessary files, including: + - Any tests + - CHANGELOG.md + - composer.json diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/CountryCodeSource.php b/lib/giggsey/libphonenumber-for-php-lite/src/CountryCodeSource.php new file mode 100644 index 00000000000..278cc9412e4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/CountryCodeSource.php @@ -0,0 +1,34 @@ + + [ + 0 => 'US', + 1 => 'AG', + 2 => 'AI', + 3 => 'AS', + 4 => 'BB', + 5 => 'BM', + 6 => 'BS', + 7 => 'CA', + 8 => 'DM', + 9 => 'DO', + 10 => 'GD', + 11 => 'GU', + 12 => 'JM', + 13 => 'KN', + 14 => 'KY', + 15 => 'LC', + 16 => 'MP', + 17 => 'MS', + 18 => 'PR', + 19 => 'SX', + 20 => 'TC', + 21 => 'TT', + 22 => 'VC', + 23 => 'VG', + 24 => 'VI', + ], + 7 => + [ + 0 => 'RU', + 1 => 'KZ', + ], + 20 => + [ + 0 => 'EG', + ], + 27 => + [ + 0 => 'ZA', + ], + 30 => + [ + 0 => 'GR', + ], + 31 => + [ + 0 => 'NL', + ], + 32 => + [ + 0 => 'BE', + ], + 33 => + [ + 0 => 'FR', + ], + 34 => + [ + 0 => 'ES', + ], + 36 => + [ + 0 => 'HU', + ], + 39 => + [ + 0 => 'IT', + 1 => 'VA', + ], + 40 => + [ + 0 => 'RO', + ], + 41 => + [ + 0 => 'CH', + ], + 43 => + [ + 0 => 'AT', + ], + 44 => + [ + 0 => 'GB', + 1 => 'GG', + 2 => 'IM', + 3 => 'JE', + ], + 45 => + [ + 0 => 'DK', + ], + 46 => + [ + 0 => 'SE', + ], + 47 => + [ + 0 => 'NO', + 1 => 'SJ', + ], + 48 => + [ + 0 => 'PL', + ], + 49 => + [ + 0 => 'DE', + ], + 51 => + [ + 0 => 'PE', + ], + 52 => + [ + 0 => 'MX', + ], + 53 => + [ + 0 => 'CU', + ], + 54 => + [ + 0 => 'AR', + ], + 55 => + [ + 0 => 'BR', + ], + 56 => + [ + 0 => 'CL', + ], + 57 => + [ + 0 => 'CO', + ], + 58 => + [ + 0 => 'VE', + ], + 60 => + [ + 0 => 'MY', + ], + 61 => + [ + 0 => 'AU', + 1 => 'CC', + 2 => 'CX', + ], + 62 => + [ + 0 => 'ID', + ], + 63 => + [ + 0 => 'PH', + ], + 64 => + [ + 0 => 'NZ', + ], + 65 => + [ + 0 => 'SG', + ], + 66 => + [ + 0 => 'TH', + ], + 81 => + [ + 0 => 'JP', + ], + 82 => + [ + 0 => 'KR', + ], + 84 => + [ + 0 => 'VN', + ], + 86 => + [ + 0 => 'CN', + ], + 90 => + [ + 0 => 'TR', + ], + 91 => + [ + 0 => 'IN', + ], + 92 => + [ + 0 => 'PK', + ], + 93 => + [ + 0 => 'AF', + ], + 94 => + [ + 0 => 'LK', + ], + 95 => + [ + 0 => 'MM', + ], + 98 => + [ + 0 => 'IR', + ], + 211 => + [ + 0 => 'SS', + ], + 212 => + [ + 0 => 'MA', + 1 => 'EH', + ], + 213 => + [ + 0 => 'DZ', + ], + 216 => + [ + 0 => 'TN', + ], + 218 => + [ + 0 => 'LY', + ], + 220 => + [ + 0 => 'GM', + ], + 221 => + [ + 0 => 'SN', + ], + 222 => + [ + 0 => 'MR', + ], + 223 => + [ + 0 => 'ML', + ], + 224 => + [ + 0 => 'GN', + ], + 225 => + [ + 0 => 'CI', + ], + 226 => + [ + 0 => 'BF', + ], + 227 => + [ + 0 => 'NE', + ], + 228 => + [ + 0 => 'TG', + ], + 229 => + [ + 0 => 'BJ', + ], + 230 => + [ + 0 => 'MU', + ], + 231 => + [ + 0 => 'LR', + ], + 232 => + [ + 0 => 'SL', + ], + 233 => + [ + 0 => 'GH', + ], + 234 => + [ + 0 => 'NG', + ], + 235 => + [ + 0 => 'TD', + ], + 236 => + [ + 0 => 'CF', + ], + 237 => + [ + 0 => 'CM', + ], + 238 => + [ + 0 => 'CV', + ], + 239 => + [ + 0 => 'ST', + ], + 240 => + [ + 0 => 'GQ', + ], + 241 => + [ + 0 => 'GA', + ], + 242 => + [ + 0 => 'CG', + ], + 243 => + [ + 0 => 'CD', + ], + 244 => + [ + 0 => 'AO', + ], + 245 => + [ + 0 => 'GW', + ], + 246 => + [ + 0 => 'IO', + ], + 247 => + [ + 0 => 'AC', + ], + 248 => + [ + 0 => 'SC', + ], + 249 => + [ + 0 => 'SD', + ], + 250 => + [ + 0 => 'RW', + ], + 251 => + [ + 0 => 'ET', + ], + 252 => + [ + 0 => 'SO', + ], + 253 => + [ + 0 => 'DJ', + ], + 254 => + [ + 0 => 'KE', + ], + 255 => + [ + 0 => 'TZ', + ], + 256 => + [ + 0 => 'UG', + ], + 257 => + [ + 0 => 'BI', + ], + 258 => + [ + 0 => 'MZ', + ], + 260 => + [ + 0 => 'ZM', + ], + 261 => + [ + 0 => 'MG', + ], + 262 => + [ + 0 => 'RE', + 1 => 'YT', + ], + 263 => + [ + 0 => 'ZW', + ], + 264 => + [ + 0 => 'NA', + ], + 265 => + [ + 0 => 'MW', + ], + 266 => + [ + 0 => 'LS', + ], + 267 => + [ + 0 => 'BW', + ], + 268 => + [ + 0 => 'SZ', + ], + 269 => + [ + 0 => 'KM', + ], + 290 => + [ + 0 => 'SH', + 1 => 'TA', + ], + 291 => + [ + 0 => 'ER', + ], + 297 => + [ + 0 => 'AW', + ], + 298 => + [ + 0 => 'FO', + ], + 299 => + [ + 0 => 'GL', + ], + 350 => + [ + 0 => 'GI', + ], + 351 => + [ + 0 => 'PT', + ], + 352 => + [ + 0 => 'LU', + ], + 353 => + [ + 0 => 'IE', + ], + 354 => + [ + 0 => 'IS', + ], + 355 => + [ + 0 => 'AL', + ], + 356 => + [ + 0 => 'MT', + ], + 357 => + [ + 0 => 'CY', + ], + 358 => + [ + 0 => 'FI', + 1 => 'AX', + ], + 359 => + [ + 0 => 'BG', + ], + 370 => + [ + 0 => 'LT', + ], + 371 => + [ + 0 => 'LV', + ], + 372 => + [ + 0 => 'EE', + ], + 373 => + [ + 0 => 'MD', + ], + 374 => + [ + 0 => 'AM', + ], + 375 => + [ + 0 => 'BY', + ], + 376 => + [ + 0 => 'AD', + ], + 377 => + [ + 0 => 'MC', + ], + 378 => + [ + 0 => 'SM', + ], + 380 => + [ + 0 => 'UA', + ], + 381 => + [ + 0 => 'RS', + ], + 382 => + [ + 0 => 'ME', + ], + 383 => + [ + 0 => 'XK', + ], + 385 => + [ + 0 => 'HR', + ], + 386 => + [ + 0 => 'SI', + ], + 387 => + [ + 0 => 'BA', + ], + 389 => + [ + 0 => 'MK', + ], + 420 => + [ + 0 => 'CZ', + ], + 421 => + [ + 0 => 'SK', + ], + 423 => + [ + 0 => 'LI', + ], + 500 => + [ + 0 => 'FK', + ], + 501 => + [ + 0 => 'BZ', + ], + 502 => + [ + 0 => 'GT', + ], + 503 => + [ + 0 => 'SV', + ], + 504 => + [ + 0 => 'HN', + ], + 505 => + [ + 0 => 'NI', + ], + 506 => + [ + 0 => 'CR', + ], + 507 => + [ + 0 => 'PA', + ], + 508 => + [ + 0 => 'PM', + ], + 509 => + [ + 0 => 'HT', + ], + 590 => + [ + 0 => 'GP', + 1 => 'BL', + 2 => 'MF', + ], + 591 => + [ + 0 => 'BO', + ], + 592 => + [ + 0 => 'GY', + ], + 593 => + [ + 0 => 'EC', + ], + 594 => + [ + 0 => 'GF', + ], + 595 => + [ + 0 => 'PY', + ], + 596 => + [ + 0 => 'MQ', + ], + 597 => + [ + 0 => 'SR', + ], + 598 => + [ + 0 => 'UY', + ], + 599 => + [ + 0 => 'CW', + 1 => 'BQ', + ], + 670 => + [ + 0 => 'TL', + ], + 672 => + [ + 0 => 'NF', + ], + 673 => + [ + 0 => 'BN', + ], + 674 => + [ + 0 => 'NR', + ], + 675 => + [ + 0 => 'PG', + ], + 676 => + [ + 0 => 'TO', + ], + 677 => + [ + 0 => 'SB', + ], + 678 => + [ + 0 => 'VU', + ], + 679 => + [ + 0 => 'FJ', + ], + 680 => + [ + 0 => 'PW', + ], + 681 => + [ + 0 => 'WF', + ], + 682 => + [ + 0 => 'CK', + ], + 683 => + [ + 0 => 'NU', + ], + 685 => + [ + 0 => 'WS', + ], + 686 => + [ + 0 => 'KI', + ], + 687 => + [ + 0 => 'NC', + ], + 688 => + [ + 0 => 'TV', + ], + 689 => + [ + 0 => 'PF', + ], + 690 => + [ + 0 => 'TK', + ], + 691 => + [ + 0 => 'FM', + ], + 692 => + [ + 0 => 'MH', + ], + 800 => + [ + 0 => '001', + ], + 808 => + [ + 0 => '001', + ], + 850 => + [ + 0 => 'KP', + ], + 852 => + [ + 0 => 'HK', + ], + 853 => + [ + 0 => 'MO', + ], + 855 => + [ + 0 => 'KH', + ], + 856 => + [ + 0 => 'LA', + ], + 870 => + [ + 0 => '001', + ], + 878 => + [ + 0 => '001', + ], + 880 => + [ + 0 => 'BD', + ], + 881 => + [ + 0 => '001', + ], + 882 => + [ + 0 => '001', + ], + 883 => + [ + 0 => '001', + ], + 886 => + [ + 0 => 'TW', + ], + 888 => + [ + 0 => '001', + ], + 960 => + [ + 0 => 'MV', + ], + 961 => + [ + 0 => 'LB', + ], + 962 => + [ + 0 => 'JO', + ], + 963 => + [ + 0 => 'SY', + ], + 964 => + [ + 0 => 'IQ', + ], + 965 => + [ + 0 => 'KW', + ], + 966 => + [ + 0 => 'SA', + ], + 967 => + [ + 0 => 'YE', + ], + 968 => + [ + 0 => 'OM', + ], + 970 => + [ + 0 => 'PS', + ], + 971 => + [ + 0 => 'AE', + ], + 972 => + [ + 0 => 'IL', + ], + 973 => + [ + 0 => 'BH', + ], + 974 => + [ + 0 => 'QA', + ], + 975 => + [ + 0 => 'BT', + ], + 976 => + [ + 0 => 'MN', + ], + 977 => + [ + 0 => 'NP', + ], + 979 => + [ + 0 => '001', + ], + 992 => + [ + 0 => 'TJ', + ], + 993 => + [ + 0 => 'TM', + ], + 994 => + [ + 0 => 'AZ', + ], + 995 => + [ + 0 => 'GE', + ], + 996 => + [ + 0 => 'KG', + ], + 998 => + [ + 0 => 'UZ', + ], +]; + +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/DefaultMetadataLoader.php b/lib/giggsey/libphonenumber-for-php-lite/src/DefaultMetadataLoader.php new file mode 100644 index 00000000000..2d1a2c19208 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/DefaultMetadataLoader.php @@ -0,0 +1,13 @@ + + */ + protected array $groups = []; + + private int $searchIndex = 0; + + /** + * @param string $pattern + * @param string $subject + */ + public function __construct(string $pattern, string $subject) + { + $this->pattern = str_replace('/', '\/', $pattern); + $this->subject = $subject; + } + + /** + * @param string $type + * @param int $offset + * @return bool + */ + protected function doMatch(string $type = 'find', int $offset = 0): bool + { + $final_pattern = '(?:' . $this->pattern . ')'; + switch ($type) { + case 'matches': + $final_pattern = '^' . $final_pattern . '$'; + break; + case 'lookingAt': + $final_pattern = '^' . $final_pattern; + break; + case 'find': + default: + // no changes + break; + } + $final_pattern = '/' . $final_pattern . '/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 = []; + + foreach ($groups as $group) { + $positions[] = [ + $group[0], + $offset + mb_strlen(substr($search, 0, $group[1])), + ]; + } + + $this->groups = $positions; + } + + return ($result === 1); + } + + public function matches(): bool + { + return $this->doMatch('matches'); + } + + public function lookingAt(): bool + { + return $this->doMatch('lookingAt'); + } + + public function find(?int $offset = null): bool + { + if ($offset === null) { + $offset = $this->searchIndex; + } + + // Increment search index for the next time we call this + $this->searchIndex++; + return $this->doMatch('find', $offset); + } + + public function groupCount(): ?int + { + if (empty($this->groups)) { + return null; + } + + return count($this->groups) - 1; + } + + public function group(?int $group = null): ?string + { + if ($group === null) { + $group = 0; + } + return $this->groups[$group][0] ?? null; + } + + public function end(?int $group = null): ?int + { + if ($group === null) { + $group = 0; + } + if (!isset($this->groups[$group])) { + return null; + } + return $this->groups[$group][1] + mb_strlen($this->groups[$group][0]); + } + + public function start(int $group = 0): ?int + { + if (!isset($this->groups[$group])) { + return null; + } + + return $this->groups[$group][1]; + } + + public function replaceFirst(string $replacement): string + { + return preg_replace('/' . $this->pattern . '/x', $replacement, $this->subject, 1); + } + + public function replaceAll(string $replacement): string + { + return preg_replace('/' . $this->pattern . '/x', $replacement, $this->subject); + } + + public function reset(string $input = ''): self + { + $this->subject = $input; + + return $this; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/MatcherAPIInterface.php b/lib/giggsey/libphonenumber-for-php-lite/src/MatcherAPIInterface.php new file mode 100644 index 00000000000..1a449beea95 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/MatcherAPIInterface.php @@ -0,0 +1,23 @@ +currentFilePrefix = $currentFilePrefix; + } + + /** + * @inheritdoc + */ + public function getMetadataForRegion(string $regionCode): PhoneMetadata + { + $regionCode = strtoupper($regionCode); + + if (!array_key_exists($regionCode, $this->regionToMetadataMap)) { + // The regionCode here will be valid and won't be '001', so we don't need to worry about + // what to pass in for the country calling code. + $this->loadMetadataFromFile($this->currentFilePrefix, $regionCode, 0, $this->metadataLoader); + } + + return $this->regionToMetadataMap[$regionCode]; + } + + /** + * @inheritdoc + */ + public function getMetadataForNonGeographicalRegion(int $countryCallingCode): PhoneMetadata + { + if (!array_key_exists($countryCallingCode, $this->countryCodeToNonGeographicalMetadataMap)) { + $this->loadMetadataFromFile($this->currentFilePrefix, PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY, $countryCallingCode, $this->metadataLoader); + } + + return $this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode]; + } + + /** + * @param string $filePrefix + * @param string $regionCode + * @param int $countryCallingCode + * @param MetadataLoaderInterface $metadataLoader + */ + public function loadMetadataFromFile(string $filePrefix, string $regionCode, int $countryCallingCode, MetadataLoaderInterface $metadataLoader): void + { + $regionCode = strtoupper($regionCode); + + $isNonGeoRegion = PhoneNumberUtil::REGION_CODE_FOR_NON_GEO_ENTITY === $regionCode; + $fileName = $filePrefix . '_' . ($isNonGeoRegion ? $countryCallingCode : $regionCode) . '.php'; + if (!is_readable($fileName)) { + throw new \RuntimeException('missing metadata: ' . $fileName); + } + + $data = $metadataLoader->loadMetadata($fileName); + $metadata = new PhoneMetadata(); + $metadata->fromArray($data); + if ($isNonGeoRegion) { + $this->countryCodeToNonGeographicalMetadataMap[$countryCallingCode] = $metadata; + } else { + $this->regionToMetadataMap[$regionCode] = $metadata; + } + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/NumberFormat.php b/lib/giggsey/libphonenumber-for-php-lite/src/NumberFormat.php new file mode 100644 index 00000000000..7a24fe4ea6a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/NumberFormat.php @@ -0,0 +1,252 @@ +,nationalPrefixFormattingRule?:string,domesticCarrierCodeFormattingRule?:string,nationalPrefixOptionalWhenFormatting?:bool} + */ +class NumberFormat +{ + protected ?string $pattern; + protected bool $hasPattern = false; + protected ?string $format; + protected bool $hasFormat = false; + /** + * @var array + */ + protected array $leadingDigitsPattern = []; + protected string $nationalPrefixFormattingRule = ''; + protected bool $hasNationalPrefixFormattingRule = false; + protected bool $nationalPrefixOptionalWhenFormatting = false; + protected bool $hasNationalPrefixOptionalWhenFormatting = false; + protected string $domesticCarrierCodeFormattingRule = ''; + protected bool $hasDomesticCarrierCodeFormattingRule = false; + + public function __construct() + { + $this->clear(); + } + + /** + * @return NumberFormat + */ + public function clear(): NumberFormat + { + $this->hasPattern = false; + $this->pattern = null; + + $this->hasFormat = false; + $this->format = null; + + $this->leadingDigitsPattern = []; + + $this->hasNationalPrefixFormattingRule = false; + $this->nationalPrefixFormattingRule = ''; + + $this->hasNationalPrefixOptionalWhenFormatting = false; + $this->nationalPrefixOptionalWhenFormatting = false; + + $this->hasDomesticCarrierCodeFormattingRule = false; + $this->domesticCarrierCodeFormattingRule = ''; + + return $this; + } + + public function hasPattern(): bool + { + return $this->hasPattern; + } + + public function getPattern(): ?string + { + return $this->pattern; + } + + public function setPattern(string $value): NumberFormat + { + $this->hasPattern = true; + $this->pattern = $value; + + return $this; + } + + public function hasNationalPrefixOptionalWhenFormatting(): bool + { + return $this->hasNationalPrefixOptionalWhenFormatting; + } + + public function getNationalPrefixOptionalWhenFormatting(): bool + { + return $this->nationalPrefixOptionalWhenFormatting; + } + + public function setNationalPrefixOptionalWhenFormatting(bool $nationalPrefixOptionalWhenFormatting): void + { + $this->hasNationalPrefixOptionalWhenFormatting = true; + $this->nationalPrefixOptionalWhenFormatting = $nationalPrefixOptionalWhenFormatting; + } + + public function hasFormat(): bool + { + return $this->hasFormat; + } + + public function getFormat(): ?string + { + return $this->format; + } + + public function setFormat(string $value): NumberFormat + { + $this->hasFormat = true; + $this->format = $value; + + return $this; + } + + /** + * @return string[] + */ + public function leadingDigitPatterns(): array + { + return $this->leadingDigitsPattern; + } + + public function leadingDigitsPatternSize(): int + { + return count($this->leadingDigitsPattern); + } + + public function getLeadingDigitsPattern(int $index): string + { + return $this->leadingDigitsPattern[$index]; + } + + public function addLeadingDigitsPattern(string $value): NumberFormat + { + $this->leadingDigitsPattern[] = $value; + + return $this; + } + + public function hasNationalPrefixFormattingRule(): bool + { + return $this->hasNationalPrefixFormattingRule; + } + + public function getNationalPrefixFormattingRule(): string + { + return $this->nationalPrefixFormattingRule; + } + + public function setNationalPrefixFormattingRule(string $value): NumberFormat + { + $this->hasNationalPrefixFormattingRule = true; + $this->nationalPrefixFormattingRule = $value; + + return $this; + } + + public function clearNationalPrefixFormattingRule(): NumberFormat + { + $this->nationalPrefixFormattingRule = ''; + + return $this; + } + + public function hasDomesticCarrierCodeFormattingRule(): bool + { + return $this->hasDomesticCarrierCodeFormattingRule; + } + + public function getDomesticCarrierCodeFormattingRule(): string + { + return $this->domesticCarrierCodeFormattingRule; + } + + public function setDomesticCarrierCodeFormattingRule(string $value): NumberFormat + { + $this->hasDomesticCarrierCodeFormattingRule = true; + $this->domesticCarrierCodeFormattingRule = $value; + + return $this; + } + + public function mergeFrom(NumberFormat $other): NumberFormat + { + if ($other->hasPattern()) { + $this->setPattern($other->getPattern()); + } + if ($other->hasFormat()) { + $this->setFormat($other->getFormat()); + } + $leadingDigitsPatternSize = $other->leadingDigitsPatternSize(); + for ($i = 0; $i < $leadingDigitsPatternSize; $i++) { + $this->addLeadingDigitsPattern($other->getLeadingDigitsPattern($i)); + } + if ($other->hasNationalPrefixFormattingRule()) { + $this->setNationalPrefixFormattingRule($other->getNationalPrefixFormattingRule()); + } + if ($other->hasDomesticCarrierCodeFormattingRule()) { + $this->setDomesticCarrierCodeFormattingRule($other->getDomesticCarrierCodeFormattingRule()); + } + if ($other->hasNationalPrefixOptionalWhenFormatting()) { + $this->setNationalPrefixOptionalWhenFormatting($other->getNationalPrefixOptionalWhenFormatting()); + } + + return $this; + } + + /** + * @return NumberFormatArray + */ + public function toArray(): array + { + $output = []; + $output['pattern'] = $this->getPattern(); + $output['format'] = $this->getFormat(); + + $output['leadingDigitsPatterns'] = $this->leadingDigitPatterns(); + + if ($this->hasNationalPrefixFormattingRule()) { + $output['nationalPrefixFormattingRule'] = $this->getNationalPrefixFormattingRule(); + } + + if ($this->hasDomesticCarrierCodeFormattingRule()) { + $output['domesticCarrierCodeFormattingRule'] = $this->getDomesticCarrierCodeFormattingRule(); + } + + if ($this->hasNationalPrefixOptionalWhenFormatting()) { + $output['nationalPrefixOptionalWhenFormatting'] = $this->getNationalPrefixOptionalWhenFormatting(); + } + + return $output; + } + + /** + * @param NumberFormatArray $input + */ + public function fromArray(array $input): void + { + $this->setPattern($input['pattern']); + $this->setFormat($input['format']); + foreach ($input['leadingDigitsPatterns'] as $leadingDigitsPattern) { + $this->addLeadingDigitsPattern($leadingDigitsPattern); + } + + if (isset($input['nationalPrefixFormattingRule']) && $input['nationalPrefixFormattingRule'] !== '') { + $this->setNationalPrefixFormattingRule($input['nationalPrefixFormattingRule']); + } + if (isset($input['domesticCarrierCodeFormattingRule']) && $input['domesticCarrierCodeFormattingRule'] !== '') { + $this->setDomesticCarrierCodeFormattingRule($input['domesticCarrierCodeFormattingRule']); + } + + if (isset($input['nationalPrefixOptionalWhenFormatting'])) { + $this->setNationalPrefixOptionalWhenFormatting($input['nationalPrefixOptionalWhenFormatting']); + } + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/NumberParseException.php b/lib/giggsey/libphonenumber-for-php-lite/src/NumberParseException.php new file mode 100644 index 00000000000..7a91c6252c4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/NumberParseException.php @@ -0,0 +1,60 @@ +message = $message; + $this->errorType = $errorType; + } + + /** + * Returns the error type of the exception that has been thrown. + */ + public function getErrorType(): int + { + return $this->errorType; + } + + public function __toString(): string + { + return 'Error type: ' . $this->errorType . '. ' . $this->message; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/PhoneMetadata.php b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneMetadata.php new file mode 100644 index 00000000000..e699428c2d8 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneMetadata.php @@ -0,0 +1,907 @@ +id); + } + + public function hasMainCountryForCode(): bool + { + return isset($this->mainCountryForCode); + } + + public function isMainCountryForCode(): bool + { + return $this->mainCountryForCode; + } + + public function getMainCountryForCode(): bool + { + return $this->mainCountryForCode; + } + + public function setMainCountryForCode(bool $value): PhoneMetadata + { + $this->mainCountryForCode = $value; + return $this; + } + + public function clearMainCountryForCode(): PhoneMetadata + { + $this->mainCountryForCode = false; + return $this; + } + + public function numberFormatSize(): int + { + return \count($this->numberFormat); + } + + /** + * @param int $index + * @return NumberFormat + */ + public function getNumberFormat(int $index): NumberFormat + { + return $this->numberFormat[$index]; + } + + public function intlNumberFormatSize(): int + { + return \count($this->intlNumberFormat); + } + + public function getIntlNumberFormat(int $index): NumberFormat + { + return $this->intlNumberFormat[$index]; + } + + public function clearIntlNumberFormat(): PhoneMetadata + { + $this->intlNumberFormat = []; + return $this; + } + + /** + * @return PhoneMetadataArray + */ + public function toArray(): array + { + $output = []; + + if ($this->hasGeneralDesc()) { + $output['generalDesc'] = $this->getGeneralDesc()->toArray(); + } + + if ($this->hasFixedLine()) { + $output['fixedLine'] = $this->getFixedLine()->toArray(); + } + + if ($this->hasMobile()) { + $output['mobile'] = $this->getMobile()->toArray(); + } + + if ($this->hasTollFree()) { + $output['tollFree'] = $this->getTollFree()->toArray(); + } + + if ($this->hasPremiumRate()) { + $output['premiumRate'] = $this->getPremiumRate()->toArray(); + } + + if ($this->hasSharedCost()) { + $output['sharedCost'] = $this->getSharedCost()->toArray(); + } + + if ($this->hasPersonalNumber()) { + $output['personalNumber'] = $this->getPersonalNumber()->toArray(); + } + + if ($this->hasVoip()) { + $output['voip'] = $this->getVoip()->toArray(); + } + + if ($this->hasPager()) { + $output['pager'] = $this->getPager()->toArray(); + } + + if ($this->hasUan()) { + $output['uan'] = $this->getUan()->toArray(); + } + + if ($this->hasEmergency()) { + $output['emergency'] = $this->getEmergency()->toArray(); + } + + if ($this->hasVoicemail()) { + $output['voicemail'] = $this->getVoicemail()->toArray(); + } + + if ($this->hasShortCode()) { + $output['shortCode'] = $this->getShortCode()->toArray(); + } + + if ($this->hasStandardRate()) { + $output['standardRate'] = $this->getStandardRate()->toArray(); + } + + if ($this->hasCarrierSpecific()) { + $output['carrierSpecific'] = $this->getCarrierSpecific()->toArray(); + } + + if ($this->hasSmsServices()) { + $output['smsServices'] = $this->getSmsServices()->toArray(); + } + + if ($this->hasNoInternationalDialling()) { + $output['noInternationalDialling'] = $this->getNoInternationalDialling()->toArray(); + } + + $output['id'] = $this->getId(); + if ($this->hasCountryCode()) { + $output['countryCode'] = $this->getCountryCode(); + } + + if ($this->hasInternationalPrefix()) { + $output['internationalPrefix'] = $this->getInternationalPrefix(); + } + + if ($this->hasPreferredInternationalPrefix()) { + $output['preferredInternationalPrefix'] = $this->getPreferredInternationalPrefix(); + } + + if ($this->hasNationalPrefix()) { + $output['nationalPrefix'] = $this->getNationalPrefix(); + } + + if ($this->hasPreferredExtnPrefix()) { + $output['preferredExtnPrefix'] = $this->getPreferredExtnPrefix(); + } + + if ($this->hasNationalPrefixForParsing()) { + $output['nationalPrefixForParsing'] = $this->getNationalPrefixForParsing(); + } + + if ($this->hasNationalPrefixTransformRule()) { + $output['nationalPrefixTransformRule'] = $this->getNationalPrefixTransformRule(); + } + + if ($this->hasSameMobileAndFixedLinePattern()) { + $output['sameMobileAndFixedLinePattern'] = $this->getSameMobileAndFixedLinePattern(); + } + + $output['numberFormat'] = []; + foreach ($this->numberFormats() as $numberFormat) { + $output['numberFormat'][] = $numberFormat->toArray(); + } + + if (!empty($this->intlNumberFormats())) { + $output['intlNumberFormat'] = []; + foreach ($this->intlNumberFormats() as $intlNumberFormat) { + $output['intlNumberFormat'][] = $intlNumberFormat->toArray(); + } + } + + $output['mainCountryForCode'] = $this->getMainCountryForCode(); + + if ($this->hasLeadingDigits()) { + $output['leadingDigits'] = $this->getLeadingDigits(); + } + + if ($this->hasMobileNumberPortableRegion()) { + $output['mobileNumberPortableRegion'] = $this->isMobileNumberPortableRegion(); + } + + return $output; + } + + public function hasGeneralDesc(): bool + { + return isset($this->generalDesc); + } + + public function getGeneralDesc(): ?PhoneNumberDesc + { + return $this->generalDesc; + } + + public function setGeneralDesc(PhoneNumberDesc $value): PhoneMetadata + { + $this->generalDesc = $value; + return $this; + } + + public function hasFixedLine(): bool + { + return isset($this->fixedLine); + } + + public function getFixedLine(): ?PhoneNumberDesc + { + return $this->fixedLine; + } + + public function setFixedLine(PhoneNumberDesc $value): PhoneMetadata + { + $this->fixedLine = $value; + return $this; + } + + public function hasMobile(): bool + { + return isset($this->mobile); + } + + public function getMobile(): ?PhoneNumberDesc + { + return $this->mobile; + } + + public function setMobile(PhoneNumberDesc $value): PhoneMetadata + { + $this->mobile = $value; + return $this; + } + + public function hasTollFree(): bool + { + return isset($this->tollFree); + } + + public function getTollFree(): ?PhoneNumberDesc + { + return $this->tollFree; + } + + public function setTollFree(PhoneNumberDesc $value): PhoneMetadata + { + $this->tollFree = $value; + return $this; + } + + public function hasPremiumRate(): bool + { + return isset($this->premiumRate); + } + + public function getPremiumRate(): ?PhoneNumberDesc + { + return $this->premiumRate; + } + + public function setPremiumRate(PhoneNumberDesc $value): PhoneMetadata + { + $this->premiumRate = $value; + return $this; + } + + public function hasSharedCost(): bool + { + return isset($this->sharedCost); + } + + public function getSharedCost(): ?PhoneNumberDesc + { + return $this->sharedCost; + } + + public function setSharedCost(PhoneNumberDesc $value): PhoneMetadata + { + $this->sharedCost = $value; + return $this; + } + + public function hasPersonalNumber(): bool + { + return isset($this->personalNumber); + } + + public function getPersonalNumber(): ?PhoneNumberDesc + { + return $this->personalNumber; + } + + public function setPersonalNumber(PhoneNumberDesc $value): PhoneMetadata + { + $this->personalNumber = $value; + return $this; + } + + public function hasVoip(): bool + { + return isset($this->voip); + } + + public function getVoip(): ?PhoneNumberDesc + { + return $this->voip; + } + + public function setVoip(PhoneNumberDesc $value): PhoneMetadata + { + $this->voip = $value; + return $this; + } + + public function hasPager(): bool + { + return isset($this->pager); + } + + public function getPager(): ?PhoneNumberDesc + { + return $this->pager; + } + + public function setPager(PhoneNumberDesc $value): PhoneMetadata + { + $this->pager = $value; + return $this; + } + + public function hasUan(): bool + { + return isset($this->uan); + } + + public function getUan(): ?PhoneNumberDesc + { + return $this->uan; + } + + public function setUan(PhoneNumberDesc $value): PhoneMetadata + { + $this->uan = $value; + return $this; + } + + public function hasEmergency(): bool + { + return isset($this->emergency); + } + + public function getEmergency(): ?PhoneNumberDesc + { + return $this->emergency; + } + + public function setEmergency(PhoneNumberDesc $value): PhoneMetadata + { + $this->emergency = $value; + return $this; + } + + public function hasVoicemail(): bool + { + return isset($this->voicemail); + } + + public function getVoicemail(): ?PhoneNumberDesc + { + return $this->voicemail; + } + + public function setVoicemail(PhoneNumberDesc $value): PhoneMetadata + { + $this->voicemail = $value; + return $this; + } + + public function hasShortCode(): bool + { + return isset($this->short_code); + } + + public function getShortCode(): ?PhoneNumberDesc + { + return $this->short_code; + } + + public function setShortCode(PhoneNumberDesc $value): PhoneMetadata + { + $this->short_code = $value; + return $this; + } + + public function hasStandardRate(): bool + { + return isset($this->standard_rate); + } + + public function getStandardRate(): ?PhoneNumberDesc + { + return $this->standard_rate; + } + + public function setStandardRate(PhoneNumberDesc $value): PhoneMetadata + { + $this->standard_rate = $value; + return $this; + } + + public function hasCarrierSpecific(): bool + { + return isset($this->carrierSpecific); + } + + public function getCarrierSpecific(): ?PhoneNumberDesc + { + return $this->carrierSpecific; + } + + public function setCarrierSpecific(PhoneNumberDesc $value): PhoneMetadata + { + $this->carrierSpecific = $value; + return $this; + } + + public function hasSmsServices(): bool + { + return isset($this->smsServices); + } + + public function getSmsServices(): ?PhoneNumberDesc + { + return $this->smsServices; + } + + public function setSmsServices(PhoneNumberDesc $value): PhoneMetadata + { + $this->smsServices = $value; + return $this; + } + + public function hasNoInternationalDialling(): bool + { + return isset($this->noInternationalDialling); + } + + public function getNoInternationalDialling(): ?PhoneNumberDesc + { + return $this->noInternationalDialling; + } + + public function setNoInternationalDialling(PhoneNumberDesc $value): PhoneMetadata + { + $this->noInternationalDialling = $value; + return $this; + } + + public function getId(): ?string + { + return $this->id; + } + + public function setId(string $value): PhoneMetadata + { + $this->id = $value; + return $this; + } + + /** @phpstan-assert-if-true !null $this->getCountryCode() */ + public function hasCountryCode(): bool + { + return isset($this->countryCode); + } + + public function getCountryCode(): ?int + { + return $this->countryCode; + } + + public function setCountryCode(int $value): PhoneMetadata + { + $this->countryCode = $value; + return $this; + } + + public function hasInternationalPrefix(): bool + { + return isset($this->internationalPrefix); + } + + public function getInternationalPrefix(): string + { + return $this->internationalPrefix; + } + + public function setInternationalPrefix(string $value): PhoneMetadata + { + $this->internationalPrefix = $value; + return $this; + } + + /** @phpstan-assert-if-true !null $this->getPreferredInternationalPrefix() */ + public function hasPreferredInternationalPrefix(): bool + { + return isset($this->preferredInternationalPrefix); + } + + public function getPreferredInternationalPrefix(): ?string + { + return $this->preferredInternationalPrefix; + } + + public function setPreferredInternationalPrefix(string $value): PhoneMetadata + { + $this->preferredInternationalPrefix = $value; + return $this; + } + + /** @phpstan-assert-if-true !null $this->getNationalPrefix() */ + public function hasNationalPrefix(): bool + { + return isset($this->nationalPrefix); + } + + public function getNationalPrefix(): ?string + { + return $this->nationalPrefix; + } + + public function setNationalPrefix(string $value): PhoneMetadata + { + $this->nationalPrefix = $value; + return $this; + } + + /** @phpstan-assert-if-true !null $this->getPreferredExtnPrefix() */ + public function hasPreferredExtnPrefix(): bool + { + return isset($this->preferredExtnPrefix); + } + + public function getPreferredExtnPrefix(): ?string + { + return $this->preferredExtnPrefix; + } + + public function setPreferredExtnPrefix(string $value): PhoneMetadata + { + $this->preferredExtnPrefix = $value; + return $this; + } + + /** @phpstan-assert-if-true !null $this->getNationalPrefixForParsing() */ + public function hasNationalPrefixForParsing(): bool + { + return isset($this->nationalPrefixForParsing); + } + + public function getNationalPrefixForParsing(): ?string + { + return $this->nationalPrefixForParsing; + } + + public function setNationalPrefixForParsing(string $value): PhoneMetadata + { + $this->nationalPrefixForParsing = $value; + return $this; + } + + /** @phpstan-assert-if-true !null $this->getNationalPrefixTransformRule() */ + public function hasNationalPrefixTransformRule(): bool + { + return isset($this->nationalPrefixTransformRule); + } + + public function getNationalPrefixTransformRule(): ?string + { + return $this->nationalPrefixTransformRule; + } + + public function setNationalPrefixTransformRule(string $value): PhoneMetadata + { + $this->nationalPrefixTransformRule = $value; + return $this; + } + + public function hasSameMobileAndFixedLinePattern(): bool + { + return isset($this->sameMobileAndFixedLinePattern); + } + + public function getSameMobileAndFixedLinePattern(): bool + { + return $this->sameMobileAndFixedLinePattern; + } + + public function setSameMobileAndFixedLinePattern(bool $value): PhoneMetadata + { + $this->sameMobileAndFixedLinePattern = $value; + return $this; + } + + /** + * @return NumberFormat[] + */ + public function numberFormats(): array + { + return $this->numberFormat; + } + + /** + * @return NumberFormat[] + */ + public function intlNumberFormats(): array + { + return $this->intlNumberFormat; + } + + public function hasLeadingDigits(): bool + { + return isset($this->leadingDigits); + } + + public function getLeadingDigits(): string + { + return $this->leadingDigits; + } + + public function setLeadingDigits(string $value): PhoneMetadata + { + $this->leadingDigits = $value; + return $this; + } + + public function hasMobileNumberPortableRegion(): bool + { + return isset($this->mobileNumberPortableRegion); + } + + public function isMobileNumberPortableRegion(): bool + { + return $this->mobileNumberPortableRegion; + } + + public function setMobileNumberPortableRegion(bool $value): PhoneMetadata + { + $this->mobileNumberPortableRegion = $value; + return $this; + } + + public function clearPreferredInternationalPrefix(): PhoneMetadata + { + unset($this->preferredInternationalPrefix); + return $this; + } + + public function clearNationalPrefix(): PhoneMetadata + { + unset($this->nationalPrefix); + return $this; + } + + public function clearPreferredExtnPrefix(): PhoneMetadata + { + unset($this->preferredExtnPrefix); + return $this; + } + + public function clearNationalPrefixTransformRule(): PhoneMetadata + { + unset($this->nationalPrefixTransformRule); + return $this; + } + + public function clearSameMobileAndFixedLinePattern(): PhoneMetadata + { + $this->sameMobileAndFixedLinePattern = false; + return $this; + } + + public function clearMobileNumberPortableRegion(): PhoneMetadata + { + $this->mobileNumberPortableRegion = false; + return $this; + } + + /** + * @param PhoneMetadataArray $input + */ + public function fromArray(array $input): PhoneMetadata + { + if (isset($input['generalDesc'])) { + $desc = new PhoneNumberDesc(); + $this->setGeneralDesc($desc->fromArray($input['generalDesc'])); + } + + if (isset($input['fixedLine'])) { + $desc = new PhoneNumberDesc(); + $this->setFixedLine($desc->fromArray($input['fixedLine'])); + } + + if (isset($input['mobile'])) { + $desc = new PhoneNumberDesc(); + $this->setMobile($desc->fromArray($input['mobile'])); + } + + if (isset($input['tollFree'])) { + $desc = new PhoneNumberDesc(); + $this->setTollFree($desc->fromArray($input['tollFree'])); + } + + if (isset($input['premiumRate'])) { + $desc = new PhoneNumberDesc(); + $this->setPremiumRate($desc->fromArray($input['premiumRate'])); + } + + if (isset($input['sharedCost'])) { + $desc = new PhoneNumberDesc(); + $this->setSharedCost($desc->fromArray($input['sharedCost'])); + } + + if (isset($input['personalNumber'])) { + $desc = new PhoneNumberDesc(); + $this->setPersonalNumber($desc->fromArray($input['personalNumber'])); + } + + if (isset($input['voip'])) { + $desc = new PhoneNumberDesc(); + $this->setVoip($desc->fromArray($input['voip'])); + } + + if (isset($input['pager'])) { + $desc = new PhoneNumberDesc(); + $this->setPager($desc->fromArray($input['pager'])); + } + + if (isset($input['uan'])) { + $desc = new PhoneNumberDesc(); + $this->setUan($desc->fromArray($input['uan'])); + } + + if (isset($input['emergency'])) { + $desc = new PhoneNumberDesc(); + $this->setEmergency($desc->fromArray($input['emergency'])); + } + + if (isset($input['voicemail'])) { + $desc = new PhoneNumberDesc(); + $this->setVoicemail($desc->fromArray($input['voicemail'])); + } + + if (isset($input['shortCode'])) { + $desc = new PhoneNumberDesc(); + $this->setShortCode($desc->fromArray($input['shortCode'])); + } + + if (isset($input['standardRate'])) { + $desc = new PhoneNumberDesc(); + $this->setStandardRate($desc->fromArray($input['standardRate'])); + } + + if (isset($input['carrierSpecific'])) { + $desc = new PhoneNumberDesc(); + $this->setCarrierSpecific($desc->fromArray($input['carrierSpecific'])); + } + + if (isset($input['smsServices'])) { + $desc = new PhoneNumberDesc(); + $this->setSmsServices($desc->fromArray($input['smsServices'])); + } + + if (isset($input['noInternationalDialling'])) { + $desc = new PhoneNumberDesc(); + $this->setNoInternationalDialling($desc->fromArray($input['noInternationalDialling'])); + } + + $this->setId($input['id']); + + if (isset($input['countryCode'])) { + $this->setCountryCode($input['countryCode']); + } + + if (isset($input['internationalPrefix'])) { + $this->setInternationalPrefix($input['internationalPrefix']); + } + + if (isset($input['preferredInternationalPrefix'])) { + $this->setPreferredInternationalPrefix($input['preferredInternationalPrefix']); + } + + if (isset($input['nationalPrefix'])) { + $this->setNationalPrefix($input['nationalPrefix']); + } + + if (isset($input['preferredExtnPrefix'])) { + $this->setPreferredExtnPrefix($input['preferredExtnPrefix']); + } + + if (isset($input['nationalPrefixForParsing'])) { + $this->setNationalPrefixForParsing($input['nationalPrefixForParsing']); + } + + if (isset($input['nationalPrefixTransformRule'])) { + $this->setNationalPrefixTransformRule($input['nationalPrefixTransformRule']); + } + + foreach ($input['numberFormat'] ?? [] as $numberFormatElt) { + $numberFormat = new NumberFormat(); + $numberFormat->fromArray($numberFormatElt); + $this->addNumberFormat($numberFormat); + } + + foreach ($input['intlNumberFormat'] ?? [] as $intlNumberFormatElt) { + $numberFormat = new NumberFormat(); + $numberFormat->fromArray($intlNumberFormatElt); + $this->addIntlNumberFormat($numberFormat); + } + + $this->setMainCountryForCode($input['mainCountryForCode']); + + if (isset($input['leadingDigits'])) { + $this->setLeadingDigits($input['leadingDigits']); + } + + if (isset($input['mobileNumberPortableRegion'])) { + $this->setMobileNumberPortableRegion($input['mobileNumberPortableRegion']); + } + + return $this; + } + + public function addNumberFormat(NumberFormat $value): PhoneMetadata + { + $this->numberFormat[] = $value; + return $this; + } + + public function addIntlNumberFormat(NumberFormat $value): PhoneMetadata + { + $this->intlNumberFormat[] = $value; + return $this; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumber.php b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumber.php new file mode 100644 index 00000000000..f932dc9031a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumber.php @@ -0,0 +1,586 @@ +clearCountryCode(); + $this->clearNationalNumber(); + $this->clearExtension(); + $this->clearItalianLeadingZero(); + $this->clearNumberOfLeadingZeros(); + $this->clearRawInput(); + $this->clearCountryCodeSource(); + $this->clearPreferredDomesticCarrierCode(); + return $this; + } + + /** + * Clears the country code of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearCountryCode(): PhoneNumber + { + $this->countryCode = null; + return $this; + } + + /** + * Clears the national number of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearNationalNumber(): PhoneNumber + { + $this->nationalNumber = null; + return $this; + } + + /** + * Clears the extension of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearExtension(): PhoneNumber + { + $this->extension = null; + return $this; + } + + /** + * Clears the italian leading zero information of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearItalianLeadingZero(): PhoneNumber + { + $this->italianLeadingZero = null; + return $this; + } + + /** + * Clears the number of leading zeros of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearNumberOfLeadingZeros(): PhoneNumber + { + $this->hasNumberOfLeadingZeros = false; + $this->numberOfLeadingZeros = 1; + return $this; + } + + /** + * Clears the raw input of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearRawInput(): PhoneNumber + { + $this->rawInput = null; + return $this; + } + + /** + * Clears the country code source of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearCountryCodeSource(): PhoneNumber + { + $this->countryCodeSource = CountryCodeSource::UNSPECIFIED; + return $this; + } + + /** + * Clears the preferred domestic carrier code of this phone number. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function clearPreferredDomesticCarrierCode(): PhoneNumber + { + $this->preferredDomesticCarrierCode = null; + return $this; + } + + /** + * Merges the information from another phone number into this phone number. + * + * @param PhoneNumber $other The phone number to copy. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function mergeFrom(PhoneNumber $other): PhoneNumber + { + if ($other->hasCountryCode()) { + $this->setCountryCode($other->getCountryCode()); + } + if ($other->hasNationalNumber()) { + $this->setNationalNumber($other->getNationalNumber()); + } + if ($other->hasExtension()) { + $this->setExtension($other->getExtension()); + } + if ($other->hasItalianLeadingZero()) { + $this->setItalianLeadingZero($other->isItalianLeadingZero()); + } + if ($other->hasNumberOfLeadingZeros()) { + $this->setNumberOfLeadingZeros($other->getNumberOfLeadingZeros()); + } + if ($other->hasRawInput()) { + $this->setRawInput($other->getRawInput()); + } + if ($other->hasCountryCodeSource()) { + $this->setCountryCodeSource($other->getCountryCodeSource()); + } + if ($other->hasPreferredDomesticCarrierCode()) { + $this->setPreferredDomesticCarrierCode($other->getPreferredDomesticCarrierCode()); + } + return $this; + } + + /** + * Returns whether this phone number has a country code set. + * + * @return bool True if a country code is set, false otherwise. + */ + public function hasCountryCode(): bool + { + return $this->countryCode !== null; + } + + /** + * Returns the country code of this phone number. + * + * @return int|null The country code, or null if not set. + */ + public function getCountryCode(): ?int + { + return $this->countryCode; + } + + /** + * Sets the country code of this phone number. + * + * @param int $value The country code. + * + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setCountryCode(int $value): PhoneNumber + { + $this->countryCode = $value; + return $this; + } + + /** + * Returns whether this phone number has a national number set. + * + * @return bool True if a national number is set, false otherwise. + */ + public function hasNationalNumber(): bool + { + return $this->nationalNumber !== null; + } + + /** + * Returns the national number of this phone number. + * + * @return string|null The national number, or null if not set. + */ + public function getNationalNumber(): ?string + { + return $this->nationalNumber; + } + + /** + * Sets the national number of this phone number. + * + * @param string $value The national number. + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setNationalNumber(string $value): PhoneNumber + { + $this->nationalNumber = $value; + return $this; + } + + /** + * Returns whether this phone number has an extension set. + * + * @return bool True if an extension is set, false otherwise. + */ + public function hasExtension(): bool + { + return $this->extension !== null; + } + + /** + * Returns the extension of this phone number. + * + * @return string|null The extension, or null if not set. + */ + public function getExtension(): ?string + { + return $this->extension; + } + + /** + * Sets the extension of this phone number. + * + * @param string $value The extension. + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setExtension(string $value): PhoneNumber + { + $this->extension = $value; + return $this; + } + + /** + * Returns whether this phone number has the italian leading zero information set. + * + * @return bool + */ + public function hasItalianLeadingZero(): bool + { + return $this->italianLeadingZero !== null; + } + + /** + * Sets whether this phone number uses an italian leading zero. + * + * @param bool $value True to use italian leading zero, false otherwise. + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setItalianLeadingZero(bool $value): PhoneNumber + { + $this->italianLeadingZero = $value; + return $this; + } + + /** + * Returns whether this phone number uses an italian leading zero. + * + * @return bool|null True if it uses an italian leading zero, false if it does not, null if not set. + */ + public function isItalianLeadingZero(): ?bool + { + return $this->italianLeadingZero; + } + + /** + * Returns whether this phone number has a number of leading zeros set. + * + * @return bool True if a number of leading zeros is set, false otherwise. + */ + public function hasNumberOfLeadingZeros(): bool + { + return $this->hasNumberOfLeadingZeros; + } + + /** + * Returns the number of leading zeros of this phone number. + * + * @return int The number of leading zeros. + */ + public function getNumberOfLeadingZeros(): int + { + return $this->numberOfLeadingZeros; + } + + /** + * Sets the number of leading zeros of this phone number. + * + * @param int $value The number of leading zeros. + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setNumberOfLeadingZeros(int $value): PhoneNumber + { + $this->hasNumberOfLeadingZeros = true; + $this->numberOfLeadingZeros = $value; + return $this; + } + + /** + * Returns whether this phone number has a raw input. + * + * @return bool True if a raw input is set, false otherwise. + */ + public function hasRawInput(): bool + { + return $this->rawInput !== null; + } + + /** + * Returns the raw input of this phone number. + * + * @return string|null The raw input, or null if not set. + */ + public function getRawInput(): ?string + { + return $this->rawInput; + } + + /** + * Sets the raw input of this phone number. + * + * @param string $value The raw input. + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setRawInput(string $value): PhoneNumber + { + $this->rawInput = $value; + return $this; + } + + /** + * Returns whether this phone number has a country code source. + * + * @return bool True if a country code source is set, false otherwise. + */ + public function hasCountryCodeSource(): bool + { + return $this->countryCodeSource !== CountryCodeSource::UNSPECIFIED; + } + + /** + * Returns the country code source of this phone number. + * + * @return int|null A CountryCodeSource constant, or null if not set. + */ + public function getCountryCodeSource(): ?int + { + return $this->countryCodeSource; + } + + /** + * Sets the country code source of this phone number. + * + * @param int $value A CountryCodeSource constant. + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setCountryCodeSource(int $value): PhoneNumber + { + $this->countryCodeSource = $value; + return $this; + } + + /** + * Returns whether this phone number has a preferred domestic carrier code. + * + * @return bool True if a preferred domestic carrier code is set, false otherwise. + */ + public function hasPreferredDomesticCarrierCode(): bool + { + return $this->preferredDomesticCarrierCode !== null; + } + + /** + * Returns the preferred domestic carrier code of this phone number. + * + * @return string|null The preferred domestic carrier code, or null if not set. + */ + public function getPreferredDomesticCarrierCode(): ?string + { + return $this->preferredDomesticCarrierCode; + } + + /** + * Sets the preferred domestic carrier code of this phone number. + * + * @param string $value The preferred domestic carrier code. + * @return PhoneNumber This PhoneNumber instance, for chaining method calls. + */ + public function setPreferredDomesticCarrierCode(string $value): PhoneNumber + { + $this->preferredDomesticCarrierCode = $value; + return $this; + } + + /** + * Returns whether this phone number is equal to another. + * + * @param PhoneNumber $other The phone number to compare. + * + * @return bool True if the phone numbers are equal, false otherwise. + */ + public function equals(PhoneNumber $other): bool + { + if ($this === $other) { + return true; + } + + return $this->countryCode === $other->countryCode + && $this->nationalNumber === $other->nationalNumber + && $this->extension === $other->extension + && $this->italianLeadingZero === $other->italianLeadingZero + && $this->numberOfLeadingZeros === $other->numberOfLeadingZeros + && $this->rawInput === $other->rawInput + && $this->countryCodeSource === $other->countryCodeSource + && $this->preferredDomesticCarrierCode === $other->preferredDomesticCarrierCode; + } + + /** + * Returns a string representation of this phone number. + * @return string + */ + public function __toString(): string + { + $outputString = 'Country Code: ' . $this->countryCode; + $outputString .= ' National Number: ' . $this->nationalNumber; + if ($this->hasItalianLeadingZero()) { + $outputString .= ' Leading Zero(s): true'; + } + if ($this->hasNumberOfLeadingZeros()) { + $outputString .= ' Number of leading zeros: ' . $this->numberOfLeadingZeros; + } + if ($this->hasExtension()) { + $outputString .= ' Extension: ' . $this->extension; + } + if ($this->hasCountryCodeSource()) { + $outputString .= ' Country Code Source: ' . $this->countryCodeSource; + } + if ($this->hasPreferredDomesticCarrierCode()) { + $outputString .= ' Preferred Domestic Carrier Code: ' . $this->preferredDomesticCarrierCode; + } + return $outputString; + } + + /** + * @inheritDoc + */ + public function serialize(): ?string + { + return serialize($this->__serialize()); + } + + /** + * @return array{?int,?string,?string,?bool,int,?string,int,?string} + */ + public function __serialize(): array + { + return [ + $this->countryCode, + $this->nationalNumber, + $this->extension, + $this->italianLeadingZero, + $this->numberOfLeadingZeros, + $this->rawInput, + $this->countryCodeSource, + $this->preferredDomesticCarrierCode, + ]; + } + + /** + * @inheritDoc + */ + public function unserialize($data) + { + $this->__unserialize(unserialize($data, ['allowed_classes' => [__CLASS__]])); + } + + /** + * @param array{int,?string,?string,?bool,int,?string,int,?string} $data + */ + public function __unserialize(array $data): void + { + [ + $this->countryCode, + $this->nationalNumber, + $this->extension, + $this->italianLeadingZero, + $this->numberOfLeadingZeros, + $this->rawInput, + $this->countryCodeSource, + $this->preferredDomesticCarrierCode + ] = $data; + + if ($this->numberOfLeadingZeros > 1) { + $this->hasNumberOfLeadingZeros = true; + } + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberDesc.php b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberDesc.php new file mode 100644 index 00000000000..9f08d1d4607 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberDesc.php @@ -0,0 +1,216 @@ +clear(); + } + + public function clear(): PhoneNumberDesc + { + $this->clearNationalNumberPattern(); + $this->clearPossibleLength(); + $this->clearPossibleLengthLocalOnly(); + $this->clearExampleNumber(); + + return $this; + } + + /** + * @return int[] + */ + public function getPossibleLength(): array + { + return $this->possibleLength; + } + + /** + * @param int[] $possibleLength + */ + public function setPossibleLength(array $possibleLength): void + { + $this->possibleLength = $possibleLength; + } + + public function addPossibleLength(int $possibleLength): void + { + if (!in_array($possibleLength, $this->possibleLength)) { + $this->possibleLength[] = $possibleLength; + } + } + + public function clearPossibleLength(): void + { + $this->possibleLength = []; + } + + /** + * @return int[] + */ + public function getPossibleLengthLocalOnly(): array + { + return $this->possibleLengthLocalOnly; + } + + /** + * @param int[] $possibleLengthLocalOnly + */ + public function setPossibleLengthLocalOnly(array $possibleLengthLocalOnly): void + { + $this->possibleLengthLocalOnly = $possibleLengthLocalOnly; + } + + public function addPossibleLengthLocalOnly(int $possibleLengthLocalOnly): void + { + if (!in_array($possibleLengthLocalOnly, $this->possibleLengthLocalOnly)) { + $this->possibleLengthLocalOnly[] = $possibleLengthLocalOnly; + } + } + + public function clearPossibleLengthLocalOnly(): void + { + $this->possibleLengthLocalOnly = []; + } + + public function hasNationalNumberPattern(): bool + { + return $this->hasNationalNumberPattern; + } + + public function getNationalNumberPattern(): string + { + return $this->nationalNumberPattern; + } + + public function setNationalNumberPattern(string $value): PhoneNumberDesc + { + $this->hasNationalNumberPattern = true; + $this->nationalNumberPattern = $value; + + return $this; + } + + public function clearNationalNumberPattern(): PhoneNumberDesc + { + $this->hasNationalNumberPattern = false; + $this->nationalNumberPattern = ''; + return $this; + } + + public function hasExampleNumber(): bool + { + return $this->hasExampleNumber; + } + + public function getExampleNumber(): string + { + return $this->exampleNumber; + } + + public function setExampleNumber(string $value): PhoneNumberDesc + { + $this->hasExampleNumber = true; + $this->exampleNumber = $value; + + return $this; + } + + public function clearExampleNumber(): self + { + $this->hasExampleNumber = false; + $this->exampleNumber = ''; + + return $this; + } + + public function mergeFrom(PhoneNumberDesc $other): self + { + if ($other->hasNationalNumberPattern()) { + $this->setNationalNumberPattern($other->getNationalNumberPattern()); + } + if ($other->hasExampleNumber()) { + $this->setExampleNumber($other->getExampleNumber()); + } + $this->setPossibleLength($other->getPossibleLength()); + $this->setPossibleLengthLocalOnly($other->getPossibleLengthLocalOnly()); + + return $this; + } + + public function exactlySameAs(PhoneNumberDesc $other): bool + { + return $this->nationalNumberPattern === $other->nationalNumberPattern && + $this->exampleNumber === $other->exampleNumber; + } + + /** + * @return PhoneNumberDescArray + */ + public function toArray(): array + { + $data = []; + if ($this->hasNationalNumberPattern()) { + $data['NationalNumberPattern'] = $this->getNationalNumberPattern(); + } + if ($this->hasExampleNumber()) { + $data['ExampleNumber'] = $this->getExampleNumber(); + } + + $possibleLength = $this->getPossibleLength(); + if (!empty($possibleLength)) { + $data['PossibleLength'] = $possibleLength; + } + + $possibleLengthLocalOnly = $this->getPossibleLengthLocalOnly(); + if (!empty($possibleLengthLocalOnly)) { + $data['PossibleLengthLocalOnly'] = $possibleLengthLocalOnly; + } + + return $data; + } + + /** + * @param PhoneNumberDescArray $input + * @return $this + */ + public function fromArray(array $input): static + { + if (isset($input['NationalNumberPattern']) && $input['NationalNumberPattern'] !== '') { + $this->setNationalNumberPattern($input['NationalNumberPattern']); + } + if (isset($input['ExampleNumber']) && $input['ExampleNumber'] !== '') { + $this->setExampleNumber($input['ExampleNumber']); + } + if (isset($input['PossibleLength'])) { + $this->setPossibleLength($input['PossibleLength']); + } + if (isset($input['PossibleLengthLocalOnly'])) { + $this->setPossibleLengthLocalOnly($input['PossibleLengthLocalOnly']); + } + + return $this; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberFormat.php b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberFormat.php new file mode 100644 index 00000000000..014c645304e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberFormat.php @@ -0,0 +1,23 @@ += 0.'); + } + + $this->start = $start; + $this->rawString = $rawString; + } + + /** + * Returns the phone number matched by the receiver. + * @return PhoneNumber + */ + public function number(): PhoneNumber + { + return $this->number; + } + + /** + * Returns the start index of the matched phone number within the searched text. + * @return int + */ + public function start(): int + { + return $this->start; + } + + /** + * Returns the exclusive end index of the matched phone number within the searched text. + * @return int + */ + public function end(): int + { + 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(): string + { + return $this->rawString; + } + + public function __toString(): string + { + return "PhoneNumberMatch [{$this->start()},{$this->end()}) {$this->rawString}"; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberType.php b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberType.php new file mode 100644 index 00000000000..aca23fc2663 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberType.php @@ -0,0 +1,71 @@ + + */ + public static function values(): array + { + return [ + 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', + ]; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberUtil.php b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberUtil.php new file mode 100644 index 00000000000..5a71808347a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/PhoneNumberUtil.php @@ -0,0 +1,3575 @@ +If you use this library, and want to be notified about important changes, please sign up to + * our mailing list. + * + * NOTE: A lot of methods in this class require Region Code strings. These must be provided using + * CLDR two-letter region-code format. These should be in upper-case. The list of the codes + * can be found here: + * http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + * @phpstan-consistent-constructor + */ +class PhoneNumberUtil +{ + /** Flags to use when compiling regular expressions for phone numbers */ + protected const REGEX_FLAGS = 'ui'; //Unicode and case insensitive + // The minimum and maximum length of the national significant number. + protected const MIN_LENGTH_FOR_NSN = 2; + // The ITU says the maximum length should be 15, but we have found longer numbers in Germany. + protected const MAX_LENGTH_FOR_NSN = 17; + + // We don't allow input strings for parsing to be longer than 250 chars. This prevents malicious + // input from overflowing the regular-expression engine. + protected const MAX_INPUT_STRING_LENGTH = 250; + + // The maximum length of the country calling code. + protected const MAX_LENGTH_COUNTRY_CODE = 3; + + /** + * @internal + */ + public const REGION_CODE_FOR_NON_GEO_ENTITY = '001'; + /** + * @internal + */ + public const META_DATA_FILE_PREFIX = __DIR__ . '/data/PhoneNumberMetadata'; + + // Region-code for the unknown region. + protected const UNKNOWN_REGION = 'ZZ'; + + protected const NANPA_COUNTRY_CODE = 1; + // The PLUS_SIGN signifies the international prefix. + protected const PLUS_SIGN = '+'; + protected const PLUS_CHARS = '++'; + protected const STAR_SIGN = '*'; + + protected const RFC3966_EXTN_PREFIX = ';ext='; + protected const RFC3966_PREFIX = 'tel:'; + protected const RFC3966_PHONE_CONTEXT = ';phone-context='; + protected const RFC3966_ISDN_SUBADDRESS = ';isub='; + + // We use this pattern to check if the phone number has at least three letters in it - if so, then + // we treat it as a number where some phone-number digits are represented by letters. + protected const VALID_ALPHA_PHONE_PATTERN = '(?:.*?[A-Za-z]){3}.*'; + // We accept alpha characters in phone numbers, ASCII only, upper and lower case. + protected const VALID_ALPHA = 'A-Za-z'; + + // Default extension prefix to use when formatting. This will be put in front of any extension + // component of the number, after the main national number is formatted. For example, if you wish + // the default extension formatting to be " extn: 3456", then you should specify " extn: " here + // as the default extension prefix. This can be overridden by region-specific preferences. + protected const DEFAULT_EXTN_PREFIX = ' ext. '; + + // Regular expression of acceptable punctuation found in phone numbers, used to find numbers in + // text and to decide what is a viable phone number. This excludes diallable characters. + // This consists of dash characters, white space characters, full stops, slashes, + // square brackets, parentheses and tildes. It also includes the letter 'x' as that is found as a + // placeholder for carrier information in some phone numbers. Full-width variants are also + // present. + protected const VALID_PUNCTUATION = "-x\xE2\x80\x90-\xE2\x80\x95\xE2\x88\x92\xE3\x83\xBC\xEF\xBC\x8D-\xEF\xBC\x8F \xC2\xA0\xC2\xAD\xE2\x80\x8B\xE2\x81\xA0\xE3\x80\x80()\xEF\xBC\x88\xEF\xBC\x89\xEF\xBC\xBB\xEF\xBC\xBD.\\[\\]/~\xE2\x81\x93\xE2\x88\xBC"; + protected const DIGITS = '\\p{Nd}'; + + // Pattern that makes it easy to distinguish whether a region has a single international dialing + // prefix or not. If a region has a single international prefix (e.g. 011 in USA), it will be + // represented as a string that contains a sequence of ASCII digits, and possible a tilde, which + // signals waiting for the tone. If there are multiple available international prefixes in a + // region, they will be represented as a regex string that always contains one or more characters + // that are not ASCII digits or a tilde. + protected const SINGLE_INTERNATIONAL_PREFIX = "[\\d]+(?:[~\xE2\x81\x93\xE2\x88\xBC\xEF\xBD\x9E][\\d]+)?"; + protected const NON_DIGITS_PATTERN = '(\\D+)'; + + // The FIRST_GROUP_PATTERN was originally set to $1 but there are some countries for which the + // first group is not used in the national pattern (e.g. Argentina) so the $1 group does not match + // correctly. Therefore, we use \d, so that the first group actually used in the pattern will be + // matched. + protected const FIRST_GROUP_PATTERN = '(\$\\d)'; + // Constants used in the formatting rules to represent the national prefix, first group and + // carrier code respectively. + protected const NP_STRING = '$NP'; + protected const FG_STRING = '$FG'; + protected const CC_STRING = '$CC'; + + // A pattern that is used to determine if the national prefix formatting rule has the first group + // only, i.e, does not start with the national prefix. Note that the pattern explicitly allows + // for unbalanced parentheses. + protected const FIRST_GROUP_ONLY_PREFIX_PATTERN = '\\(?\\$1\\)?'; + protected const PLUS_CHARS_PATTERN = '[' . self::PLUS_CHARS . ']+'; + protected const SEPARATOR_PATTERN = '[' . self::VALID_PUNCTUATION . ']+'; + protected const CAPTURING_DIGIT_PATTERN = '(' . self::DIGITS . ')'; + protected const VALID_START_CHAR_PATTERN = '[' . self::PLUS_CHARS . self::DIGITS . ']'; + protected const SECOND_NUMBER_START_PATTERN = '[\\\\/] *x'; + //protected const UNWANTED_END_CHAR_PATTERN = '[[\\P{N}&&\\P{L}]&&[^#]]+$'; + protected const UNWANTED_END_CHAR_PATTERN = '[^' . self::DIGITS . self::VALID_ALPHA . '#]+$'; + protected const DIALLABLE_CHAR_MAPPINGS = self::ASCII_DIGIT_MAPPINGS + + [self::PLUS_SIGN => self::PLUS_SIGN] + + ['*' => '*', '#' => '#']; + + + protected static ?PhoneNumberUtil $instance = null; + + /** + * Only upper-case variants of alpha characters are stored. + */ + protected const ALPHA_MAPPINGS = [ + 'A' => '2', + 'B' => '2', + 'C' => '2', + 'D' => '3', + 'E' => '3', + 'F' => '3', + 'G' => '4', + 'H' => '4', + 'I' => '4', + 'J' => '5', + 'K' => '5', + 'L' => '5', + 'M' => '6', + 'N' => '6', + 'O' => '6', + 'P' => '7', + 'Q' => '7', + 'R' => '7', + 'S' => '7', + 'T' => '8', + 'U' => '8', + 'V' => '8', + 'W' => '9', + 'X' => '9', + 'Y' => '9', + 'Z' => '9', + ]; + + /** + * Map of country calling codes that use a mobile token before the area code. One example of when + * this is relevant is when determining the length of the national destination code, which should + * be the length of the area code plus the length of the mobile token. + */ + protected const MOBILE_TOKEN_MAPPINGS = [ + '54' => '9', + ]; + + /** + * Set of country codes that have geographically assigned mobile numbers (see GEO_MOBILE_COUNTRIES + * below) which are not based on *area codes*. For example, in China mobile numbers start with a + * carrier indicator, and beyond that are geographically assigned: this carrier indicator is not + * considered to be an area code. + */ + protected const GEO_MOBILE_COUNTRIES_WITHOUT_MOBILE_AREA_CODES = [ + 86, // China + ]; + + /** + * Set of country calling codes that have geographically assigned mobile numbers. This may not be + * complete; we add calling codes case by case, as we find geographical mobile numbers or hear + * from user reports. Note that countries like the US, where we can't distinguish between + * fixed-line or mobile numbers, are not listed here, since we consider FIXED_LINE_OR_MOBILE to be + * a possibly geographically-related type anyway (like FIXED_LINE). + */ + protected const GEO_MOBILE_COUNTRIES = [ + 52, // Mexico + 54, // Argentina + 55, // Brazil + 62, // Indonesia: some prefixes only (fixed CMDA wireless) + ] + self::GEO_MOBILE_COUNTRIES_WITHOUT_MOBILE_AREA_CODES; + + /** + * For performance reasons, amalgamate both into one map. + */ + protected const ALPHA_PHONE_MAPPINGS = self::ALPHA_MAPPINGS + self::ASCII_DIGIT_MAPPINGS; + + /** + * Separate map of all symbols that we wish to retain when formatting alpha numbers. This + * includes digits, ASCII letters and number grouping symbols such as "-" and " ". + * + * @var array + */ + protected static array $ALL_PLUS_NUMBER_GROUPING_SYMBOLS; + + /** + * Simple ASCII digits map used to populate ALPHA_PHONE_MAPPINGS and + * ALL_PLUS_NUMBER_GROUPING_SYMBOLS. + */ + protected const ASCII_DIGIT_MAPPINGS = [ + '0' => '0', + '1' => '1', + '2' => '2', + '3' => '3', + '4' => '4', + '5' => '5', + '6' => '6', + '7' => '7', + '8' => '8', + '9' => '9', + ]; + + /** + * Regexp of all possible ways to write extensions, for use when parsing. This will be run as a + * case-insensitive regexp match. Wide character versions are also provided after each ASCII + * version. + */ + protected static string $EXTN_PATTERNS_FOR_PARSING; + protected static string $EXTN_PATTERNS_FOR_MATCHING; + // Regular expression of valid global-number-digits for the phone-context parameter, following the + // syntax defined in RFC3966. + protected static string $RFC3966_VISUAL_SEPARATOR = '[\\-\\.\\(\\)]?'; + protected static string $RFC3966_PHONE_DIGIT; + protected static string $RFC3966_GLOBAL_NUMBER_DIGITS; + + // Regular expression of valid domainname for the phone-context parameter, following the syntax + // defined in RFC3966. + protected static string $ALPHANUM; + protected static string $RFC3966_DOMAINLABEL; + protected static string $RFC3966_TOPLABEL; + protected static string $RFC3966_DOMAINNAME; + protected static string $EXTN_PATTERN; + protected static string $VALID_PHONE_NUMBER_PATTERN; + protected static string $MIN_LENGTH_PHONE_NUMBER_PATTERN; + /** + * Regular expression of viable phone numbers. This is location independent. Checks we have at + * least three leading digits, and only valid punctuation, alpha characters and + * digits in the phone number. Does not include extension data. + * The symbol 'x' is allowed here as valid punctuation since it is often used as a placeholder for + * carrier codes, for example in Brazilian phone numbers. We also allow multiple "+" characters at + * the start. + * Corresponds to the following: + * [digits]{minLengthNsn}| + * plus_sign*(([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])* + * + * The first reg-ex is to allow short numbers (two digits long) to be parsed if they are entered + * as "15" etc, but only if there is no punctuation in them. The second expression restricts the + * number of digits to three or more, but then allows them to be in international form, and to + * have alpha-characters and punctuation. + * + * Note VALID_PUNCTUATION starts with a -, so must be the first in the range. + * + * @var string + */ + protected static string $VALID_PHONE_NUMBER; + /** + * @var array + */ + protected const NUMERIC_CHARACTERS = [ + "\xef\xbc\x90" => 0, + "\xef\xbc\x91" => 1, + "\xef\xbc\x92" => 2, + "\xef\xbc\x93" => 3, + "\xef\xbc\x94" => 4, + "\xef\xbc\x95" => 5, + "\xef\xbc\x96" => 6, + "\xef\xbc\x97" => 7, + "\xef\xbc\x98" => 8, + "\xef\xbc\x99" => 9, + + "\xd9\xa0" => 0, + "\xd9\xa1" => 1, + "\xd9\xa2" => 2, + "\xd9\xa3" => 3, + "\xd9\xa4" => 4, + "\xd9\xa5" => 5, + "\xd9\xa6" => 6, + "\xd9\xa7" => 7, + "\xd9\xa8" => 8, + "\xd9\xa9" => 9, + + "\xdb\xb0" => 0, + "\xdb\xb1" => 1, + "\xdb\xb2" => 2, + "\xdb\xb3" => 3, + "\xdb\xb4" => 4, + "\xdb\xb5" => 5, + "\xdb\xb6" => 6, + "\xdb\xb7" => 7, + "\xdb\xb8" => 8, + "\xdb\xb9" => 9, + + "\xe1\xa0\x90" => 0, + "\xe1\xa0\x91" => 1, + "\xe1\xa0\x92" => 2, + "\xe1\xa0\x93" => 3, + "\xe1\xa0\x94" => 4, + "\xe1\xa0\x95" => 5, + "\xe1\xa0\x96" => 6, + "\xe1\xa0\x97" => 7, + "\xe1\xa0\x98" => 8, + "\xe1\xa0\x99" => 9, + ]; + + /** + * The set of county calling codes that map to the non-geo entity region ("001"). + * + * @var int[] + */ + protected array $countryCodesForNonGeographicalRegion = []; + /** + * The set of regions the library supports. + * + * @var string[] + */ + protected array $supportedRegions = []; + + /** + * A mapping from a country calling code to the region codes which denote the region represented + * by that country calling code. In the case of multiple regions sharing a calling code, such as + * the NANPA regions, the one indicated with "isMainCountryForCode" in the metadata should be + * first. + * + * @var array + */ + protected array $countryCallingCodeToRegionCodeMap = []; + /** + * The set of regions that share country calling code 1. + * + * @var string[] + */ + protected array $nanpaRegions = []; + + protected MetadataSourceInterface $metadataSource; + + protected MatcherAPIInterface $matcherAPI; + + /** + * This class implements a singleton, so the only constructor is protected. + * @param MetadataSourceInterface $metadataSource + * @param array $countryCallingCodeToRegionCodeMap + */ + protected function __construct(MetadataSourceInterface $metadataSource, array $countryCallingCodeToRegionCodeMap) + { + $this->metadataSource = $metadataSource; + $this->countryCallingCodeToRegionCodeMap = $countryCallingCodeToRegionCodeMap; + $this->init(); + $this->matcherAPI = RegexBasedMatcher::create(); + static::initExtnPatterns(); + static::initExtnPattern(); + static::initRFC3966Patterns(); + + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS = []; + // Put (lower letter -> upper letter) and (upper letter -> upper letter) mappings. + foreach (static::ALPHA_MAPPINGS as $c => $value) { + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS[strtolower($c)] = $c; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS[(string)$c] = (string)$c; + } + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS += static::ASCII_DIGIT_MAPPINGS; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS['-'] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xEF\xBC\x8D"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x80\x90"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x80\x91"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x80\x92"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x80\x93"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x80\x94"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x80\x95"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x88\x92"] = '-'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS['/'] = '/'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xEF\xBC\x8F"] = '/'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS[' '] = ' '; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE3\x80\x80"] = ' '; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xE2\x81\xA0"] = ' '; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS['.'] = '.'; + static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS["\xEF\xBC\x8E"] = '.'; + + static::initValidPhoneNumberPatterns(); + } + + /** + * Gets a {@link PhoneNumberUtil} instance to carry out international phone number formatting, + * parsing or validation. The instance is loaded with phone number metadata for a number of most + * commonly used regions. + * + *

The {@link PhoneNumberUtil} is implemented as a singleton. Therefore, calling getInstance + * multiple times will only result in one instance being created. + * + * @param string $baseFileLocation + * @param array>|null $countryCallingCodeToRegionCodeMap + * @param MetadataLoaderInterface|null $metadataLoader + * @param MetadataSourceInterface|null $metadataSource + * @return PhoneNumberUtil instance + */ + public static function getInstance( + string $baseFileLocation = self::META_DATA_FILE_PREFIX, + array $countryCallingCodeToRegionCodeMap = null, + MetadataLoaderInterface $metadataLoader = null, + MetadataSourceInterface $metadataSource = null + ): PhoneNumberUtil { + if (static::$instance === null) { + if ($countryCallingCodeToRegionCodeMap === null) { + $countryCallingCodeToRegionCodeMap = CountryCodeToRegionCodeMap::COUNTRY_CODE_TO_REGION_CODE_MAP; + } + + if ($metadataLoader === null) { + $metadataLoader = new DefaultMetadataLoader(); + } + + if ($metadataSource === null) { + $metadataSource = new MultiFileMetadataSourceImpl($metadataLoader, $baseFileLocation); + } + + static::$instance = new static($metadataSource, $countryCallingCodeToRegionCodeMap); + } + return static::$instance; + } + + protected function init(): void + { + $supportedRegions = [[]]; + + foreach ($this->countryCallingCodeToRegionCodeMap as $countryCode => $regionCodes) { + // We can assume that if the country calling code maps to the non-geo entity region code then + // that's the only region code it maps to. + if (count($regionCodes) === 1 && static::REGION_CODE_FOR_NON_GEO_ENTITY === $regionCodes[0]) { + // This is the subset of all country codes that map to the non-geo entity region code. + $this->countryCodesForNonGeographicalRegion[] = $countryCode; + } else { + // The supported regions set does not include the "001" non-geo entity region code. + $supportedRegions[] = $regionCodes; + } + } + + $this->supportedRegions = array_merge(...$supportedRegions); + + // If the non-geo entity still got added to the set of supported regions it must be because + // there are entries that list the non-geo entity alongside normal regions (which is wrong). + // If we discover this, remove the non-geo entity from the set of supported regions and log. + $idx_region_code_non_geo_entity = array_search(static::REGION_CODE_FOR_NON_GEO_ENTITY, $this->supportedRegions); + if ($idx_region_code_non_geo_entity !== false) { + unset($this->supportedRegions[$idx_region_code_non_geo_entity]); + } + $this->nanpaRegions = $this->countryCallingCodeToRegionCodeMap[static::NANPA_COUNTRY_CODE]; + } + + protected static function initExtnPatterns(): void + { + static::$EXTN_PATTERNS_FOR_PARSING = static::createExtnPattern(true); + static::$EXTN_PATTERNS_FOR_MATCHING = static::createExtnPattern(false); + } + + protected static function initRFC3966Patterns(): void + { + static::$RFC3966_PHONE_DIGIT = '(' . static::DIGITS . '|' . static::$RFC3966_VISUAL_SEPARATOR . ')'; + static::$RFC3966_GLOBAL_NUMBER_DIGITS = '^\\' . static::PLUS_SIGN . static::$RFC3966_PHONE_DIGIT . '*' . static::DIGITS . static::$RFC3966_PHONE_DIGIT . '*$'; + + static::$ALPHANUM = static::VALID_ALPHA . static::DIGITS; + static::$RFC3966_DOMAINLABEL = '[' . static::$ALPHANUM . ']+((\\-)*[' . static::$ALPHANUM . '])*'; + static::$RFC3966_TOPLABEL = '[' . static::VALID_ALPHA . ']+((\\-)*[' . static::$ALPHANUM . '])*'; + static::$RFC3966_DOMAINNAME = '^(' . static::$RFC3966_DOMAINLABEL . '\\.)*' . static::$RFC3966_TOPLABEL . '\\.?$'; + } + + /** + * Helper method for constructing regular expressions for parsing. Creates an expression that + * captures up to maxLength digits. + */ + protected static function extnDigits(int $maxLength): string + { + return '(' . self::DIGITS . '{1,' . $maxLength . '})'; + } + + /** + * Helper initialiser method to create the regular-expression pattern to match extensions. + * Note that there are currently six capturing groups for the extension itself. If this number is + * changed, MaybeStripExtension needs to be updated. + */ + protected static function createExtnPattern(bool $forParsing): string + { + // We cap the maximum length of an extension based on the ambiguity of the way the extension is + // prefixed. As per ITU, the officially allowed length for extensions is actually 40, but we + // don't support this since we haven't seen real examples and this introduces many false + // interpretations as the extension labels are not standardized. + $extLimitAfterExplicitLabel = 20; + $extLimitAfterLikelyLabel = 15; + $extLimitAfterAmbiguousChar = 9; + $extLimitWhenNotSure = 6; + + + + $possibleSeparatorsBetweenNumberAndExtLabel = "[ \xC2\xA0\\t,]*"; + // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas. + $possibleCharsAfterExtLabel = "[:\\.\xEf\xBC\x8E]?[ \xC2\xA0\\t,-]*"; + $optionalExtnSuffix = '#?'; + + // Here the extension is called out in more explicit way, i.e mentioning it obvious patterns + // like "ext.". Canonical-equivalence doesn't seem to be an option with Android java, so we + // allow two options for representing the accented o - the character itself, and one in the + // unicode decomposed form with the combining acute accent. + $explicitExtLabels = "(?:e?xt(?:ensi(?:o\xCC\x81?|\xC3\xB3))?n?|\xEF\xBD\x85?\xEF\xBD\x98\xEF\xBD\x94\xEF\xBD\x8E?|\xD0\xB4\xD0\xBE\xD0\xB1|anexo)"; + // One-character symbols that can be used to indicate an extension, and less commonly used + // or more ambiguous extension labels. + $ambiguousExtLabels = "(?:[x\xEF\xBD\x98#\xEF\xBC\x83~\xEF\xBD\x9E]|int|\xEF\xBD\x89\xEF\xBD\x8E\xEF\xBD\x94)"; + // When extension is not separated clearly. + $ambiguousSeparator = '[- ]+'; + + $rfcExtn = static::RFC3966_EXTN_PREFIX . static::extnDigits($extLimitAfterExplicitLabel); + $explicitExtn = $possibleSeparatorsBetweenNumberAndExtLabel . $explicitExtLabels + . $possibleCharsAfterExtLabel . static::extnDigits($extLimitAfterExplicitLabel) + . $optionalExtnSuffix; + $ambiguousExtn = $possibleSeparatorsBetweenNumberAndExtLabel . $ambiguousExtLabels + . $possibleCharsAfterExtLabel . static::extnDigits($extLimitAfterAmbiguousChar) . $optionalExtnSuffix; + $americanStyleExtnWithSuffix = $ambiguousSeparator . static::extnDigits($extLimitWhenNotSure) . '#'; + + // The first regular expression covers RFC 3966 format, where the extension is added using + // ";ext=". The second more generic where extension is mentioned with explicit labels like + // "ext:". In both the above cases we allow more numbers in extension than any other extension + // labels. The third one captures when single character extension labels or less commonly used + // labels are used. In such cases we capture fewer extension digits in order to reduce the + // chance of falsely interpreting two numbers beside each other as a number + extension. The + // fourth one covers the special case of American numbers where the extension is written with a + // hash at the end, such as "- 503#". + $extensionPattern = + $rfcExtn . '|' + . $explicitExtn . '|' + . $ambiguousExtn . '|' + . $americanStyleExtnWithSuffix; + // Additional pattern that is supported when parsing extensions, not when matching. + if ($forParsing) { + // This is same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching comma as + // extension label may have it. + $possibleSeparatorsNumberExtLabelNoComma = "[ \xC2\xA0\\t]*"; + // ",," is commonly used for auto dialling the extension when connected. First comma is matched + // through possibleSeparatorsBetweenNumberAndExtLabel, so we do not repeat it here. Semi-colon + // works in Iphone and Android also to pop up a button with the extension number following. + $autoDiallingAndExtLabelsFound = '(?:,{2}|;)'; + + $autoDiallingExtn = $possibleSeparatorsNumberExtLabelNoComma + . $autoDiallingAndExtLabelsFound . $possibleCharsAfterExtLabel + . static::extnDigits($extLimitAfterLikelyLabel) . $optionalExtnSuffix; + $onlyCommasExtn = $possibleSeparatorsNumberExtLabelNoComma + . '(?:,)+' . $possibleCharsAfterExtLabel . static::extnDigits($extLimitAfterAmbiguousChar) + . $optionalExtnSuffix; + // Here the first pattern is exclusively for extension autodialling formats which are used + // when dialling and in this case we accept longer extensions. However, the second pattern + // is more liberal on the number of commas that acts as extension labels, so we have a strict + // cap on the number of digits in such extensions. + return $extensionPattern . '|' + . $autoDiallingExtn . '|' + . $onlyCommasExtn; + } + return $extensionPattern; + } + + protected static function initExtnPattern(): void + { + static::$EXTN_PATTERN = '/(?:' . static::$EXTN_PATTERNS_FOR_PARSING . ')$/' . static::REGEX_FLAGS; + } + + protected static function initValidPhoneNumberPatterns(): void + { + static::initExtnPatterns(); + static::$MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' . static::DIGITS . ']{' . static::MIN_LENGTH_FOR_NSN . '}'; + static::$VALID_PHONE_NUMBER = '[' . static::PLUS_CHARS . ']*(?:[' . static::VALID_PUNCTUATION . static::STAR_SIGN . ']*[' . static::DIGITS . ']){3,}[' . static::VALID_PUNCTUATION . static::STAR_SIGN . static::VALID_ALPHA . static::DIGITS . ']*'; + static::$VALID_PHONE_NUMBER_PATTERN = '%^' . static::$MIN_LENGTH_PHONE_NUMBER_PATTERN . '$|^' . static::$VALID_PHONE_NUMBER . '(?:' . static::$EXTN_PATTERNS_FOR_PARSING . ')?$%' . static::REGEX_FLAGS; + } + + /** + * Used for testing purposes only to reset the PhoneNumberUtil singleton to null. + */ + public static function resetInstance(): void + { + static::$instance = null; + } + + /** + * Converts all alpha characters in a number to their respective digits on a keypad, but retains + * existing formatting. + */ + public static function convertAlphaCharactersInNumber(string $number): string + { + return static::normalizeHelper($number, static::ALPHA_PHONE_MAPPINGS, false); + } + + /** + * Normalizes a string of characters representing a phone number by replacing all characters found + * in the accompanying map with the values therein, and stripping all other characters if + * removeNonMatches is true. + * + * @param string $number a string of characters representing a phone number + * @param array $normalizationReplacements a mapping of characters to what they should be replaced by in + * the normalized version of the phone number. + * @param bool $removeNonMatches indicates whether characters that are not able to be replaced. + * should be stripped from the number. If this is false, they will be left unchanged in the number. + * @return string the normalized string version of the phone number. + */ + protected static function normalizeHelper(string $number, array $normalizationReplacements, bool $removeNonMatches): string + { + $normalizedNumber = ''; + $strLength = mb_strlen($number, 'UTF-8'); + for ($i = 0; $i < $strLength; $i++) { + $character = mb_substr($number, $i, 1, 'UTF-8'); + if (isset($normalizationReplacements[mb_strtoupper($character, 'UTF-8')])) { + $normalizedNumber .= $normalizationReplacements[mb_strtoupper($character, 'UTF-8')]; + } elseif (!$removeNonMatches) { + $normalizedNumber .= $character; + } + // If neither of the above are true, we remove this character. + } + return $normalizedNumber; + } + + /** + * Helper function to check if the national prefix formatting rule has the first group only, i.e., + * does not start with the national prefix. + */ + public static function formattingRuleHasFirstGroupOnly(string $nationalPrefixFormattingRule): bool + { + $firstGroupOnlyPrefixPatternMatcher = new Matcher( + static::FIRST_GROUP_ONLY_PREFIX_PATTERN, + $nationalPrefixFormattingRule + ); + + return $nationalPrefixFormattingRule === '' + || $firstGroupOnlyPrefixPatternMatcher->matches(); + } + + /** + * Returns all regions the library has metadata for. + * + * @return string[] An unordered array of the two-letter region codes for every geographical region the + * library supports + */ + public function getSupportedRegions(): array + { + return $this->supportedRegions; + } + + /** + * Returns all global network calling codes the library has metadata for. + * + * @return int[] An unordered array of the country calling codes for every non-geographical entity + * the library supports + */ + public function getSupportedGlobalNetworkCallingCodes(): array + { + return $this->countryCodesForNonGeographicalRegion; + } + + /** + * Returns all country calling codes the library has metadata for, covering both non-geographical + * entities (global network calling codes) and those used for geographical entities. This could be + * used to populate a drop-down box of country calling codes for a phone-number widget, for + * instance. + * + * @return int[] An unordered array of the country calling codes for every geographical and + * non-geographical entity the library supports + */ + public function getSupportedCallingCodes(): array + { + return array_keys($this->countryCallingCodeToRegionCodeMap); + } + + /** + * Returns true if there is any possible number data set for a particular PhoneNumberDesc. + * + * @return bool + */ + protected static function descHasPossibleNumberData(PhoneNumberDesc $desc): bool + { + // If this is empty, it means numbers of this type inherit from the "general desc" -> the value + // '-1' means that no numbers exist for this type. + $possibleLength = $desc->getPossibleLength(); + return count($possibleLength) !== 1 || $possibleLength[0] !== -1; + } + + /** + * Returns true if there is any data set for a particular PhoneNumberDesc. + * + * @return bool + */ + protected static function descHasData(PhoneNumberDesc $desc): bool + { + // Checking most properties since we don't know what's present, since a custom build may have + // stripped just one of them (e.g. liteBuild strips exampleNumber). We don't bother checking the + // possibleLengthsLocalOnly, since if this is the only thing that's present we don't really + // support the type at all: no type-specific methods will work with only this data. + return $desc->hasExampleNumber() + || static::descHasPossibleNumberData($desc) + || $desc->hasNationalNumberPattern(); + } + + /** + * Returns the types we have metadata for based on the PhoneMetadata object passed in. + * + * @return array + */ + private function getSupportedTypesForMetadata(PhoneMetadata $metadata): array + { + $types = []; + foreach (array_keys(PhoneNumberType::values()) as $type) { + if ($type === PhoneNumberType::FIXED_LINE_OR_MOBILE || $type === PhoneNumberType::UNKNOWN) { + // Never return FIXED_LINE_OR_MOBILE (it is a convenience type, and represents that a + // particular number type can't be determined) or UNKNOWN (the non-type). + continue; + } + + if (self::descHasData($this->getNumberDescByType($metadata, $type))) { + $types[] = $type; + } + } + + return $types; + } + + /** + * Returns the types for a given region which the library has metadata for. Will not include + * FIXED_LINE_OR_MOBILE (if the numbers in this region could be classified as FIXED_LINE_OR_MOBILE, + * both FIXED_LINE and MOBILE would be present) and UNKNOWN. + * + * No types will be returned for invalid or unknown region codes. + * + * @param string $regionCode + * @return array Array of PhoneNumberType's + */ + public function getSupportedTypesForRegion(string $regionCode): array + { + $metadata = $this->getMetadataForRegion($regionCode); + + if ($metadata === null) { + return []; + } + + return $this->getSupportedTypesForMetadata($metadata); + } + + /** + * Returns the types for a country-code belonging to a non-geographical entity which the library + * has metadata for. Will not include FIXED_LINE_OR_MOBILE (if numbers for this non-geographical + * entity could be classified as FIXED_LINE_OR_MOBILE, both FIXED_LINE and MOBILE would be + * present) and UNKNOWN. + * @return array Array of PhoneNumberType's + */ + public function getSupportedTypesForNonGeoEntity(int $countryCallingCode): array + { + $metadata = $this->getMetadataForNonGeographicalRegion($countryCallingCode); + if ($metadata === null) { + return []; + } + + return $this->getSupportedTypesForMetadata($metadata); + } + + /** + * Gets the length of the geographical area code from the {@code nationalNumber} field of the + * PhoneNumber object passed in, so that clients could use it to split a national significant + * number into geographical area code and subscriber number. It works in such a way that the + * resultant subscriber number should be diallable, at least on some devices. An example of how + * this could be used: + * + * + * $phoneUtil = PhoneNumberUtil::getInstance(); + * $number = $phoneUtil->parse("16502530000", "US"); + * $nationalSignificantNumber = $phoneUtil->getNationalSignificantNumber($number); + * + * $areaCodeLength = $phoneUtil->getLengthOfGeographicalAreaCode($number); + * if ($areaCodeLength > 0) + * { + * $areaCode = substr($nationalSignificantNumber, 0,$areaCodeLength); + * $subscriberNumber = substr($nationalSignificantNumber, $areaCodeLength); + * } else { + * $areaCode = ""; + * $subscriberNumber = $nationalSignificantNumber; + * } + * + * + * N.B.: area code is a very ambiguous concept, so the I18N team generally recommends against + * using it for most purposes, but recommends using the more general {@code nationalNumber} + * instead. Read the following carefully before deciding to use this method: + *

    + *
  • geographical area codes change over time, and this method honors those changes; + * therefore, it doesn't guarantee the stability of the result it produces. + *
  • subscriber numbers may not be diallable from all devices (notably mobile devices, which + * typically requires the full national_number to be dialled in most regions). + *
  • most non-geographical numbers have no area codes, including numbers from non-geographical + * entities + *
  • some geographical numbers have no area codes. + *
+ * + * @param PhoneNumber $number PhoneNumber object for which clients want to know the length of the area code. + * @return int the length of area code of the PhoneNumber object passed in. + */ + public function getLengthOfGeographicalAreaCode(PhoneNumber $number): int + { + $metadata = $this->getMetadataForRegion($this->getRegionCodeForNumber($number)); + if ($metadata === null) { + return 0; + } + // If a country doesn't use a national prefix, and this number doesn't have an Italian leading + // zero, we assume it is a closed dialling plan with no area codes. + if (!$metadata->hasNationalPrefix() && !$number->isItalianLeadingZero()) { + return 0; + } + + $type = $this->getNumberType($number); + $countryCallingCode = $number->getCountryCode(); + + if ($type === PhoneNumberType::MOBILE + // Note this is a rough heuristic; it doesn't cover Indonesia well, for example, where area + // codes are present for some mobile phones but not for others. We have no better way of + // representing this in the metadata at this point. + && in_array($countryCallingCode, self::GEO_MOBILE_COUNTRIES_WITHOUT_MOBILE_AREA_CODES) + ) { + return 0; + } + + if (!$this->isNumberGeographical($type, $countryCallingCode)) { + return 0; + } + + return $this->getLengthOfNationalDestinationCode($number); + } + + /** + * Returns the metadata for the given region code or {@code null} if the region code is invalid + * or unknown. + */ + public function getMetadataForRegion(?string $regionCode): ?PhoneMetadata + { + if (!$this->isValidRegionCode($regionCode)) { + return null; + } + + return $this->metadataSource->getMetadataForRegion($regionCode); + } + + /** + * Helper function to check region code is not unknown or null. + */ + protected function isValidRegionCode(?string $regionCode): bool + { + return $regionCode !== null && in_array(strtoupper($regionCode), $this->supportedRegions); + } + + /** + * Returns the region where a phone number is from. This could be used for geocoding at the region + * level. Only guarantees correct results for valid, full numbers (not short-codes, or invalid + * numbers). + * + * @param PhoneNumber $number the phone number whose origin we want to know + * @return null|string the region where the phone number is from, or null if no region matches this calling + * code + */ + public function getRegionCodeForNumber(PhoneNumber $number): ?string + { + $countryCode = $number->getCountryCode(); + if (!isset($this->countryCallingCodeToRegionCodeMap[$countryCode])) { + return null; + } + $regions = $this->countryCallingCodeToRegionCodeMap[$countryCode]; + if (count($regions) === 1) { + return $regions[0]; + } + + return $this->getRegionCodeForNumberFromRegionList($number, $regions); + } + + /** + * Returns the region code for a number from the list of region codes passing in. + * + * @param string[] $regionCodes + */ + protected function getRegionCodeForNumberFromRegionList(PhoneNumber $number, array $regionCodes): ?string + { + $nationalNumber = $this->getNationalSignificantNumber($number); + foreach ($regionCodes as $regionCode) { + // If leadingDigits is present, use this. Otherwise, do full validation. + // Metadata cannot be null because the region codes come from the country calling code map. + /** @var PhoneMetadata $metadata */ + $metadata = $this->getMetadataForRegion($regionCode); + if ($metadata->hasLeadingDigits()) { + $nbMatches = preg_match( + '/' . $metadata->getLeadingDigits() . '/', + $nationalNumber, + $matches, + PREG_OFFSET_CAPTURE + ); + if ($nbMatches > 0 && $matches[0][1] === 0) { + return $regionCode; + } + } elseif ($this->getNumberTypeHelper($nationalNumber, $metadata) !== PhoneNumberType::UNKNOWN) { + return $regionCode; + } + } + return null; + } + + /** + * Gets the national significant number of the phone number. Note a national significant number + * doesn't contain a national prefix or any formatting. + * + * @param PhoneNumber $number the phone number for which the national significant number is needed + * @return string the national significant number of the PhoneNumber object passed in + */ + public function getNationalSignificantNumber(PhoneNumber $number): string + { + // If leading zero(s) have been set, we prefix this now. Note this is not a national prefix. + $nationalNumber = ''; + if ($number->isItalianLeadingZero() && $number->getNumberOfLeadingZeros() > 0) { + $zeros = str_repeat('0', $number->getNumberOfLeadingZeros()); + $nationalNumber .= $zeros; + } + $nationalNumber .= $number->getNationalNumber(); + return $nationalNumber; + } + + /** + * Returns the type of number passed in i.e Toll free, premium. + * + * @param string $nationalNumber + * @return int PhoneNumberType constant + */ + protected function getNumberTypeHelper(string $nationalNumber, PhoneMetadata $metadata): int + { + if (!$this->isNumberMatchingDesc($nationalNumber, $metadata->getGeneralDesc())) { + return PhoneNumberType::UNKNOWN; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getPremiumRate())) { + return PhoneNumberType::PREMIUM_RATE; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getTollFree())) { + return PhoneNumberType::TOLL_FREE; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getSharedCost())) { + return PhoneNumberType::SHARED_COST; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getVoip())) { + return PhoneNumberType::VOIP; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getPersonalNumber())) { + return PhoneNumberType::PERSONAL_NUMBER; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getPager())) { + return PhoneNumberType::PAGER; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getUan())) { + return PhoneNumberType::UAN; + } + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getVoicemail())) { + return PhoneNumberType::VOICEMAIL; + } + $isFixedLine = $this->isNumberMatchingDesc($nationalNumber, $metadata->getFixedLine()); + if ($isFixedLine) { + if ($metadata->getSameMobileAndFixedLinePattern()) { + return PhoneNumberType::FIXED_LINE_OR_MOBILE; + } + + if ($this->isNumberMatchingDesc($nationalNumber, $metadata->getMobile())) { + return PhoneNumberType::FIXED_LINE_OR_MOBILE; + } + return PhoneNumberType::FIXED_LINE; + } + // Otherwise, test to see if the number is mobile. Only do this if certain that the patterns for + // mobile and fixed line aren't the same. + if (!$metadata->getSameMobileAndFixedLinePattern() && + $this->isNumberMatchingDesc($nationalNumber, $metadata->getMobile()) + ) { + return PhoneNumberType::MOBILE; + } + return PhoneNumberType::UNKNOWN; + } + + public function isNumberMatchingDesc(string $nationalNumber, PhoneNumberDesc $numberDesc): bool + { + // Check if any possible number lengths are present; if so, we use them to avoid checking the + // validation pattern if they don't match. If they are absent, this means they match the general + // description, which we have already checked before checking a specific number type. + $actualLength = mb_strlen($nationalNumber); + $possibleLengths = $numberDesc->getPossibleLength(); + if (count($possibleLengths) > 0 && !in_array($actualLength, $possibleLengths)) { + return false; + } + + return $this->matcherAPI->matchNationalNumber($nationalNumber, $numberDesc, false); + } + + /** + * isNumberGeographical(PhoneNumber) + * + * Tests whether a phone number has a geographical association. It checks if the number is + * associated with a certain region in the country to which it belongs. Note that this doesn't + * verify if the number is actually in use. + * + * isNumberGeographical(PhoneNumberType, $countryCallingCode) + * + * Tests whether a phone number has a geographical association, as represented by its type and the + * country it belongs to. + * + * This version exists since calculating the phone number type is expensive; if we have already + * done this, we don't want to do it again. + * + * @param PhoneNumber|int $phoneNumberObjOrType A PhoneNumber object, or a PhoneNumberType integer + * @param int|null $countryCallingCode Used when passing a PhoneNumberType + * @return bool + */ + public function isNumberGeographical(PhoneNumber|int $phoneNumberObjOrType, ?int $countryCallingCode = null): bool + { + if ($phoneNumberObjOrType instanceof PhoneNumber) { + return $this->isNumberGeographical($this->getNumberType($phoneNumberObjOrType), $phoneNumberObjOrType->getCountryCode()); + } + + return $phoneNumberObjOrType === PhoneNumberType::FIXED_LINE + || $phoneNumberObjOrType === PhoneNumberType::FIXED_LINE_OR_MOBILE + || ( + in_array($countryCallingCode, static::GEO_MOBILE_COUNTRIES) + && $phoneNumberObjOrType === PhoneNumberType::MOBILE + ); + } + + /** + * Gets the type of a valid phone number. + * + * @param PhoneNumber $number the number the phone number that we want to know the type + * @return int PhoneNumberType the type of the phone number, or UNKNOWN if it is invalid + */ + public function getNumberType(PhoneNumber $number): int + { + $regionCode = $this->getRegionCodeForNumber($number); + if ($regionCode === null) { + return PhoneNumberType::UNKNOWN; + } + $metadata = $this->getMetadataForRegionOrCallingCode($number->getCountryCode(), $regionCode); + if ($metadata === null) { + return PhoneNumberType::UNKNOWN; + } + $nationalSignificantNumber = $this->getNationalSignificantNumber($number); + return $this->getNumberTypeHelper($nationalSignificantNumber, $metadata); + } + + protected function getMetadataForRegionOrCallingCode(int $countryCallingCode, string $regionCode): ?PhoneMetadata + { + return static::REGION_CODE_FOR_NON_GEO_ENTITY === $regionCode ? + $this->getMetadataForNonGeographicalRegion($countryCallingCode) : $this->getMetadataForRegion($regionCode); + } + + public function getMetadataForNonGeographicalRegion(int $countryCallingCode): ?PhoneMetadata + { + if (!isset($this->countryCallingCodeToRegionCodeMap[$countryCallingCode])) { + return null; + } + return $this->metadataSource->getMetadataForNonGeographicalRegion($countryCallingCode); + } + + /** + * Gets the length of the national destination code (NDC) from the PhoneNumber object passed in, + * so that clients could use it to split a national significant number into NDC and subscriber + * number. The NDC of a phone number is normally the first group of digit(s) right after the + * country calling code when the number is formatted in the international format, if there is a + * subscriber number part that follows. + * + * follows. + * + * N.B.: similar to an area code, not all numbers have an NDC! + * + * An example of how this could be used: + * + * + * $phoneUtil = PhoneNumberUtil::getInstance(); + * $number = $phoneUtil->parse("18002530000", "US"); + * $nationalSignificantNumber = $phoneUtil->getNationalSignificantNumber($number); + * + * $nationalDestinationCodeLength = $phoneUtil->getLengthOfNationalDestinationCode($number); + * if ($nationalDestinationCodeLength > 0) { + * $nationalDestinationCode = substr($nationalSignificantNumber, 0, $nationalDestinationCodeLength); + * $subscriberNumber = substr($nationalSignificantNumber, $nationalDestinationCodeLength); + * } else { + * $nationalDestinationCode = ""; + * $subscriberNumber = $nationalSignificantNumber; + * } + * + * + * Refer to the unit tests to see the difference between this function and + * {@link #getLengthOfGeographicalAreaCode}. + * + * @param PhoneNumber $number the PhoneNumber object for which clients want to know the length of the NDC. + * @return int the length of NDC of the PhoneNumber object passed in, which could be zero + */ + public function getLengthOfNationalDestinationCode(PhoneNumber $number): int + { + if ($number->hasExtension()) { + // We don't want to alter the proto given to us, but we don't want to include the extension + // when we format it, so we copy it and clear the extension here. + $copiedProto = new PhoneNumber(); + $copiedProto->mergeFrom($number); + $copiedProto->clearExtension(); + } else { + $copiedProto = clone $number; + } + + $nationalSignificantNumber = $this->format($copiedProto, PhoneNumberFormat::INTERNATIONAL); + + $numberGroups = preg_split('/' . static::NON_DIGITS_PATTERN . '/', $nationalSignificantNumber); + + // The pattern will start with "+COUNTRY_CODE " so the first group will always be the empty + // string (before the + symbol) and the second group will be the country calling code. The third + // group will be area code if it is not the last group. + if ($numberGroups === false || count($numberGroups) <= 3) { + return 0; + } + + if ($this->getNumberType($number) === PhoneNumberType::MOBILE) { + // For example Argentinian mobile numbers, when formatted in the international format, are in + // the form of +54 9 NDC XXXX.... As a result, we take the length of the third group (NDC) and + // add the length of the second group (which is the mobile token), which also forms part of + // the national significant number. This assumes that the mobile token is always formatted + // separately from the rest of the phone number. + + $mobileToken = static::getCountryMobileToken($number->getCountryCode()); + if ($mobileToken !== '') { + return mb_strlen($numberGroups[2]) + mb_strlen($numberGroups[3]); + } + } + return mb_strlen($numberGroups[2]); + } + + /** + * Formats a phone number in the specified format using default rules. Note that this does not + * promise to produce a phone number that the user can dial from where they are - although we do + * format in either 'national' or 'international' format depending on what the client asks for, we + * do not currently support a more abbreviated format, such as for users in the same "area" who + * could potentially dial the number without area code. Note that if the phone number has a + * country calling code of 0 or an otherwise invalid country calling code, we cannot work out + * which formatting rules to apply so we return the national significant number with no formatting + * applied. + * + * @param PhoneNumber $number the phone number to be formatted + * @param int $numberFormat the PhoneNumberFormat the phone number should be formatted into + * @return string the formatted phone number + */ + public function format(PhoneNumber $number, int $numberFormat): string + { + if ($number->getNationalNumber() === '0' && $number->hasRawInput()) { + // Unparseable numbers that kept their raw input just use that. + // This is the only case where a number can be formatted as E164 without a + // leading '+' symbol (but the original number wasn't parseable anyway). + // TODO: Consider removing the 'if' above so that unparseable + // strings without raw input format to the empty string instead of "+00" + $rawInput = $number->getRawInput(); + if ($rawInput !== '') { + return $rawInput; + } + } + + $formattedNumber = ''; + $countryCallingCode = $number->getCountryCode(); + $nationalSignificantNumber = $this->getNationalSignificantNumber($number); + + if ($numberFormat === PhoneNumberFormat::E164) { + // Early exit for E164 case (even if the country calling code is invalid) since no formatting + // of the national number needs to be applied. Extensions are not formatted. + $formattedNumber .= $nationalSignificantNumber; + $this->prefixNumberWithCountryCallingCode($countryCallingCode, PhoneNumberFormat::E164, $formattedNumber); + return $formattedNumber; + } + + if (!$this->hasValidCountryCallingCode($countryCallingCode)) { + $formattedNumber .= $nationalSignificantNumber; + return $formattedNumber; + } + + // Note getRegionCodeForCountryCode() is used because formatting information for regions which + // share a country calling code is contained by only one region for performance reasons. For + // example, for NANPA regions it will be contained in the metadata for US. + $regionCode = $this->getRegionCodeForCountryCode($countryCallingCode); + // Metadata cannot be null because the country calling code is valid (which means that the + // region code cannot be ZZ and must be one of our supported region codes). + /** @var PhoneMetadata $metadata */ + $metadata = $this->getMetadataForRegionOrCallingCode($countryCallingCode, $regionCode); + $formattedNumber .= $this->formatNsn($nationalSignificantNumber, $metadata, $numberFormat); + $this->maybeAppendFormattedExtension($number, $metadata, $numberFormat, $formattedNumber); + $this->prefixNumberWithCountryCallingCode($countryCallingCode, $numberFormat, $formattedNumber); + return $formattedNumber; + } + + /** + * A helper function that is used by format and formatByPattern. + * @param int $countryCallingCode + * @param int $numberFormat PhoneNumberFormat + * @param string $formattedNumber + */ + protected function prefixNumberWithCountryCallingCode(int $countryCallingCode, int $numberFormat, string &$formattedNumber): void + { + switch ($numberFormat) { + case PhoneNumberFormat::E164: + $formattedNumber = static::PLUS_SIGN . $countryCallingCode . $formattedNumber; + return; + case PhoneNumberFormat::INTERNATIONAL: + $formattedNumber = static::PLUS_SIGN . $countryCallingCode . ' ' . $formattedNumber; + return; + case PhoneNumberFormat::RFC3966: + $formattedNumber = static::RFC3966_PREFIX . static::PLUS_SIGN . $countryCallingCode . '-' . $formattedNumber; + return; + } + } + + /** + * Helper function to check the country calling code is valid. + * @param int $countryCallingCode + * @return bool + */ + protected function hasValidCountryCallingCode(int $countryCallingCode): bool + { + return isset($this->countryCallingCodeToRegionCodeMap[$countryCallingCode]); + } + + /** + * Returns the region code that matches the specific country calling code. In the case of no + * region code being found, ZZ will be returned. In the case of multiple regions, the one + * designated in the metadata as the "main" region for this calling code will be returned. If the + * countryCallingCode entered is valid but doesn't match a specific region (such as in the case of + * non-geographical calling codes like 800) the value "001" will be returned (corresponding to + * the value for World in the UN M.49 schema). + */ + public function getRegionCodeForCountryCode(int $countryCallingCode): string + { + $regionCodes = $this->countryCallingCodeToRegionCodeMap[$countryCallingCode] ?? null; + return $regionCodes === null ? static::UNKNOWN_REGION : $regionCodes[0]; + } + + /** + * Note in some regions, the national number can be written in two completely different ways + * depending on whether it forms part of the NATIONAL format or INTERNATIONAL format. The + * numberFormat parameter here is used to specify which format to use for those cases. If a + * carrierCode is specified, this will be inserted into the formatted string to replace $CC. + * @param string $number + * @param int $numberFormat PhoneNumberFormat + * @param null|string $carrierCode + * @return string + */ + protected function formatNsn(string $number, PhoneMetadata $metadata, int $numberFormat, ?string $carrierCode = null): string + { + $intlNumberFormats = $metadata->intlNumberFormats(); + // When the intlNumberFormats exists, we use that to format national number for the + // INTERNATIONAL format instead of using the numberDesc.numberFormats. + $availableFormats = (empty($intlNumberFormats) || $numberFormat === PhoneNumberFormat::NATIONAL) + ? $metadata->numberFormats() + : $metadata->intlNumberFormats(); + $formattingPattern = $this->chooseFormattingPatternForNumber($availableFormats, $number); + return ($formattingPattern === null) + ? $number + : $this->formatNsnUsingPattern($number, $formattingPattern, $numberFormat, $carrierCode); + } + + /** + * @param NumberFormat[] $availableFormats + * @param string $nationalNumber + * @return NumberFormat|null + */ + public function chooseFormattingPatternForNumber(array $availableFormats, string $nationalNumber): ?NumberFormat + { + foreach ($availableFormats as $numFormat) { + $leadingDigitsPatternMatcher = null; + $size = $numFormat->leadingDigitsPatternSize(); + // We always use the last leading_digits_pattern, as it is the most detailed. + if ($size > 0) { + $leadingDigitsPatternMatcher = new Matcher( + $numFormat->getLeadingDigitsPattern($size - 1), + $nationalNumber + ); + } + if ($size === 0 || $leadingDigitsPatternMatcher->lookingAt()) { + $m = new Matcher($numFormat->getPattern(), $nationalNumber); + if ($m->matches() > 0) { + return $numFormat; + } + } + } + return null; + } + + /** + * Note that carrierCode is optional - if null or an empty string, no carrier code replacement + * will take place. + * @param string $nationalNumber + * @param int $numberFormat PhoneNumberFormat + * @param null|string $carrierCode + * @return string + */ + public function formatNsnUsingPattern( + string $nationalNumber, + NumberFormat $formattingPattern, + int $numberFormat, + ?string $carrierCode = null + ): string { + $numberFormatRule = $formattingPattern->getFormat(); + $m = new Matcher($formattingPattern->getPattern(), $nationalNumber); + if ($numberFormat === PhoneNumberFormat::NATIONAL && + $carrierCode !== null && $carrierCode !== '' && + $formattingPattern->getDomesticCarrierCodeFormattingRule() !== '' + ) { + // Replace the $CC in the formatting rule with the desired carrier code. + $carrierCodeFormattingRule = $formattingPattern->getDomesticCarrierCodeFormattingRule(); + $carrierCodeFormattingRule = str_replace(static::CC_STRING, $carrierCode, $carrierCodeFormattingRule); + // Now replace the $FG in the formatting rule with the first group and the carrier code + // combined in the appropriate way. + $firstGroupMatcher = new Matcher(static::FIRST_GROUP_PATTERN, $numberFormatRule); + $numberFormatRule = $firstGroupMatcher->replaceFirst($carrierCodeFormattingRule); + $formattedNationalNumber = $m->replaceAll($numberFormatRule); + } else { + // Use the national prefix formatting rule instead. + $nationalPrefixFormattingRule = $formattingPattern->getNationalPrefixFormattingRule(); + if ($numberFormat === PhoneNumberFormat::NATIONAL && + $nationalPrefixFormattingRule !== '' + ) { + $firstGroupMatcher = new Matcher(static::FIRST_GROUP_PATTERN, $numberFormatRule); + $formattedNationalNumber = $m->replaceAll( + $firstGroupMatcher->replaceFirst($nationalPrefixFormattingRule) + ); + } else { + $formattedNationalNumber = $m->replaceAll($numberFormatRule); + } + } + if ($numberFormat === PhoneNumberFormat::RFC3966) { + // Strip any leading punctuation. + $matcher = new Matcher(static::SEPARATOR_PATTERN, $formattedNationalNumber); + if ($matcher->lookingAt()) { + $formattedNationalNumber = $matcher->replaceFirst(''); + } + // Replace the rest with a dash between each number group. + $formattedNationalNumber = $matcher->reset($formattedNationalNumber)->replaceAll('-'); + } + return $formattedNationalNumber; + } + + /** + * Appends the formatted extension of a phone number to formattedNumber, if the phone number had + * an extension specified. + * + * @param PhoneNumber $number + * @param PhoneMetadata|null $metadata + * @param int $numberFormat PhoneNumberFormat + * @param string $formattedNumber + */ + protected function maybeAppendFormattedExtension(PhoneNumber $number, ?PhoneMetadata $metadata, int $numberFormat, string &$formattedNumber): void + { + if ($number->hasExtension() && $number->getExtension() !== '') { + if ($numberFormat === PhoneNumberFormat::RFC3966) { + $formattedNumber .= static::RFC3966_EXTN_PREFIX . $number->getExtension(); + } elseif ($metadata !== null && $metadata->hasPreferredExtnPrefix()) { + $formattedNumber .= $metadata->getPreferredExtnPrefix() . $number->getExtension(); + } else { + $formattedNumber .= static::DEFAULT_EXTN_PREFIX . $number->getExtension(); + } + } + } + + /** + * Returns the mobile token for the provided country calling code if it has one, otherwise + * returns an empty string. A mobile token is a number inserted before the area code when dialing + * a mobile number from that country from abroad. + * + * @param int $countryCallingCode the country calling code for which we want the mobile token + * @return string the mobile token, as a string, for the given country calling code + */ + public static function getCountryMobileToken(int $countryCallingCode): string + { + return static::MOBILE_TOKEN_MAPPINGS[$countryCallingCode] ?? ''; + } + + /** + * Checks if the number is a valid vanity (alpha) number such as 800 MICROSOFT. A valid vanity + * number will start with at least 3 digits and will have three or more alpha characters. This + * does not do region-specific checks - to work out if this number is actually valid for a region, + * it should be parsed and methods such as {@link #isPossibleNumberWithReason} and + * {@link #isValidNumber} should be used. + * + * @param string $number the number that needs to be checked + * @return bool true if the number is a valid vanity number + */ + public function isAlphaNumber(string $number): bool + { + if (!static::isViablePhoneNumber($number)) { + // Number is too short, or doesn't match the basic phone number pattern. + return false; + } + $this->maybeStripExtension($number); + return preg_match('/' . static::VALID_ALPHA_PHONE_PATTERN . '/' . static::REGEX_FLAGS, $number) === 1; + } + + /** + * Checks to see if the string of characters could possibly be a phone number at all. At the + * moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation + * commonly found in phone numbers. + * This method does not require the number to be normalized in advance - but does assume that + * leading non-number symbols have been removed, such as by the method extractPossibleNumber. + * + * @param string $number to be checked for viability as a phone number + * @return boolean true if the number could be a phone number of some sort, otherwise false + */ + public static function isViablePhoneNumber(string $number): bool + { + if (!isset(static::$VALID_PHONE_NUMBER_PATTERN)) { + static::initValidPhoneNumberPatterns(); + } + + if (mb_strlen($number) < static::MIN_LENGTH_FOR_NSN) { + return false; + } + + $validPhoneNumberPattern = static::getValidPhoneNumberPattern(); + + $m = preg_match($validPhoneNumberPattern, $number); + return $m > 0; + } + + /** + * We append optionally the extension pattern to the end here, as a valid phone number may + * have an extension prefix appended, followed by 1 or more digits. + */ + protected static function getValidPhoneNumberPattern(): string + { + return static::$VALID_PHONE_NUMBER_PATTERN; + } + + /** + * Strips any extension (as in, the part of the number dialled after the call is connected, + * usually indicated with extn, ext, x or similar) from the end of the number, and returns it. + * + * @param string $number the non-normalized telephone number that we wish to strip the extension from + * @return string the phone extension + */ + protected function maybeStripExtension(string &$number): string + { + $matches = []; + $find = preg_match(static::$EXTN_PATTERN, $number, $matches, PREG_OFFSET_CAPTURE); + // If we find a potential extension, and the number preceding this is a viable number, we assume + // it is an extension. + if ($find > 0 && static::isViablePhoneNumber(substr($number, 0, $matches[0][1]))) { + // The numbers are captured into groups in the regular expression. + + for ($i = 1, $length = count($matches); $i <= $length; $i++) { + if ($matches[$i][0] !== '') { + // We go through the capturing groups until we find one that captured some digits. If none + // did, then we will return the empty string. + $extension = $matches[$i][0]; + $number = substr($number, 0, $matches[0][1]); + return $extension; + } + } + } + return ''; + } + + /** + * Parses a string and returns it in proto buffer format. This method differs from {@link #parse} + * in that it always populates the raw_input field of the protocol buffer with numberToParse as + * well as the country_code_source field. + * + * @param string $numberToParse number that we are attempting to parse. This can contain formatting + * such as +, ( and -, as well as a phone number extension. It can also + * be provided in RFC3966 format. + * @param string|null $defaultRegion region that we are expecting the number to be from. This is only used + * if the number being parsed is not written in international format. + * The country calling code for the number in this case would be stored + * as that of the default region supplied. + * @return PhoneNumber a phone number proto buffer filled with the parsed number + */ + public function parseAndKeepRawInput(string $numberToParse, ?string $defaultRegion, ?PhoneNumber $phoneNumber = null): PhoneNumber + { + if ($phoneNumber === null) { + $phoneNumber = new PhoneNumber(); + } + $this->parseHelper($numberToParse, $defaultRegion, true, true, $phoneNumber); + return $phoneNumber; + } + + /** + * A helper function to set the values related to leading zeros in a PhoneNumber. + * @param string $nationalNumber + */ + public static function setItalianLeadingZerosForPhoneNumber(string $nationalNumber, PhoneNumber $phoneNumber): void + { + if (strlen($nationalNumber) > 1 && str_starts_with($nationalNumber, '0')) { + $phoneNumber->setItalianLeadingZero(true); + $numberOfLeadingZeros = 1; + // Note that if the national number is all "0"s, the last "0" is not counted as a leading + // zero. + while ($numberOfLeadingZeros < (strlen($nationalNumber) - 1) && + substr($nationalNumber, $numberOfLeadingZeros, 1) === '0') { + $numberOfLeadingZeros++; + } + + if ($numberOfLeadingZeros !== 1) { + $phoneNumber->setNumberOfLeadingZeros($numberOfLeadingZeros); + } + } + } + + /** + * Parses a string and fills up the phoneNumber. This method is the same as the public + * parse() method, with the exception that it allows the default region to be null, for use by + * isNumberMatch(). checkRegion should be set to false if it is permitted for the default region + * to be null or unknown ("ZZ"). + * @throws NumberParseException + */ + protected function parseHelper(string $numberToParse, ?string $defaultRegion, bool $keepRawInput, bool $checkRegion, PhoneNumber $phoneNumber): void + { + $numberToParse = trim($numberToParse); + + if (mb_strlen($numberToParse) > static::MAX_INPUT_STRING_LENGTH) { + throw new NumberParseException( + NumberParseException::TOO_LONG, + 'The string supplied was too long to parse.' + ); + } + + $nationalNumber = ''; + $this->buildNationalNumberForParsing($numberToParse, $nationalNumber); + + if (!static::isViablePhoneNumber($nationalNumber)) { + throw new NumberParseException( + NumberParseException::NOT_A_NUMBER, + 'The string supplied did not seem to be a phone number.' + ); + } + + // Check the region supplied is valid, or that the extracted number starts with some sort of + + // sign so the number's region can be determined. + if ($checkRegion && !$this->checkRegionForParsing($nationalNumber, $defaultRegion)) { + throw new NumberParseException( + NumberParseException::INVALID_COUNTRY_CODE, + 'Missing or invalid default region.' + ); + } + + if ($keepRawInput) { + $phoneNumber->setRawInput($numberToParse); + } + // Attempt to parse extension first, since it doesn't require region-specific data and we want + // to have the non-normalised number here. + $extension = $this->maybeStripExtension($nationalNumber); + if ($extension !== '') { + $phoneNumber->setExtension($extension); + } + + $regionMetadata = $this->getMetadataForRegion($defaultRegion); + // Check to see if the number is given in international format so we know whether this number is + // from the default region or not. + $normalizedNationalNumber = ''; + try { + // TODO: This method should really just take in the string buffer that has already + // been created, and just remove the prefix, rather than taking in a string and then + // outputting a string buffer. + $countryCode = $this->maybeExtractCountryCode( + $nationalNumber, + $regionMetadata, + $normalizedNationalNumber, + $keepRawInput, + $phoneNumber + ); + } catch (NumberParseException $e) { + $matcher = new Matcher(static::PLUS_CHARS_PATTERN, $nationalNumber); + if ($e->getErrorType() === NumberParseException::INVALID_COUNTRY_CODE && $matcher->lookingAt()) { + // Strip the plus-char, and try again. + $countryCode = $this->maybeExtractCountryCode( + substr($nationalNumber, $matcher->end()), + $regionMetadata, + $normalizedNationalNumber, + $keepRawInput, + $phoneNumber + ); + if ($countryCode === 0) { + throw new NumberParseException( + NumberParseException::INVALID_COUNTRY_CODE, + 'Could not interpret numbers after plus-sign.' + ); + } + } else { + throw new NumberParseException($e->getErrorType(), $e->getMessage(), $e); + } + } + if ($countryCode !== 0) { + $phoneNumberRegion = $this->getRegionCodeForCountryCode($countryCode); + if ($phoneNumberRegion !== $defaultRegion) { + // Metadata cannot be null because the country calling code is valid. + $regionMetadata = $this->getMetadataForRegionOrCallingCode($countryCode, $phoneNumberRegion); + } + } else { + // If no extracted country calling code, use the region supplied instead. The national number + // is just the normalized version of the number we were given to parse. + + $normalizedNationalNumber .= static::normalize($nationalNumber); + if ($defaultRegion !== null) { + $countryCode = $regionMetadata->getCountryCode(); + $phoneNumber->setCountryCode($countryCode); + } elseif ($keepRawInput) { + $phoneNumber->clearCountryCodeSource(); + } + } + if (mb_strlen($normalizedNationalNumber) < static::MIN_LENGTH_FOR_NSN) { + throw new NumberParseException( + NumberParseException::TOO_SHORT_NSN, + 'The string supplied is too short to be a phone number.' + ); + } + if ($regionMetadata !== null) { + $carrierCode = ''; + $potentialNationalNumber = $normalizedNationalNumber; + $this->maybeStripNationalPrefixAndCarrierCode($potentialNationalNumber, $regionMetadata, $carrierCode); + // We require that the NSN remaining after stripping the national prefix and carrier code be + // long enough to be a possible length for the region. Otherwise, we don't do the stripping, + // since the original number could be a valid short number. + $validationResult = $this->testNumberLength($potentialNationalNumber, $regionMetadata); + if ($validationResult !== ValidationResult::TOO_SHORT + && $validationResult !== ValidationResult::IS_POSSIBLE_LOCAL_ONLY + && $validationResult !== ValidationResult::INVALID_LENGTH) { + $normalizedNationalNumber = $potentialNationalNumber; + if ($keepRawInput && $carrierCode !== '') { + $phoneNumber->setPreferredDomesticCarrierCode($carrierCode); + } + } + } + $lengthOfNationalNumber = mb_strlen($normalizedNationalNumber); + if ($lengthOfNationalNumber < static::MIN_LENGTH_FOR_NSN) { + throw new NumberParseException( + NumberParseException::TOO_SHORT_NSN, + 'The string supplied is too short to be a phone number.' + ); + } + if ($lengthOfNationalNumber > static::MAX_LENGTH_FOR_NSN) { + throw new NumberParseException( + NumberParseException::TOO_LONG, + 'The string supplied is too long to be a phone number.' + ); + } + static::setItalianLeadingZerosForPhoneNumber($normalizedNationalNumber, $phoneNumber); + + /* + * We have to store the National Number as a string instead of a "long" as Google do + * + * Since PHP doesn't always support 64 bit INTs, this was a float, but that had issues + * with long numbers. + * + * We have to remove the leading zeroes ourself though + */ + if ((int)$normalizedNationalNumber === 0) { + $normalizedNationalNumber = '0'; + } else { + $normalizedNationalNumber = ltrim($normalizedNationalNumber, '0'); + } + + $phoneNumber->setNationalNumber($normalizedNationalNumber); + } + + /** + * Extracts the value of the phone-context parameter of numberToExtractFrom where the index of + * ";phone-context=" is the parameter indexOfPhoneContext, following the syntax defined in + * RFC3966. + * @return string|null the extracted string (possibly empty), or null if no phone-context parameter is found. + */ + protected function extractPhoneContext(string $numberToExtractFrom, int|false $indexOfPhoneContext): ?string + { + // If no phone-context parameter is present + if ($indexOfPhoneContext === false) { + return null; + } + + $phoneContextStart = $indexOfPhoneContext + strlen(static::RFC3966_PHONE_CONTEXT); + // If phone-context parameter is empty + if ($phoneContextStart >= mb_strlen($numberToExtractFrom)) { + return ''; + } + + $phoneContextEnd = strpos($numberToExtractFrom, ';', $phoneContextStart); + // If phone-context is not the last parameter + if ($phoneContextEnd !== false) { + return substr($numberToExtractFrom, $phoneContextStart, $phoneContextEnd - $phoneContextStart); + } + + return substr($numberToExtractFrom, $phoneContextStart); + } + + /** + * Returns whether the value of phoneContext follows the syntax defined in RFC3966. + */ + protected function isPhoneContextValid(?string $phoneContext): bool + { + if ($phoneContext === null) { + return true; + } + + if ($phoneContext === '') { + return false; + } + + $numberDigitsPattern = '/' . static::$RFC3966_GLOBAL_NUMBER_DIGITS . '/' . static::REGEX_FLAGS; + $domainNamePattern = '/' . static::$RFC3966_DOMAINNAME . '/' . static::REGEX_FLAGS; + + // Does phone-context value match pattern of global-number-digits or domainname + return preg_match($numberDigitsPattern, $phoneContext) || preg_match($domainNamePattern, $phoneContext); + } + + /** + * Returns a new phone number containing only the fields needed to uniquely identify a phone + * number, rather than any fields that capture the context in which the phone number was created. + * These fields correspond to those set in parse() rather than parseAndKeepRawInput() + * + * @return PhoneNumber + */ + protected static function copyCoreFieldsOnly(PhoneNumber $phoneNumberIn): PhoneNumber + { + $phoneNumber = new PhoneNumber(); + $phoneNumber->setCountryCode($phoneNumberIn->getCountryCode()); + $phoneNumber->setNationalNumber($phoneNumberIn->getNationalNumber()); + if ($phoneNumberIn->hasExtension() && $phoneNumberIn->getExtension() !== '') { + $phoneNumber->setExtension($phoneNumberIn->getExtension()); + } + if ($phoneNumberIn->isItalianLeadingZero()) { + $phoneNumber->setItalianLeadingZero(true); + // This field is only relevant if there are leading zeros at all. + $phoneNumber->setNumberOfLeadingZeros($phoneNumberIn->getNumberOfLeadingZeros()); + } + return $phoneNumber; + } + + /** + * Converts numberToParse to a form that we can parse and write it to nationalNumber if it is + * written in RFC3966; otherwise extract a possible number out of it and write to nationalNumber. + * @param string $numberToParse + * @param string $nationalNumber + * @throws NumberParseException + */ + protected function buildNationalNumberForParsing(string $numberToParse, string &$nationalNumber): void + { + $indexOfPhoneContext = strpos($numberToParse, static::RFC3966_PHONE_CONTEXT); + $phoneContext = $this->extractPhoneContext($numberToParse, $indexOfPhoneContext); + + if (!$this->isPhoneContextValid($phoneContext)) { + throw new NumberParseException(NumberParseException::NOT_A_NUMBER, 'The phone-context valid is invalid.'); + } + + if ($phoneContext !== null) { + // If the phone context contains a phone number prefix, we need to capture it, whereas domains + // will be ignored. + if (str_starts_with($phoneContext, self::PLUS_SIGN)) { + // Additional parameters might follow the phone context. If so, we will remove them here + // because the parameters after phone context are not important for parsing the phone + // number. + $nationalNumber .= $phoneContext; + } + + // Now append everything between the "tel:" prefix and the phone-context. This should include + // the national number, an optional extension or isdn-subaddress component. Note we also + // handle the case when "tel:" is missing, as we have seen in some of the phone number inputs. + // In that case, we append everything from the beginning. + + $indexOfRfc3966Prefix = strpos($numberToParse, static::RFC3966_PREFIX); + $indexOfNationalNumber = ($indexOfRfc3966Prefix !== false) ? $indexOfRfc3966Prefix + strlen(static::RFC3966_PREFIX) : 0; + $nationalNumber .= substr( + $numberToParse, + $indexOfNationalNumber, + $indexOfPhoneContext - $indexOfNationalNumber + ); + } else { + // Extract a possible number from the string passed in (this strips leading characters that + // could not be the start of a phone number.) + $nationalNumber .= static::extractPossibleNumber($numberToParse); + } + + // Delete the isdn-subaddress and everything after it if it is present. Note extension won't + // appear at the same time with isdn-subaddress according to paragraph 5.3 of the RFC3966 spec, + $indexOfIsdn = strpos($nationalNumber, static::RFC3966_ISDN_SUBADDRESS); + if ($indexOfIsdn > 0) { + $nationalNumber = substr($nationalNumber, 0, $indexOfIsdn); + } + // If both phone context and isdn-subaddress are absent but other parameters are present, the + // parameters are left in nationalNumber. This is because we are concerned about deleting + // content from a potential number string when there is no strong evidence that the number is + // actually written in RFC3966. + } + + /** + * Attempts to extract a possible number from the string passed in. This currently strips all + * leading characters that cannot be used to start a phone number. Characters that can be used to + * start a phone number are defined in the VALID_START_CHAR_PATTERN. If none of these characters + * are found in the number passed in, an empty string is returned. This function also attempts to + * strip off any alternative extensions or endings if two or more are present, such as in the case + * of: (530) 583-6985 x302/x2303. The second extension here makes this actually two phone numbers, + * (530) 583-6985 x302 and (530) 583-6985 x2303. We remove the second extension so that the first + * number is parsed correctly. + * + * @param string $number the string that might contain a phone number + * @return string the number, stripped of any non-phone-number prefix (such as "Tel:") or an empty + * string if no character used to start phone numbers (such as + or any digit) is + * found in the number + */ + public static function extractPossibleNumber(string $number): string + { + $matches = []; + $match = preg_match('/' . static::VALID_START_CHAR_PATTERN . '/ui', $number, $matches, PREG_OFFSET_CAPTURE); + if ($match > 0) { + $number = substr($number, $matches[0][1]); + // Remove trailing non-alpha non-numerical characters. + $trailingCharsMatcher = new Matcher(static::UNWANTED_END_CHAR_PATTERN, $number); + if ($trailingCharsMatcher->find() && $trailingCharsMatcher->start() > 0) { + $number = substr($number, 0, $trailingCharsMatcher->start()); + } + + // Check for extra numbers at the end. + $match = preg_match('%' . static::SECOND_NUMBER_START_PATTERN . '%', $number, $matches, PREG_OFFSET_CAPTURE); + if ($match > 0) { + $number = substr($number, 0, $matches[0][1]); + } + + return $number; + } + + return ''; + } + + /** + * Checks to see that the region code used is valid, or if it is not valid, that the number to + * parse starts with a + symbol so that we can attempt to infer the region from the number. + * Returns false if it cannot use the region provided and the region cannot be inferred. + */ + protected function checkRegionForParsing(?string $numberToParse, ?string $defaultRegion): bool + { + if (!$this->isValidRegionCode($defaultRegion)) { + // If the number is null or empty, we can't infer the region. + $plusCharsPatternMatcher = new Matcher(static::PLUS_CHARS_PATTERN, $numberToParse); + if ($numberToParse === null || $numberToParse === '' || !$plusCharsPatternMatcher->lookingAt()) { + return false; + } + } + return true; + } + + /** + * Tries to extract a country calling code from a number. This method will return zero if no + * country calling code is considered to be present. Country calling codes are extracted in the + * following ways: + *
    + *
  • by stripping the international dialing prefix of the region the person is dialing from, + * if this is present in the number, and looking at the next digits + *
  • by stripping the '+' sign if present and then looking at the next digits + *
  • by comparing the start of the number and the country calling code of the default region. + * If the number is not considered possible for the numbering plan of the default region + * initially, but starts with the country calling code of this region, validation will be + * reattempted after stripping this country calling code. If this number is considered a + * possible number, then the first digits will be considered the country calling code and + * removed as such. + *
+ * It will throw a NumberParseException if the number starts with a '+' but the country calling + * code supplied after this does not match that of any known region. + * + * @param string $number non-normalized telephone number that we wish to extract a country calling + * code from - may begin with '+' + * @param PhoneMetadata|null $defaultRegionMetadata metadata about the region this number may be from + * @param string $nationalNumber a string buffer to store the national significant number in, in the case + * that a country calling code was extracted. The number is appended to any existing contents. + * If no country calling code was extracted, this will be left unchanged. + * @param bool $keepRawInput true if the country_code_source and preferred_carrier_code fields of + * phoneNumber should be populated. + * @param PhoneNumber $phoneNumber the PhoneNumber object where the country_code and country_code_source need + * to be populated. Note the country_code is always populated, whereas country_code_source is + * only populated when keepCountryCodeSource is true. + * @return int the country calling code extracted or 0 if none could be extracted + * @throws NumberParseException + */ + public function maybeExtractCountryCode( + string $number, + ?PhoneMetadata $defaultRegionMetadata, + string &$nationalNumber, + bool $keepRawInput, + PhoneNumber $phoneNumber + ): int { + if ($number === '') { + return 0; + } + $fullNumber = $number; + // Set the default prefix to be something that will never match. + $possibleCountryIddPrefix = 'NonMatch'; + if ($defaultRegionMetadata !== null) { + $possibleCountryIddPrefix = $defaultRegionMetadata->getInternationalPrefix(); + } + $countryCodeSource = $this->maybeStripInternationalPrefixAndNormalize($fullNumber, $possibleCountryIddPrefix); + + if ($keepRawInput) { + $phoneNumber->setCountryCodeSource($countryCodeSource); + } + if ($countryCodeSource !== CountryCodeSource::FROM_DEFAULT_COUNTRY) { + if (mb_strlen($fullNumber) <= static::MIN_LENGTH_FOR_NSN) { + throw new NumberParseException( + NumberParseException::TOO_SHORT_AFTER_IDD, + 'Phone number had an IDD, but after this was not long enough to be a viable phone number.' + ); + } + $potentialCountryCode = $this->extractCountryCode($fullNumber, $nationalNumber); + + if ($potentialCountryCode !== 0) { + $phoneNumber->setCountryCode($potentialCountryCode); + return $potentialCountryCode; + } + + // If this fails, they must be using a strange country calling code that we don't recognize, + // or that doesn't exist. + throw new NumberParseException( + NumberParseException::INVALID_COUNTRY_CODE, + 'Country calling code supplied was not recognised.' + ); + } + + if ($defaultRegionMetadata !== null) { + // Check to see if the number starts with the country calling code for the default region. If + // so, we remove the country calling code, and do some checks on the validity of the number + // before and after. + $defaultCountryCode = $defaultRegionMetadata->getCountryCode(); + $defaultCountryCodeString = (string)$defaultCountryCode; + $normalizedNumber = $fullNumber; + if (str_starts_with($normalizedNumber, $defaultCountryCodeString)) { + $potentialNationalNumber = substr($normalizedNumber, mb_strlen($defaultCountryCodeString)); + $generalDesc = $defaultRegionMetadata->getGeneralDesc(); + // Don't need the carrier code. + $carrierCode = null; + $this->maybeStripNationalPrefixAndCarrierCode( + $potentialNationalNumber, + $defaultRegionMetadata, + $carrierCode + ); + // If the number was not valid before but is valid now, or if it was too long before, we + // consider the number with the country calling code stripped to be a better result and + // keep that instead. + if ((!$this->matcherAPI->matchNationalNumber($fullNumber, $generalDesc, false) + && $this->matcherAPI->matchNationalNumber($potentialNationalNumber, $generalDesc, false)) + || $this->testNumberLength($fullNumber, $defaultRegionMetadata) === ValidationResult::TOO_LONG + ) { + $nationalNumber .= $potentialNationalNumber; + if ($keepRawInput) { + $phoneNumber->setCountryCodeSource(CountryCodeSource::FROM_NUMBER_WITHOUT_PLUS_SIGN); + } + $phoneNumber->setCountryCode($defaultCountryCode); + return $defaultCountryCode; + } + } + } + // No country calling code present. + $phoneNumber->setCountryCode(0); + return 0; + } + + /** + * Strips any international prefix (such as +, 00, 011) present in the number provided, normalizes + * the resulting number, and indicates if an international prefix was present. + * + * @param string $number the non-normalized telephone number that we wish to strip any international + * dialing prefix from. + * @param string $possibleIddPrefix string the international direct dialing prefix from the region we + * think this number may be dialed in + * @return int the corresponding CountryCodeSource if an international dialing prefix could be + * removed from the number, otherwise CountryCodeSource.FROM_DEFAULT_COUNTRY if the number did + * not seem to be in international format. + */ + public function maybeStripInternationalPrefixAndNormalize(string &$number, string $possibleIddPrefix): int + { + if ($number === '') { + return CountryCodeSource::FROM_DEFAULT_COUNTRY; + } + $matches = []; + // Check to see if the number begins with one or more plus signs. + $match = preg_match('/^' . static::PLUS_CHARS_PATTERN . '/' . static::REGEX_FLAGS, $number, $matches, PREG_OFFSET_CAPTURE); + if ($match > 0) { + $number = mb_substr($number, $matches[0][1] + mb_strlen($matches[0][0])); + // Can now normalize the rest of the number since we've consumed the "+" sign at the start. + $number = static::normalize($number); + return CountryCodeSource::FROM_NUMBER_WITH_PLUS_SIGN; + } + // Attempt to parse the first digits as an international prefix. + $iddPattern = $possibleIddPrefix; + $number = static::normalize($number); + return $this->parsePrefixAsIdd($iddPattern, $number) + ? CountryCodeSource::FROM_NUMBER_WITH_IDD + : CountryCodeSource::FROM_DEFAULT_COUNTRY; + } + + /** + * Normalizes a string of characters representing a phone number. This performs + * the following conversions: + * Punctuation is stripped. + * For ALPHA/VANITY numbers: + * Letters are converted to their numeric representation on a telephone + * keypad. The keypad used here is the one defined in ITU Recommendation + * E.161. This is only done if there are 3 or more letters in the number, + * to lessen the risk that such letters are typos. + * For other numbers: + * - Wide-ascii digits are converted to normal ASCII (European) digits. + * - Arabic-Indic numerals are converted to European numerals. + * - Spurious alpha characters are stripped. + * + * @param string $number a string of characters representing a phone number. + * @return string the normalized string version of the phone number. + */ + public static function normalize(string $number): string + { + $m = new Matcher(static::VALID_ALPHA_PHONE_PATTERN, $number); + if ($m->matches()) { + return static::normalizeHelper($number, static::ALPHA_PHONE_MAPPINGS, true); + } + + return static::normalizeDigitsOnly($number); + } + + /** + * Normalizes a string of characters representing a phone number. This converts wide-ascii and + * arabic-indic numerals to European numerals, and strips punctuation and alpha characters. + * + * @param string $number a string of characters representing a phone number + * @return string the normalized string version of the phone number + */ + public static function normalizeDigitsOnly(string $number): string + { + return static::normalizeDigits($number, false /* strip non-digits */); + } + + /** + * @param string $number + * @param bool $keepNonDigits + * @return string + */ + public static function normalizeDigits(string $number, bool $keepNonDigits): string + { + $normalizedDigits = ''; + $numberAsArray = preg_split('/(?lookingAt()) { + $matchEnd = $m->end(); + // Only strip this if the first digit after the match is not a 0, since country calling codes + // cannot begin with 0. + $digitMatcher = new Matcher(static::CAPTURING_DIGIT_PATTERN, substr($number, $matchEnd)); + if ($digitMatcher->find()) { + $normalizedGroup = static::normalizeDigitsOnly($digitMatcher->group(1)); + if ($normalizedGroup === '0') { + return false; + } + } + $number = substr($number, $matchEnd); + return true; + } + return false; + } + + /** + * Extracts country calling code from fullNumber, returns it and places the remaining number in nationalNumber. + * It assumes that the leading plus sign or IDD has already been removed. + * Returns 0 if fullNumber doesn't start with a valid country calling code, and leaves nationalNumber unmodified. + * @param string $fullNumber + * @param string $nationalNumber + * @return int + * @internal + */ + protected function extractCountryCode(string $fullNumber, string &$nationalNumber): int + { + if (($fullNumber === '') || ($fullNumber[0] === '0')) { + // Country codes do not begin with a '0'. + return 0; + } + $numberLength = strlen($fullNumber); + for ($i = 1; $i <= static::MAX_LENGTH_COUNTRY_CODE && $i <= $numberLength; $i++) { + $potentialCountryCode = (int)substr($fullNumber, 0, $i); + if (isset($this->countryCallingCodeToRegionCodeMap[$potentialCountryCode])) { + $nationalNumber .= substr($fullNumber, $i); + return $potentialCountryCode; + } + } + return 0; + } + + /** + * Strips any national prefix (such as 0, 1) present in the number provided. + * + * @param string $number the normalized telephone number that we wish to strip any national + * dialing prefix from + * @param PhoneMetadata $metadata the metadata for the region that we think this number is from + * @param string|null $carrierCode a place to insert the carrier code if one is extracted + * @return bool true if a national prefix or carrier code (or both) could be extracted. + */ + public function maybeStripNationalPrefixAndCarrierCode(string &$number, PhoneMetadata $metadata, ?string &$carrierCode): bool + { + $possibleNationalPrefix = $metadata->getNationalPrefixForParsing(); + if ($number === '' || $possibleNationalPrefix === null || $possibleNationalPrefix === '') { + // Early return for numbers of zero length. + return false; + } + + // Attempt to parse the first digits as a national prefix. + $prefixMatcher = new Matcher($possibleNationalPrefix, $number); + if ($prefixMatcher->lookingAt()) { + $generalDesc = $metadata->getGeneralDesc(); + // Check if the original number is viable. + $isViableOriginalNumber = $this->matcherAPI->matchNationalNumber($number, $generalDesc, false); + // $prefixMatcher->group($numOfGroups) === null implies nothing was captured by the capturing + // groups in $possibleNationalPrefix; therefore, no transformation is necessary, and we just + // remove the national prefix + $numOfGroups = $prefixMatcher->groupCount(); + $transformRule = $metadata->getNationalPrefixTransformRule(); + if ($transformRule === null + || $transformRule === '' + || $prefixMatcher->group($numOfGroups - 1) === null + ) { + // If the original number was viable, and the resultant number is not, we return. + if ($isViableOriginalNumber && + !$this->matcherAPI->matchNationalNumber( + substr($number, $prefixMatcher->end()), + $generalDesc, + false + )) { + return false; + } + if ($carrierCode !== null && $numOfGroups > 0 && $prefixMatcher->group($numOfGroups) !== null) { + $carrierCode .= $prefixMatcher->group(1); + } + + $number = substr($number, $prefixMatcher->end()); + return true; + } + + // Check that the resultant number is still viable. If not, return. Check this by copying + // the string and making the transformation on the copy first. + $transformedNumber = $number; + $numberLength = mb_strlen($number); + $transformedNumber = substr_replace( + $transformedNumber, + $prefixMatcher->replaceFirst($transformRule), + 0, + $numberLength + ); + if ($isViableOriginalNumber + && !$this->matcherAPI->matchNationalNumber($transformedNumber, $generalDesc, false)) { + return false; + } + if ($carrierCode !== null && $numOfGroups > 1) { + $carrierCode .= $prefixMatcher->group(1); + } + $number = substr_replace($number, $transformedNumber, 0, mb_strlen($number)); + return true; + } + return false; + } + + /** + * Convenience wrapper around isPossibleNumberForTypeWithReason. Instead of returning the reason + * for failure, this method returns true if the number is either a possible fully-qualified + * number (containing the area code and country code), or if the number could be a possible local + * number (with a country code, but missing an area code). Local numbers are considered possible + * if they could be possibly dialled in this format: if the area code is needed for a call to + * connect, the number is not considered possible without it. + * + * @param PhoneNumber $number The number that needs to be checked + * @param int $type PhoneNumberType The type we are interested in + * @return bool true if the number is possible for this particular type + */ + public function isPossibleNumberForType(PhoneNumber $number, int $type): bool + { + $result = $this->isPossibleNumberForTypeWithReason($number, $type); + return $result === ValidationResult::IS_POSSIBLE + || $result === ValidationResult::IS_POSSIBLE_LOCAL_ONLY; + } + + /** + * Helper method to check a number against possible lengths for this number type, and determine + * whether it matches, or is too short or too long. + * + * @param string $number + * @param int $type PhoneNumberType + * @return int ValidationResult + */ + protected function testNumberLength(string $number, PhoneMetadata $metadata, int $type = PhoneNumberType::UNKNOWN): int + { + $descForType = $this->getNumberDescByType($metadata, $type); + // There should always be "possibleLengths" set for every element. This is declared in the XML + // schema which is verified by PhoneNumberMetadataSchemaTest. + // For size efficiency, where a sub-description (e.g. fixed-line) has the same possibleLengths + // as the parent, this is missing, so we fall back to the general desc (where no numbers of the + // type exist at all, there is one possible length (-1) which is guaranteed not to match the + // length of any real phone number). + $possibleLengths = (count($descForType->getPossibleLength()) === 0) + ? $metadata->getGeneralDesc()->getPossibleLength() : $descForType->getPossibleLength(); + + $localLengths = $descForType->getPossibleLengthLocalOnly(); + + if ($type === PhoneNumberType::FIXED_LINE_OR_MOBILE) { + if (!static::descHasPossibleNumberData($this->getNumberDescByType($metadata, PhoneNumberType::FIXED_LINE))) { + // The rate case has been encountered where no fixedLine data is available (true for some + // non-geographical entities), so we just check mobile. + return $this->testNumberLength($number, $metadata, PhoneNumberType::MOBILE); + } + + $mobileDesc = $this->getNumberDescByType($metadata, PhoneNumberType::MOBILE); + if (static::descHasPossibleNumberData($mobileDesc)) { + // Note that when adding the possible lengths from mobile, we have to again check they + // aren't empty since if they are this indicates they are the same as the general desc and + // should be obtained from there. + $possibleLengths = array_merge( + $possibleLengths, + (count($mobileDesc->getPossibleLength()) === 0) + ? $metadata->getGeneralDesc()->getPossibleLength() : $mobileDesc->getPossibleLength() + ); + + // The current list is sorted; we need to merge in the new list and re-sort (duplicates + // are okay). Sorting isn't so expensive because the lists are very small. + sort($possibleLengths); + + if (count($localLengths) === 0) { + $localLengths = $mobileDesc->getPossibleLengthLocalOnly(); + } else { + $localLengths = array_merge($localLengths, $mobileDesc->getPossibleLengthLocalOnly()); + sort($localLengths); + } + } + } + + + // If the type is not supported at all (indicated by the possible lengths containing -1 at this + // point) we return invalid length. + + if ($possibleLengths[0] === -1) { + return ValidationResult::INVALID_LENGTH; + } + + $actualLength = mb_strlen($number); + + // This is safe because there is never an overlap between the possible lengths and the local-only + // lengths; this is checked at build time. + + if (in_array($actualLength, $localLengths)) { + return ValidationResult::IS_POSSIBLE_LOCAL_ONLY; + } + + $minimumLength = reset($possibleLengths); + if ($minimumLength === $actualLength) { + return ValidationResult::IS_POSSIBLE; + } + + if ($minimumLength > $actualLength) { + return ValidationResult::TOO_SHORT; + } + + if (isset($possibleLengths[count($possibleLengths) - 1]) && $possibleLengths[count($possibleLengths) - 1] < $actualLength) { + return ValidationResult::TOO_LONG; + } + + // We skip the first element; we've already checked it. + array_shift($possibleLengths); + return in_array($actualLength, $possibleLengths) ? ValidationResult::IS_POSSIBLE : ValidationResult::INVALID_LENGTH; + } + + /** + * Returns a list with the region codes that match the specific country calling code. For + * non-geographical country calling codes, the region code 001 is returned. Also, in the case + * of no region code being found, an empty list is returned. + * @param int $countryCallingCode + * @return string[] + */ + public function getRegionCodesForCountryCode(int $countryCallingCode): array + { + $regionCodes = $this->countryCallingCodeToRegionCodeMap[$countryCallingCode] ?? null; + return $regionCodes ?? []; + } + + /** + * Returns the country calling code for a specific region. For example, this would be 1 for the + * United States, and 64 for New Zealand. Assumes the region is already valid. + * + * @param string|null $regionCode the region that we want to get the country calling code for + * @return int the country calling code for the region denoted by regionCode + */ + public function getCountryCodeForRegion(?string $regionCode): int + { + if (!$this->isValidRegionCode($regionCode)) { + return 0; + } + return $this->getCountryCodeForValidRegion($regionCode); + } + + /** + * Returns the country calling code for a specific region. For example, this would be 1 for the + * United States, and 64 for New Zealand. Assumes the region is already valid. + * + * @param string $regionCode the region that we want to get the country calling code for + * @return int the country calling code for the region denoted by regionCode + * @throws \InvalidArgumentException if the region is invalid + */ + protected function getCountryCodeForValidRegion(string $regionCode): int + { + $metadata = $this->getMetadataForRegion($regionCode); + if ($metadata === null) { + throw new \InvalidArgumentException('Invalid region code: ' . $regionCode); + } + return $metadata->getCountryCode(); + } + + /** + * Returns a number formatted in such a way that it can be dialed from a mobile phone in a + * specific region. If the number cannot be reached from the region (e.g. some countries block + * toll-free numbers from being called outside of the country), the method returns an empty + * string. + * + * @param PhoneNumber $number the phone number to be formatted + * @param string $regionCallingFrom the region where the call is being placed + * @param boolean $withFormatting whether the number should be returned with formatting symbols, such as + * spaces and dashes. + * @return string the formatted phone number + */ + public function formatNumberForMobileDialing(PhoneNumber $number, string $regionCallingFrom, bool $withFormatting): string + { + $countryCallingCode = $number->getCountryCode(); + if (!$this->hasValidCountryCallingCode($countryCallingCode)) { + return $number->hasRawInput() ? $number->getRawInput() : ''; + } + + $formattedNumber = ''; + // Clear the extension, as that part cannot normally be dialed together with the main number. + $numberNoExt = new PhoneNumber(); + $numberNoExt->mergeFrom($number)->clearExtension(); + $regionCode = $this->getRegionCodeForCountryCode($countryCallingCode); + $numberType = $this->getNumberType($numberNoExt); + $isValidNumber = ($numberType !== PhoneNumberType::UNKNOWN); + if (strtoupper($regionCallingFrom) === $regionCode) { + $isFixedLineOrMobile = ($numberType === PhoneNumberType::FIXED_LINE || $numberType === PhoneNumberType::MOBILE || $numberType === PhoneNumberType::FIXED_LINE_OR_MOBILE); + // Carrier codes may be needed in some countries. We handle this here. + if ($regionCode === 'BR' && $isFixedLineOrMobile) { + // Historically, we set this to an empty string when parsing with raw input if none was + // found in the input string. However, this doesn't result in a number we can dial. For this + // reason, we treat the empty string the same as if it isn't set at all. + $formattedNumber = $numberNoExt->getPreferredDomesticCarrierCode() !== '' + ? $this->formatNationalNumberWithPreferredCarrierCode($numberNoExt, '') + // Brazilian fixed line and mobile numbers need to be dialed with a carrier code when + // called within Brazil. Without that, most of the carriers won't connect the call. + // Because of that, we return an empty string here. + : ''; + } elseif ($countryCallingCode === static::NANPA_COUNTRY_CODE) { + // For NANPA countries, we output international format for numbers that can be dialed + // internationally, since that always works, except for numbers which might potentially be + // short numbers, which are always dialled in national format. + $regionMetadata = $this->getMetadataForRegion($regionCallingFrom); + if ($this->canBeInternationallyDialled($numberNoExt) + && $this->testNumberLength($this->getNationalSignificantNumber($numberNoExt), $regionMetadata) + !== ValidationResult::TOO_SHORT + ) { + $formattedNumber = $this->format($numberNoExt, PhoneNumberFormat::INTERNATIONAL); + } else { + $formattedNumber = $this->format($numberNoExt, PhoneNumberFormat::NATIONAL); + } + } elseif (( + $regionCode === static::REGION_CODE_FOR_NON_GEO_ENTITY || + // MX fixed line and mobile numbers should always be formatted in international format, + // even when dialed within MX. For national format to work, a carrier code needs to be + // used, and the correct carrier code depends on if the caller and callee are from the + // same local area. It is trickier to get that to work correctly than using + // international format, which is tested to work fine on all carriers. + // CL fixed line numbers need the national prefix when dialing in the national format, + // but don't have it when used for display. The reverse is true for mobile numbers. + // As a result, we output them in the international format to make it work. + ( + ($regionCode === 'MX' || $regionCode === 'CL' || $regionCode === 'UZ') + && $isFixedLineOrMobile + ) + ) && $this->canBeInternationallyDialled($numberNoExt) + ) { + $formattedNumber = $this->format($numberNoExt, PhoneNumberFormat::INTERNATIONAL); + } else { + $formattedNumber = $this->format($numberNoExt, PhoneNumberFormat::NATIONAL); + } + } elseif ($isValidNumber && $this->canBeInternationallyDialled($numberNoExt)) { + // We assume that short numbers are not diallable from outside their region, so if a number + // is not a valid regular length phone number, we treat it as if it cannot be internationally + // dialled. + return $withFormatting ? + $this->format($numberNoExt, PhoneNumberFormat::INTERNATIONAL) : + $this->format($numberNoExt, PhoneNumberFormat::E164); + } + return $withFormatting ? $formattedNumber : static::normalizeDiallableCharsOnly($formattedNumber); + } + + /** + * Formats a phone number in national format for dialing using the carrier as specified in the + * {@code carrierCode}. The {@code carrierCode} will always be used regardless of whether the + * phone number already has a preferred domestic carrier code stored. If {@code carrierCode} + * contains an empty string, returns the number in national format without any carrier code. + * + * @param PhoneNumber $number the phone number to be formatted + * @param string $carrierCode the carrier selection code to be used + * @return string the formatted phone number in national format for dialing using the carrier as + * specified in the {@code carrierCode} + */ + public function formatNationalNumberWithCarrierCode(PhoneNumber $number, string $carrierCode): string + { + $countryCallingCode = $number->getCountryCode(); + $nationalSignificantNumber = $this->getNationalSignificantNumber($number); + if (!$this->hasValidCountryCallingCode($countryCallingCode)) { + return $nationalSignificantNumber; + } + + // Note getRegionCodeForCountryCode() is used because formatting information for regions which + // share a country calling code is contained by only one region for performance reasons. For + // example, for NANPA regions it will be contained in the metadata for US. + $regionCode = $this->getRegionCodeForCountryCode($countryCallingCode); + // Metadata cannot be null because the country calling code is valid. + $metadata = $this->getMetadataForRegionOrCallingCode($countryCallingCode, $regionCode); + + $formattedNumber = $this->formatNsn( + $nationalSignificantNumber, + $metadata, + PhoneNumberFormat::NATIONAL, + $carrierCode + ); + $this->maybeAppendFormattedExtension($number, $metadata, PhoneNumberFormat::NATIONAL, $formattedNumber); + $this->prefixNumberWithCountryCallingCode( + $countryCallingCode, + PhoneNumberFormat::NATIONAL, + $formattedNumber + ); + return $formattedNumber; + } + + /** + * Formats a phone number in national format for dialing using the carrier as specified in the + * preferredDomesticCarrierCode field of the PhoneNumber object passed in. If that is missing, + * use the {@code fallbackCarrierCode} passed in instead. If there is no + * {@code preferredDomesticCarrierCode}, and the {@code fallbackCarrierCode} contains an empty + * string, return the number in national format without any carrier code. + * + *

Use {@link #formatNationalNumberWithCarrierCode} instead if the carrier code passed in + * should take precedence over the number's {@code preferredDomesticCarrierCode} when formatting. + * + * @param PhoneNumber $number the phone number to be formatted + * @param string $fallbackCarrierCode the carrier selection code to be used, if none is found in the + * phone number itself + * @return string the formatted phone number in national format for dialing using the number's + * {@code preferredDomesticCarrierCode}, or the {@code fallbackCarrierCode} passed in if + * none is found + */ + public function formatNationalNumberWithPreferredCarrierCode(PhoneNumber $number, string $fallbackCarrierCode): string + { + return $this->formatNationalNumberWithCarrierCode( + $number, + // Historically, we set this to an empty string when parsing with raw input if none was + // found in the input string. However, this doesn't result in a number we can dial. For this + // reason, we treat the empty string the same as if it isn't set at all. + $number->hasPreferredDomesticCarrierCode() && $number->getPreferredDomesticCarrierCode() !== '' + ? $number->getPreferredDomesticCarrierCode() + : $fallbackCarrierCode + ); + } + + /** + * Returns true if the number can be dialled from outside the region, or unknown. If the number + * can only be dialled from within the region, returns false. Does not check the number is a valid + * number. Note that, at the moment, this method does not handle short numbers (which are + * currently all presumed to not be diallable from outside their country). + * + * @param PhoneNumber $number the phone-number for which we want to know whether it is diallable from outside the region + * @return bool + */ + public function canBeInternationallyDialled(PhoneNumber $number): bool + { + $metadata = $this->getMetadataForRegion($this->getRegionCodeForNumber($number)); + if ($metadata === null) { + // Note numbers belonging to non-geographical entities (e.g. +800 numbers) are always + // internationally diallable, and will be caught here. + return true; + } + $nationalSignificantNumber = $this->getNationalSignificantNumber($number); + return !$this->isNumberMatchingDesc($nationalSignificantNumber, $metadata->getNoInternationalDialling()); + } + + /** + * Normalizes a string of characters representing a phone number. This strips all characters which + * are not diallable on a mobile phone keypad (including all non-ASCII digits). + * + * @param string $number a string of characters representing a phone number + * @return string the normalized string version of the phone number + */ + public static function normalizeDiallableCharsOnly(string $number): string + { + return static::normalizeHelper($number, static::DIALLABLE_CHAR_MAPPINGS, true /* remove non matches */); + } + + /** + * Formats a phone number for out-of-country dialing purposes. + * + * Note that in this version, if the number was entered originally using alpha characters and + * this version of the number is stored in raw_input, this representation of the number will be + * used rather than the digit representation. Grouping information, as specified by characters + * such as "-" and " ", will be retained. + * + *

Caveats:

+ *
    + *
  • This will not produce good results if the country calling code is both present in the raw + * input _and_ is the start of the national number. This is not a problem in the regions + * which typically use alpha numbers. + *
  • This will also not produce good results if the raw input has any grouping information + * within the first three digits of the national number, and if the function needs to strip + * preceding digits/words in the raw input before these digits. Normally people group the + * first three digits together so this is not a huge problem - and will be fixed if it + * proves to be so. + *
+ * + * @param PhoneNumber $number the phone number that needs to be formatted + * @param string $regionCallingFrom the region where the call is being placed + * @return string the formatted phone number + */ + public function formatOutOfCountryKeepingAlphaChars(PhoneNumber $number, string $regionCallingFrom): string + { + $rawInput = $number->getRawInput(); + // If there is no raw input, then we can't keep alpha characters because there aren't any. + // In this case, we return formatOutOfCountryCallingNumber. + if ($rawInput === null || $rawInput === '') { + return $this->formatOutOfCountryCallingNumber($number, $regionCallingFrom); + } + $countryCode = $number->getCountryCode(); + if (!$this->hasValidCountryCallingCode($countryCode)) { + return $rawInput; + } + // Strip any prefix such as country calling code, IDD, that was present. We do this by comparing + // the number in raw_input with the parsed number. + // To do this, first we normalize punctuation. We retain number grouping symbols such as " " + // only. + $rawInput = self::normalizeHelper($rawInput, static::$ALL_PLUS_NUMBER_GROUPING_SYMBOLS, true); + // Now we trim everything before the first three digits in the parsed number. We choose three + // because all valid alpha numbers have 3 digits at the start - if it does not, then we don't + // trim anything at all. Similarly, if the national number was less than three digits, we don't + // trim anything at all. + $nationalNumber = $this->getNationalSignificantNumber($number); + if (strlen($nationalNumber) > 3) { + $firstNationalNumberDigit = strpos($rawInput, substr($nationalNumber, 0, 3)); + if ($firstNationalNumberDigit !== false) { + $rawInput = substr($rawInput, $firstNationalNumberDigit); + } + } + $metadataForRegionCallingFrom = $this->getMetadataForRegion($regionCallingFrom); + if ($countryCode === static::NANPA_COUNTRY_CODE) { + if ($this->isNANPACountry($regionCallingFrom)) { + return $countryCode . ' ' . $rawInput; + } + } elseif ($metadataForRegionCallingFrom !== null && + $countryCode === $this->getCountryCodeForValidRegion($regionCallingFrom) + ) { + $formattingPattern = + $this->chooseFormattingPatternForNumber( + $metadataForRegionCallingFrom->numberFormats(), + $nationalNumber + ); + if ($formattingPattern === null) { + // If no pattern above is matched, we format the original input. + return $rawInput; + } + $newFormat = new NumberFormat(); + $newFormat->mergeFrom($formattingPattern); + // The first group is the first group of digits that the user wrote together. + $newFormat->setPattern('(\\d+)(.*)'); + // Here we just concatenate them back together after the national prefix has been fixed. + $newFormat->setFormat('$1$2'); + // Now we format using this pattern instead of the default pattern, but with the national + // prefix prefixed if necessary. + // This will not work in the cases where the pattern (and not the leading digits) decide + // whether a national prefix needs to be used, since we have overridden the pattern to match + // anything, but that is not the case in the metadata to date. + return $this->formatNsnUsingPattern($rawInput, $newFormat, PhoneNumberFormat::NATIONAL); + } + $internationalPrefixForFormatting = ''; + // If an unsupported region-calling-from is entered, or a country with multiple international + // prefixes, the international format of the number is returned, unless there is a preferred + // international prefix. + if ($metadataForRegionCallingFrom !== null) { + $internationalPrefix = $metadataForRegionCallingFrom->getInternationalPrefix(); + $uniqueInternationalPrefixMatcher = new Matcher(static::SINGLE_INTERNATIONAL_PREFIX, $internationalPrefix); + $internationalPrefixForFormatting = + $uniqueInternationalPrefixMatcher->matches() + ? $internationalPrefix + : $metadataForRegionCallingFrom->getPreferredInternationalPrefix(); + } + $formattedNumber = $rawInput; + $regionCode = $this->getRegionCodeForCountryCode($countryCode); + // Metadata cannot be null because the country calling code is valid. + $metadataForRegion = $this->getMetadataForRegionOrCallingCode($countryCode, $regionCode); + $this->maybeAppendFormattedExtension( + $number, + $metadataForRegion, + PhoneNumberFormat::INTERNATIONAL, + $formattedNumber + ); + if (isset($internationalPrefixForFormatting) && $internationalPrefixForFormatting !== '') { + $formattedNumber = $internationalPrefixForFormatting . ' ' . $countryCode . ' ' . $formattedNumber; + } else { + // Invalid region entered as country-calling-from (so no metadata was found for it) or the + // region chosen has multiple international dialling prefixes. + $this->prefixNumberWithCountryCallingCode( + $countryCode, + PhoneNumberFormat::INTERNATIONAL, + $formattedNumber + ); + } + return $formattedNumber; + } + + /** + * Formats a phone number for out-of-country dialing purposes. If no regionCallingFrom is + * supplied, we format the number in its INTERNATIONAL format. If the country calling code is the + * same as that of the region where the number is from, then NATIONAL formatting will be applied. + * + *

If the number itself has a country calling code of zero or an otherwise invalid country + * calling code, then we return the number with no formatting applied. + * + *

Note this function takes care of the case for calling inside of NANPA and between Russia and + * Kazakhstan (who share the same country calling code). In those cases, no international prefix + * is used. For regions which have multiple international prefixes, the number in its + * INTERNATIONAL format will be returned instead. + * + * @param PhoneNumber $number the phone number to be formatted + * @param string $regionCallingFrom the region where the call is being placed + * @return string the formatted phone number + */ + public function formatOutOfCountryCallingNumber(PhoneNumber $number, string $regionCallingFrom): string + { + if (!$this->isValidRegionCode($regionCallingFrom)) { + return $this->format($number, PhoneNumberFormat::INTERNATIONAL); + } + $countryCallingCode = $number->getCountryCode(); + $nationalSignificantNumber = $this->getNationalSignificantNumber($number); + if (!$this->hasValidCountryCallingCode($countryCallingCode)) { + return $nationalSignificantNumber; + } + if ($countryCallingCode === static::NANPA_COUNTRY_CODE) { + if ($this->isNANPACountry($regionCallingFrom)) { + // For NANPA regions, return the national format for these regions but prefix it with the + // country calling code. + return $countryCallingCode . ' ' . $this->format($number, PhoneNumberFormat::NATIONAL); + } + } elseif ($countryCallingCode === $this->getCountryCodeForValidRegion($regionCallingFrom)) { + // If regions share a country calling code, the country calling code need not be dialled. + // This also applies when dialling within a region, so this if clause covers both these cases. + // Technically this is the case for dialling from La Reunion to other overseas departments of + // France (French Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover this + // edge case for now and for those cases return the version including country calling code. + // Details here: http://www.petitfute.com/voyage/225-info-pratiques-reunion + return $this->format($number, PhoneNumberFormat::NATIONAL); + } + // Metadata cannot be null because we checked 'isValidRegionCode()' above. + /** @var PhoneMetadata $metadataForRegionCallingFrom */ + $metadataForRegionCallingFrom = $this->getMetadataForRegion($regionCallingFrom); + + $internationalPrefix = $metadataForRegionCallingFrom->getInternationalPrefix(); + + // In general, if there is a preferred international prefix, use that. Otherwise, for regions + // that have multiple international prefixes, the international format of the number is + // returned since we would not know which one to use. + $internationalPrefixForFormatting = ''; + if ($metadataForRegionCallingFrom->hasPreferredInternationalPrefix()) { + $internationalPrefixForFormatting = $metadataForRegionCallingFrom->getPreferredInternationalPrefix(); + } else { + $uniqueInternationalPrefixMatcher = new Matcher(static::SINGLE_INTERNATIONAL_PREFIX, $internationalPrefix); + + if ($uniqueInternationalPrefixMatcher->matches()) { + $internationalPrefixForFormatting = $internationalPrefix; + } + } + + $regionCode = $this->getRegionCodeForCountryCode($countryCallingCode); + // Metadata cannot be null because the country calling code is valid. + /** @var PhoneMetadata $metadataForRegion */ + $metadataForRegion = $this->getMetadataForRegionOrCallingCode($countryCallingCode, $regionCode); + $formattedNationalNumber = $this->formatNsn( + $nationalSignificantNumber, + $metadataForRegion, + PhoneNumberFormat::INTERNATIONAL + ); + $formattedNumber = $formattedNationalNumber; + $this->maybeAppendFormattedExtension( + $number, + $metadataForRegion, + PhoneNumberFormat::INTERNATIONAL, + $formattedNumber + ); + if ($internationalPrefixForFormatting !== '') { + $formattedNumber = $internationalPrefixForFormatting . ' ' . $countryCallingCode . ' ' . $formattedNumber; + } else { + $this->prefixNumberWithCountryCallingCode( + $countryCallingCode, + PhoneNumberFormat::INTERNATIONAL, + $formattedNumber + ); + } + return $formattedNumber; + } + + /** + * Checks if this is a region under the North American Numbering Plan Administration (NANPA). + * @param string $regionCode + * @return boolean true if regionCode is one of the regions under NANPA + */ + public function isNANPACountry(string $regionCode): bool + { + return in_array(strtoupper($regionCode), $this->nanpaRegions); + } + + /** + * Formats a phone number using the original phone number format (e.g. INTERNATIONAL or NATIONAL) + * that the number is parsed from, provided that the number has been parsed with + * parseAndKeepRawInput. Otherwise the number will be formatted in NATIONAL format. + * + * The original format is embedded in the country_code_source field of the PhoneNumber object + * passed in, which is only set when parsing keeps the raw input. When we don't have a formatting + * pattern for the number, the method falls back to returning the raw input. + * + * Note this method guarantees no digit will be inserted, removed or modified as a result of + * formatting. + * + * @param PhoneNumber $number the phone number that needs to be formatted in its original number format + * @param string $regionCallingFrom the region whose IDD needs to be prefixed if the original number + * has one + * @return string the formatted phone number in its original number format + */ + public function formatInOriginalFormat(PhoneNumber $number, string $regionCallingFrom): string + { + if ($number->hasRawInput() && !$this->hasFormattingPatternForNumber($number)) { + // We check if we have the formatting pattern because without that, we might format the number + // as a group without national prefix. + return $number->getRawInput(); + } + if (!$number->hasCountryCodeSource()) { + return $this->format($number, PhoneNumberFormat::NATIONAL); + } + switch ($number->getCountryCodeSource()) { + case CountryCodeSource::FROM_NUMBER_WITH_PLUS_SIGN: + $formattedNumber = $this->format($number, PhoneNumberFormat::INTERNATIONAL); + break; + case CountryCodeSource::FROM_NUMBER_WITH_IDD: + $formattedNumber = $this->formatOutOfCountryCallingNumber($number, $regionCallingFrom); + break; + case CountryCodeSource::FROM_NUMBER_WITHOUT_PLUS_SIGN: + $formattedNumber = substr($this->format($number, PhoneNumberFormat::INTERNATIONAL), 1); + break; + case CountryCodeSource::FROM_DEFAULT_COUNTRY: + // Fall-through to default case. + default: + + $regionCode = $this->getRegionCodeForCountryCode($number->getCountryCode()); + // We strip non-digits from the NDD here, and from the raw input later, so that we can + // compare them easily. + $nationalPrefix = $this->getNddPrefixForRegion($regionCode, true /* strip non-digits */); + $nationalFormat = $this->format($number, PhoneNumberFormat::NATIONAL); + if ($nationalPrefix === null || $nationalPrefix === '') { + // If the region doesn't have a national prefix at all, we can safely return the national + // format without worrying about a national prefix being added. + $formattedNumber = $nationalFormat; + break; + } + // Otherwise, we check if the original number was entered with a national prefix. + if ($this->rawInputContainsNationalPrefix( + $number->getRawInput(), + $nationalPrefix, + $regionCode + ) + ) { + // If so, we can safely return the national format. + $formattedNumber = $nationalFormat; + break; + } + // Metadata cannot be null here because getNddPrefixForRegion() (above) returns null if + // there is no metadata for the region. + $metadata = $this->getMetadataForRegion($regionCode); + $nationalNumber = $this->getNationalSignificantNumber($number); + $formatRule = $this->chooseFormattingPatternForNumber($metadata->numberFormats(), $nationalNumber); + // The format rule could still be null here if the national number was 0 and there was no + // raw input (this should not be possible for numbers generated by the phonenumber library + // as they would also not have a country calling code and we would have exited earlier). + if ($formatRule === null) { + $formattedNumber = $nationalFormat; + break; + } + // When the format we apply to this number doesn't contain national prefix, we can just + // return the national format. + // TODO: Refactor the code below with the code in isNationalPrefixPresentIfRequired. + $candidateNationalPrefixRule = $formatRule->getNationalPrefixFormattingRule(); + // We assume that the first-group symbol will never be _before_ the national prefix. + $indexOfFirstGroup = strpos($candidateNationalPrefixRule, '$1'); + if ($indexOfFirstGroup <= 0) { + $formattedNumber = $nationalFormat; + break; + } + $candidateNationalPrefixRule = substr($candidateNationalPrefixRule, 0, $indexOfFirstGroup); + $candidateNationalPrefixRule = static::normalizeDigitsOnly($candidateNationalPrefixRule); + if ($candidateNationalPrefixRule === '') { + // National prefix not used when formatting this number. + $formattedNumber = $nationalFormat; + break; + } + // Otherwise, we need to remove the national prefix from our output. + $numFormatCopy = new NumberFormat(); + $numFormatCopy->mergeFrom($formatRule); + $numFormatCopy->clearNationalPrefixFormattingRule(); + $numberFormats = []; + $numberFormats[] = $numFormatCopy; + $formattedNumber = $this->formatByPattern($number, PhoneNumberFormat::NATIONAL, $numberFormats); + break; + } + $rawInput = $number->getRawInput(); + // If no digit is inserted/removed/modified as a result of our formatting, we return the + // formatted phone number; otherwise we return the raw input the user entered. + if ($formattedNumber !== null && $rawInput !== '') { + $normalizedFormattedNumber = static::normalizeDiallableCharsOnly($formattedNumber); + $normalizedRawInput = static::normalizeDiallableCharsOnly($rawInput); + if ($normalizedFormattedNumber !== $normalizedRawInput) { + $formattedNumber = $rawInput; + } + } + return $formattedNumber; + } + + /** + * @return bool + */ + protected function hasFormattingPatternForNumber(PhoneNumber $number): bool + { + $countryCallingCode = $number->getCountryCode(); + $phoneNumberRegion = $this->getRegionCodeForCountryCode($countryCallingCode); + $metadata = $this->getMetadataForRegionOrCallingCode($countryCallingCode, $phoneNumberRegion); + if ($metadata === null) { + return false; + } + $nationalNumber = $this->getNationalSignificantNumber($number); + $formatRule = $this->chooseFormattingPatternForNumber($metadata->numberFormats(), $nationalNumber); + return $formatRule !== null; + } + + /** + * Returns the national dialling prefix for a specific region. For example, this would be 1 for + * the United States, and 0 for New Zealand. Set stripNonDigits to true to strip symbols like "~" + * (which indicates a wait for a dialling tone) from the prefix returned. If no national prefix is + * present, we return null. + * + *

Warning: Do not use this method for do-your-own formatting - for some regions, the + * national dialling prefix is used only for certain types of numbers. Use the library's + * formatting functions to prefix the national prefix when required. + * + * @param string $regionCode the region that we want to get the dialling prefix for + * @param boolean $stripNonDigits true to strip non-digits from the national dialling prefix + * @return string|null the dialling prefix for the region denoted by regionCode + */ + public function getNddPrefixForRegion(string $regionCode, bool $stripNonDigits): ?string + { + $metadata = $this->getMetadataForRegion($regionCode); + if ($metadata === null) { + return null; + } + $nationalPrefix = $metadata->getNationalPrefix(); + // If no national prefix was found, we return null. + if ($nationalPrefix === null || $nationalPrefix === '') { + return null; + } + if ($stripNonDigits) { + // Note: if any other non-numeric symbols are ever used in national prefixes, these would have + // to be removed here as well. + $nationalPrefix = str_replace('~', '', $nationalPrefix); + } + return $nationalPrefix; + } + + /** + * Check if rawInput, which is assumed to be in the national format, has a national prefix. The + * national prefix is assumed to be in digits-only form. + * @param string $rawInput + * @param string $nationalPrefix + * @param string $regionCode + * @return bool + */ + protected function rawInputContainsNationalPrefix(string $rawInput, string $nationalPrefix, string $regionCode): bool + { + $normalizedNationalNumber = static::normalizeDigitsOnly($rawInput); + if (str_starts_with($normalizedNationalNumber, $nationalPrefix)) { + try { + // Some Japanese numbers (e.g. 00777123) might be mistaken to contain the national prefix + // when written without it (e.g. 0777123) if we just do prefix matching. To tackle that, we + // check the validity of the number if the assumed national prefix is removed (777123 won't + // be valid in Japan). + return $this->isValidNumber( + $this->parse(substr($normalizedNationalNumber, mb_strlen($nationalPrefix)), $regionCode) + ); + } catch (NumberParseException) { + return false; + } + } + return false; + } + + /** + * Tests whether a phone number matches a valid pattern. Note this doesn't verify the number + * is actually in use, which is impossible to tell by just looking at a number itself. It only + * verifies whether the parsed, canonicalised number is valid: not whether a particular series of + * digits entered by the user is diallable from the region provided when parsing. For example, the + * number +41 (0) 78 927 2696 can be parsed into a number with country code "41" and national + * significant number "789272696". This is valid, while the original string is not diallable. + * + * @param PhoneNumber $number the phone number that we want to validate + * @return boolean that indicates whether the number is of a valid pattern + */ + public function isValidNumber(PhoneNumber $number): bool + { + $regionCode = $this->getRegionCodeForNumber($number); + + if ($regionCode === null) { + return false; + } + + return $this->isValidNumberForRegion($number, $regionCode); + } + + /** + * Tests whether a phone number is valid for a certain region. Note this doesn't verify the number + * is actually in use, which is impossible to tell by just looking at a number itself. If the + * country calling code is not the same as the country calling code for the region, this + * immediately exits with false. After this, the specific number pattern rules for the region are + * examined. This is useful for determining for example whether a particular number is valid for + * Canada, rather than just a valid NANPA number. + * Warning: In most cases, you want to use {@link #isValidNumber} instead. For example, this + * method will mark numbers from British Crown dependencies such as the Isle of Man as invalid for + * the region "GB" (United Kingdom), since it has its own region code, "IM", which may be + * undesirable. + * + * @param PhoneNumber $number the phone number that we want to validate + * @param string $regionCode the region that we want to validate the phone number for + * @return boolean that indicates whether the number is of a valid pattern + */ + public function isValidNumberForRegion(PhoneNumber $number, string $regionCode): bool + { + $countryCode = $number->getCountryCode(); + $metadata = $this->getMetadataForRegionOrCallingCode($countryCode, $regionCode); + if (($metadata === null) || + (static::REGION_CODE_FOR_NON_GEO_ENTITY !== $regionCode && + $countryCode !== $this->getCountryCodeForValidRegion($regionCode)) + ) { + // Either the region code was invalid, or the country calling code for this number does not + // match that of the region code. + return false; + } + $nationalSignificantNumber = $this->getNationalSignificantNumber($number); + + return $this->getNumberTypeHelper($nationalSignificantNumber, $metadata) !== PhoneNumberType::UNKNOWN; + } + + /** + * Parses a string and returns it as a phone number in proto buffer format. The method is quite + * lenient and looks for a number in the input text (raw input) and does not check whether the + * string is definitely only a phone number. To do this, it ignores punctuation and white-space, + * as well as any text before the number (e.g. a leading “Tel: ”) and trims the non-number bits. + * It will accept a number in any format (E164, national, international etc), assuming it can + * interpreted with the defaultRegion supplied. It also attempts to convert any alpha characters + * into digits if it thinks this is a vanity number of the type "1800 MICROSOFT". + * + *

This method will throw a {@link NumberParseException} if the number is not considered to + * be a possible number. Note that validation of whether the number is actually a valid number + * for a particular region is not performed. This can be done separately with {@link #isValidNumber}. + * + *

Note this method canonicalizes the phone number such that different representations can be + * easily compared, no matter what form it was originally entered in (e.g. national, + * international). If you want to record context about the number being parsed, such as the raw + * input that was entered, how the country code was derived etc. then call {@link + * #parseAndKeepRawInput} instead. + * + * @param string $numberToParse number that we are attempting to parse. This can contain formatting + * such as +, ( and -, as well as a phone number extension. + * @param string|null $defaultRegion region that we are expecting the number to be from. This is only used + * if the number being parsed is not written in international format. + * The country_code for the number in this case would be stored as that + * of the default region supplied. If the number is guaranteed to + * start with a '+' followed by the country calling code, then + * "ZZ" or null can be supplied. + * @param PhoneNumber|null $phoneNumber + * @param bool $keepRawInput + * @return PhoneNumber a phone number proto buffer filled with the parsed number + * @throws NumberParseException if the string is not considered to be a viable phone number (e.g. + * too few or too many digits) or if no default region was supplied + * and the number is not in international format (does not start + * with +) + */ + public function parse(string $numberToParse, ?string $defaultRegion = null, PhoneNumber $phoneNumber = null, bool $keepRawInput = false): PhoneNumber + { + if ($phoneNumber === null) { + $phoneNumber = new PhoneNumber(); + } + $this->parseHelper($numberToParse, $defaultRegion, $keepRawInput, true, $phoneNumber); + return $phoneNumber; + } + + /** + * Formats a phone number in the specified format using client-defined formatting rules. Note that + * if the phone number has a country calling code of zero or an otherwise invalid country calling + * code, we cannot work out things like whether there should be a national prefix applied, or how + * to format extensions, so we return the national significant number with no formatting applied. + * + * @param PhoneNumber $number the phone number to be formatted + * @param int $numberFormat the format the phone number should be formatted into + * @param NumberFormat[] $userDefinedFormats formatting rules specified by clients + * @return String the formatted phone number + */ + public function formatByPattern(PhoneNumber $number, int $numberFormat, array $userDefinedFormats): string + { + $countryCallingCode = $number->getCountryCode(); + $nationalSignificantNumber = $this->getNationalSignificantNumber($number); + if (!$this->hasValidCountryCallingCode($countryCallingCode)) { + return $nationalSignificantNumber; + } + // Note getRegionCodeForCountryCode() is used because formatting information for regions which + // share a country calling code is contained by only one region for performance reasons. For + // example, for NANPA regions it will be contained in the metadata for US. + $regionCode = $this->getRegionCodeForCountryCode($countryCallingCode); + // Metadata cannot be null because the country calling code is valid. + $metadata = $this->getMetadataForRegionOrCallingCode($countryCallingCode, $regionCode); + + $formattedNumber = ''; + + $formattingPattern = $this->chooseFormattingPatternForNumber($userDefinedFormats, $nationalSignificantNumber); + if ($formattingPattern === null) { + // If no pattern above is matched, we format the number as a whole. + $formattedNumber .= $nationalSignificantNumber; + } else { + $numFormatCopy = new NumberFormat(); + // Before we do a replacement of the national prefix pattern $NP with the national prefix, we + // need to copy the rule so that subsequent replacements for different numbers have the + // appropriate national prefix. + $numFormatCopy->mergeFrom($formattingPattern); + $nationalPrefixFormattingRule = $formattingPattern->getNationalPrefixFormattingRule(); + if ($nationalPrefixFormattingRule !== '') { + $nationalPrefix = $metadata->getNationalPrefix(); + if (isset($nationalPrefix) && $nationalPrefix !== '') { + // Replace $NP with national prefix and $FG with the first group ($1). + $nationalPrefixFormattingRule = str_replace( + [static::NP_STRING, static::FG_STRING], + [$nationalPrefix, '$1'], + $nationalPrefixFormattingRule + ); + $numFormatCopy->setNationalPrefixFormattingRule($nationalPrefixFormattingRule); + } else { + // We don't want to have a rule for how to format the national prefix if there isn't one. + $numFormatCopy->clearNationalPrefixFormattingRule(); + } + } + $formattedNumber .= $this->formatNsnUsingPattern($nationalSignificantNumber, $numFormatCopy, $numberFormat); + } + $this->maybeAppendFormattedExtension($number, $metadata, $numberFormat, $formattedNumber); + $this->prefixNumberWithCountryCallingCode($countryCallingCode, $numberFormat, $formattedNumber); + return $formattedNumber; + } + + /** + * Gets a valid number for the specified region. + * + * @param string $regionCode the region for which an example number is needed + * @return PhoneNumber|null a valid fixed-line number for the specified region. Returns null when the metadata + * does not contain such information, or the region 001 is passed in. For 001 (representing + * non-geographical numbers), call {@link #getExampleNumberForNonGeoEntity} instead. + */ + public function getExampleNumber(string $regionCode): ?PhoneNumber + { + return $this->getExampleNumberForType($regionCode, PhoneNumberType::FIXED_LINE); + } + + /** + * Gets an invalid number for the specified region. This is useful for unit-testing purposes, + * where you want to test what will happen with an invalid number. Note that the number that is + * returned will always be able to be parsed and will have the correct country code. It may also + * be a valid *short* number/code for this region. Validity checking such numbers is handled with + * {@link ShortNumberInfo}. + * + * @param string $regionCode The region for which an example number is needed + * @return PhoneNumber|null An invalid number for the specified region. Returns null when an unsupported region + * or the region 001 (Earth) is passed in. + */ + public function getInvalidExampleNumber(string $regionCode): ?PhoneNumber + { + if (!$this->isValidRegionCode($regionCode)) { + return null; + } + + // We start off with a valid fixed-line number since every country supports this. Alternatively + // we could start with a different number type, since fixed-line numbers typically have a wide + // breadth of valid number lengths and we may have to make it very short before we get an + // invalid number. + + $desc = $this->getNumberDescByType($this->getMetadataForRegion($regionCode), PhoneNumberType::FIXED_LINE); + + if ($desc->getExampleNumber() === '') { + // This shouldn't happen; we have a test for this. + return null; + } + + $exampleNumber = $desc->getExampleNumber(); + + // Try and make the number invalid. We do this by changing the length. We try reducing the + // length of the number, since currently no region has a number that is the same length as + // MIN_LENGTH_FOR_NSN. This is probably quicker than making the number longer, which is another + // alternative. We could also use the possible number pattern to extract the possible lengths of + // the number to make this faster, but this method is only for unit-testing so simplicity is + // preferred to performance. We don't want to return a number that can't be parsed, so we check + // the number is long enough. We try all possible lengths because phone number plans often have + // overlapping prefixes so the number 123456 might be valid as a fixed-line number, and 12345 as + // a mobile number. It would be faster to loop in a different order, but we prefer numbers that + // look closer to real numbers (and it gives us a variety of different lengths for the resulting + // phone numbers - otherwise they would all be MIN_LENGTH_FOR_NSN digits long.) + for ($phoneNumberLength = mb_strlen($exampleNumber) - 1; $phoneNumberLength >= static::MIN_LENGTH_FOR_NSN; $phoneNumberLength--) { + $numberToTry = mb_substr($exampleNumber, 0, $phoneNumberLength); + try { + $possiblyValidNumber = $this->parse($numberToTry, $regionCode); + if (!$this->isValidNumber($possiblyValidNumber)) { + return $possiblyValidNumber; + } + } catch (NumberParseException) { + // Shouldn't happen: we have already checked the length, we know example numbers have + // only valid digits, and we know the region code is fine. + } + } + // We have a test to check that this doesn't happen for any of our supported regions. + return null; + } + + /** + * Gets a valid number for the specified region and number type. + * + * @param string|int $regionCodeOrType the region for which an example number is needed + * @param int $type the PhoneNumberType of number that is needed + * @return PhoneNumber|null a valid number for the specified region and type. Returns null when the metadata + * does not contain such information or if an invalid region or region 001 was entered. + * For 001 (representing non-geographical numbers), call + * {@link #getExampleNumberForNonGeoEntity} instead. + * + * If $regionCodeOrType is the only parameter supplied, then a valid number for the specified number type + * will be returned that may belong to any country. + */ + public function getExampleNumberForType(string|int $regionCodeOrType, ?int $type = null): ?PhoneNumber + { + if (is_int($regionCodeOrType) && $type === null) { + /* + * Gets a valid number for the specified number type (it may belong to any country). + */ + foreach ($this->getSupportedRegions() as $regionCode) { + $exampleNumber = $this->getExampleNumberForType($regionCode, $regionCodeOrType); + if ($exampleNumber !== null) { + return $exampleNumber; + } + } + + // If there wasn't an example number for a region, try the non-geographical entities. + foreach ($this->getSupportedGlobalNetworkCallingCodes() as $countryCallingCode) { + $desc = $this->getNumberDescByType($this->getMetadataForNonGeographicalRegion($countryCallingCode), $regionCodeOrType); + try { + if ($desc->getExampleNumber() !== '') { + return $this->parse('+' . $countryCallingCode . $desc->getExampleNumber(), static::UNKNOWN_REGION); + } + } catch (NumberParseException) { + // noop + } + } + // There are no example numbers of this type for any country in the library. + return null; + } + + if (is_int($regionCodeOrType)) { + // This should be a string by now + return null; + } + + // Check the region code is valid. + if (!$this->isValidRegionCode($regionCodeOrType)) { + return null; + } + $desc = $this->getNumberDescByType($this->getMetadataForRegion($regionCodeOrType), $type); + try { + if ($desc->hasExampleNumber()) { + return $this->parse($desc->getExampleNumber(), $regionCodeOrType); + } + } catch (NumberParseException) { + // noop + } + return null; + } + + /** + * @param int $type PhoneNumberType + * @return PhoneNumberDesc + */ + protected function getNumberDescByType(PhoneMetadata $metadata, int $type): PhoneNumberDesc + { + return match ($type) { + PhoneNumberType::PREMIUM_RATE => $metadata->getPremiumRate(), + PhoneNumberType::TOLL_FREE => $metadata->getTollFree(), + PhoneNumberType::MOBILE => $metadata->getMobile(), + PhoneNumberType::FIXED_LINE, PhoneNumberType::FIXED_LINE_OR_MOBILE => $metadata->getFixedLine(), + PhoneNumberType::SHARED_COST => $metadata->getSharedCost(), + PhoneNumberType::VOIP => $metadata->getVoip(), + PhoneNumberType::PERSONAL_NUMBER => $metadata->getPersonalNumber(), + PhoneNumberType::PAGER => $metadata->getPager(), + PhoneNumberType::UAN => $metadata->getUan(), + PhoneNumberType::VOICEMAIL => $metadata->getVoicemail(), + default => $metadata->getGeneralDesc(), + }; + } + + /** + * Gets a valid number for the specified country calling code for a non-geographical entity. + * + * @param int $countryCallingCode the country calling code for a non-geographical entity + * @return PhoneNumber|null a valid number for the non-geographical entity. Returns null when the metadata + * does not contain such information, or the country calling code passed in does not belong + * to a non-geographical entity. + */ + public function getExampleNumberForNonGeoEntity(int $countryCallingCode): ?PhoneNumber + { + $metadata = $this->getMetadataForNonGeographicalRegion($countryCallingCode); + if ($metadata !== null) { + // For geographical entities, fixed-line data is always present. However, for non-geographical + // entities, this is not the case, so we have to go through different types to find the + // example number. We don't check fixed-line or personal number since they aren't used by + // non-geographical entities (if this changes, a unit-test will catch this.) + /** @var PhoneNumberDesc[] $list */ + $list = [ + $metadata->getMobile(), + $metadata->getTollFree(), + $metadata->getSharedCost(), + $metadata->getVoip(), + $metadata->getVoicemail(), + $metadata->getUan(), + $metadata->getPremiumRate(), + ]; + foreach ($list as $desc) { + try { + if ($desc !== null && $desc->hasExampleNumber()) { + return $this->parse('+' . $countryCallingCode . $desc->getExampleNumber(), self::UNKNOWN_REGION); + } + } catch (NumberParseException) { + // noop + } + } + } + return null; + } + + + /** + * Takes two phone numbers and compares them for equality. + * + *

Returns EXACT_MATCH if the country_code, NSN, presence of a leading zero + * for Italian numbers and any extension present are the same. Returns NSN_MATCH + * if either or both has no region specified, and the NSNs and extensions are + * the same. Returns SHORT_NSN_MATCH if either or both has no region specified, + * or the region specified is the same, and one NSN could be a shorter version + * of the other number. This includes the case where one has an extension + * specified, and the other does not. Returns NO_MATCH otherwise. For example, + * the numbers +1 345 657 1234 and 657 1234 are a SHORT_NSN_MATCH. The numbers + * +1 345 657 1234 and 345 657 are a NO_MATCH. + * + * @param $firstNumberIn PhoneNumber|string First number to compare. If it is a + * string it can contain formatting, and can have country calling code specified + * with + at the start. + * @param $secondNumberIn PhoneNumber|string Second number to compare. If it is a + * string it can contain formatting, and can have country calling code specified + * with + at the start. + * @throws \InvalidArgumentException + * @return int {MatchType} NOT_A_NUMBER, NO_MATCH, + */ + public function isNumberMatch(PhoneNumber|string $firstNumberIn, PhoneNumber|string $secondNumberIn): int + { + if (is_string($firstNumberIn) && is_string($secondNumberIn)) { + try { + $firstNumberAsProto = $this->parse($firstNumberIn, static::UNKNOWN_REGION); + return $this->isNumberMatch($firstNumberAsProto, $secondNumberIn); + } catch (NumberParseException $e) { + if ($e->getErrorType() === NumberParseException::INVALID_COUNTRY_CODE) { + try { + $secondNumberAsProto = $this->parse($secondNumberIn, static::UNKNOWN_REGION); + return $this->isNumberMatch($secondNumberAsProto, $firstNumberIn); + } catch (NumberParseException $e2) { + if ($e2->getErrorType() === NumberParseException::INVALID_COUNTRY_CODE) { + try { + $firstNumberProto = new PhoneNumber(); + $secondNumberProto = new PhoneNumber(); + $this->parseHelper($firstNumberIn, null, false, false, $firstNumberProto); + $this->parseHelper($secondNumberIn, null, false, false, $secondNumberProto); + return $this->isNumberMatch($firstNumberProto, $secondNumberProto); + } catch (NumberParseException) { + // Fall through and return MatchType::NOT_A_NUMBER + } + } + } + } + } + return MatchType::NOT_A_NUMBER; + } + if ($firstNumberIn instanceof PhoneNumber && is_string($secondNumberIn)) { + // First see if the second number has an implicit country calling code, by attempting to parse + // it. + try { + $secondNumberAsProto = $this->parse($secondNumberIn, static::UNKNOWN_REGION); + return $this->isNumberMatch($firstNumberIn, $secondNumberAsProto); + } catch (NumberParseException $e) { + if ($e->getErrorType() === NumberParseException::INVALID_COUNTRY_CODE) { + // The second number has no country calling code. EXACT_MATCH is no longer possible. + // We parse it as if the region was the same as that for the first number, and if + // EXACT_MATCH is returned, we replace this with NSN_MATCH. + $firstNumberRegion = $this->getRegionCodeForCountryCode($firstNumberIn->getCountryCode()); + try { + if ($firstNumberRegion !== static::UNKNOWN_REGION) { + $secondNumberWithFirstNumberRegion = $this->parse($secondNumberIn, $firstNumberRegion); + $match = $this->isNumberMatch($firstNumberIn, $secondNumberWithFirstNumberRegion); + if ($match === MatchType::EXACT_MATCH) { + return MatchType::NSN_MATCH; + } + return $match; + } + + // If the first number didn't have a valid country calling code, then we parse the + // second number without one as well. + $secondNumberProto = new PhoneNumber(); + $this->parseHelper($secondNumberIn, null, false, false, $secondNumberProto); + return $this->isNumberMatch($firstNumberIn, $secondNumberProto); + } catch (NumberParseException) { + // Fall-through to return NOT_A_NUMBER. + } + } + } + } + if ($firstNumberIn instanceof PhoneNumber && $secondNumberIn instanceof PhoneNumber) { + // We only care about the fields that uniquely define a number, so we copy these across + // explicitly. + $firstNumber = self::copyCoreFieldsOnly($firstNumberIn); + $secondNumber = self::copyCoreFieldsOnly($secondNumberIn); + + // Early exit if both had extensions and these are different. + if ($firstNumber->hasExtension() && $secondNumber->hasExtension() && + $firstNumber->getExtension() !== $secondNumber->getExtension() + ) { + return MatchType::NO_MATCH; + } + + $firstNumberCountryCode = $firstNumber->getCountryCode(); + $secondNumberCountryCode = $secondNumber->getCountryCode(); + // Both had country_code specified. + if ($firstNumberCountryCode !== 0 && $secondNumberCountryCode !== 0) { + if ($firstNumber->equals($secondNumber)) { + return MatchType::EXACT_MATCH; + } + + if ($firstNumberCountryCode === $secondNumberCountryCode && + $this->isNationalNumberSuffixOfTheOther($firstNumber, $secondNumber)) { + // A SHORT_NSN_MATCH occurs if there is a difference because of the presence or absence of + // an 'Italian leading zero', the presence or absence of an extension, or one NSN being a + // shorter variant of the other. + return MatchType::SHORT_NSN_MATCH; + } + // This is not a match. + return MatchType::NO_MATCH; + } + // Checks cases where one or both country_code fields were not specified. To make equality + // checks easier, we first set the country_code fields to be equal. + $firstNumber->setCountryCode($secondNumberCountryCode); + // If all else was the same, then this is an NSN_MATCH. + if ($firstNumber->equals($secondNumber)) { + return MatchType::NSN_MATCH; + } + if ($this->isNationalNumberSuffixOfTheOther($firstNumber, $secondNumber)) { + return MatchType::SHORT_NSN_MATCH; + } + return MatchType::NO_MATCH; + } + return MatchType::NOT_A_NUMBER; + } + + /** + * Returns true when one national number is the suffix of the other or both are the same. + * @return bool + */ + protected function isNationalNumberSuffixOfTheOther(PhoneNumber $firstNumber, PhoneNumber $secondNumber): bool + { + $firstNumberNationalNumber = trim((string)$firstNumber->getNationalNumber()); + $secondNumberNationalNumber = trim((string)$secondNumber->getNationalNumber()); + return str_ends_with($firstNumberNationalNumber, $secondNumberNationalNumber) || + str_ends_with($secondNumberNationalNumber, $firstNumberNationalNumber); + } + + /** + * Returns true if the supplied region supports mobile number portability. Returns false for + * invalid, unknown or regions that don't support mobile number portability. + * + * @param string $regionCode the region for which we want to know whether it supports mobile number + * portability or not. + * @return bool + */ + public function isMobileNumberPortableRegion(string $regionCode): bool + { + $metadata = $this->getMetadataForRegion($regionCode); + if ($metadata === null) { + return false; + } + + return $metadata->isMobileNumberPortableRegion(); + } + + /** + * Check whether a phone number is a possible number given a number in the form of a string, and + * the region where the number could be dialed from. It provides a more lenient check than + * {@link #isValidNumber}. See {@link #isPossibleNumber(PhoneNumber)} for details. + * + * Convenience wrapper around {@link #isPossibleNumberWithReason}. Instead of returning the reason + * for failure, this method returns a boolean value. + * For failure, this method returns true if the number is either a possible fully-qualified number + * (containing the area code and country code), or if the number could be a possible local number + * (with a country code, but missing an area code). Local numbers are considered possible if they + * could be possibly dialled in this format: if the area code is needed for a call to connect, the + * number is not considered possible without it. + * + * Note: There are two ways to call this method. + * + * isPossibleNumber(PhoneNumber $numberObject) + * isPossibleNumber(string '+441174960126', string 'GB') + * + * @param PhoneNumber|string $number the number that needs to be checked, in the form of a string + * @param string|null $regionDialingFrom the region that we are expecting the number to be dialed from. + * Note this is different from the region where the number belongs. For example, the number + * +1 650 253 0000 is a number that belongs to US. When written in this form, it can be + * dialed from any region. When it is written as 00 1 650 253 0000, it can be dialed from any + * region which uses an international dialling prefix of 00. When it is written as + * 650 253 0000, it can only be dialed from within the US, and when written as 253 0000, it + * can only be dialed from within a smaller area in the US (Mountain View, CA, to be more + * specific). + * @return boolean true if the number is possible + */ + public function isPossibleNumber(PhoneNumber|string $number, ?string $regionDialingFrom = null): bool + { + if (is_string($number)) { + try { + return $this->isPossibleNumber($this->parse($number, $regionDialingFrom)); + } catch (NumberParseException) { + return false; + } + } else { + $result = $this->isPossibleNumberWithReason($number); + return $result === ValidationResult::IS_POSSIBLE + || $result === ValidationResult::IS_POSSIBLE_LOCAL_ONLY; + } + } + + + /** + * Check whether a phone number is a possible number. It provides a more lenient check than + * {@link #isValidNumber} in the following sense: + *

    + *
  1. It only checks the length of phone numbers. In particular, it doesn't check starting + * digits of the number. + *
  2. It doesn't attempt to figure out the type of the number, but uses general rules which + * applies to all types of phone numbers in a region. Therefore, it is much faster than + * isValidNumber. + *
  3. For some numbers (particularly fixed-line), many regions have the concept of area code, + * which together with subscriber number constitute the national significant number. It is + * sometimes okay to dial only the subscriber number when dialing in the same area. This + * function will return IS_POSSIBLE_LOCAL_ONLY if the subscriber-number-only version is + * passed in. On the other hand, because isValidNumber validates using information on both + * starting digits (for fixed line numbers, that would most likely be area codes) and + * length (obviously includes the length of area codes for fixed line numbers), it will + * return false for the subscriber-number-only version. + *
+ * @param PhoneNumber $number the number that needs to be checked + * @return int a ValidationResult object which indicates whether the number is possible + */ + public function isPossibleNumberWithReason(PhoneNumber $number): int + { + return $this->isPossibleNumberForTypeWithReason($number, PhoneNumberType::UNKNOWN); + } + + /** + * Check whether a phone number is a possible number of a particular type. For types that don't + * exist in a particular region, this will return a result that isn't so useful; it is recommended + * that you use {@link #getSupportedTypesForRegion} or {@link #getSupportedTypesForNonGeoEntity} + * respectively before calling this method to determine whether you should call it for this number + * at all. + * + * This provides a more lenient check than {@link #isValidNumber} in the following sense: + * + *
    + *
  1. It only checks the length of phone numbers. In particular, it doesn't check starting + * digits of the number. + *
  2. For some numbers (particularly fixed-line), many regions have the concept of area code, + * which together with subscriber number constitute the national significant number. It is + * sometimes okay to dial only the subscriber number when dialing in the same area. This + * function will return IS_POSSIBLE_LOCAL_ONLY if the subscriber-number-only version is + * passed in. On the other hand, because isValidNumber validates using information on both + * starting digits (for fixed line numbers, that would most likely be area codes) and + * length (obviously includes the length of area codes for fixed line numbers), it will + * return false for the subscriber-number-only version. + *
+ * + * @param PhoneNumber $number the number that needs to be checked + * @param int $type the PhoneNumberType we are interested in + * @return int a ValidationResult object which indicates whether the number is possible + */ + public function isPossibleNumberForTypeWithReason(PhoneNumber $number, int $type): int + { + $nationalNumber = $this->getNationalSignificantNumber($number); + $countryCode = $number->getCountryCode(); + + // Note: For regions that share a country calling code, like NANPA numbers, we just use the + // rules from the default region (US in this case) since the getRegionCodeForNumber will not + // work if the number is possible but not valid. There is in fact one country calling code (290) + // where the possible number pattern differs between various regions (Saint Helena and Tristan + // da Cuñha), but this is handled by putting all possible lengths for any country with this + // country calling code in the metadata for the default region in this case. + if (!$this->hasValidCountryCallingCode($countryCode)) { + return ValidationResult::INVALID_COUNTRY_CODE; + } + + $regionCode = $this->getRegionCodeForCountryCode($countryCode); + // Metadata cannot be null because the country calling code is valid. + $metadata = $this->getMetadataForRegionOrCallingCode($countryCode, $regionCode); + return $this->testNumberLength($nationalNumber, $metadata, $type); + } + + /** + * Attempts to extract a valid number from a phone number that is too long to be valid, and resets + * the PhoneNumber object passed in to that valid version. If no valid number could be extracted, + * the PhoneNumber object passed in will not be modified. + * + * @param PhoneNumber $number a PhoneNumber object which contains a number that is too long to be valid. + * @return boolean true if a valid phone number can be successfully extracted. + */ + public function truncateTooLongNumber(PhoneNumber $number): bool + { + if ($this->isValidNumber($number)) { + return true; + } + $numberCopy = new PhoneNumber(); + $numberCopy->mergeFrom($number); + $nationalNumber = $number->getNationalNumber(); + do { + $nationalNumber = substr($nationalNumber, 0, -1); + $numberCopy->setNationalNumber($nationalNumber); + if ($nationalNumber === '0' || $this->isPossibleNumberWithReason($numberCopy) === ValidationResult::TOO_SHORT) { + return false; + } + } while (!$this->isValidNumber($numberCopy)); + $number->setNationalNumber($nationalNumber); + return true; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/RegexBasedMatcher.php b/lib/giggsey/libphonenumber-for-php-lite/src/RegexBasedMatcher.php new file mode 100644 index 00000000000..f68c4e08e07 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/RegexBasedMatcher.php @@ -0,0 +1,52 @@ +getNationalNumberPattern(); + + // We don't want to consider it a prefix match when matching non-empty input against an empty + // pattern + + if ($nationalNumberPattern === '') { + return false; + } + + return $this->match($number, $nationalNumberPattern, $allowPrefixMatch); + } + + private function match(string $number, string $pattern, bool $allowPrefixMatch): bool + { + $matcher = new Matcher($pattern, $number); + + if (!$matcher->lookingAt()) { + return false; + } + + return $matcher->matches() ? true : $allowPrefixMatch; + } +} diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/ValidationResult.php b/lib/giggsey/libphonenumber-for-php-lite/src/ValidationResult.php new file mode 100644 index 00000000000..facc6fcbccc --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/ValidationResult.php @@ -0,0 +1,45 @@ + + [ + 'NationalNumberPattern' => '(?:00|[1-9]\\d)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:00|[1-9]\\d)\\d{6}', + 'ExampleNumber' => '12345678', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 800, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '\\d', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_808.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_808.php new file mode 100644 index 00000000000..4f305d5196f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_808.php @@ -0,0 +1,114 @@ + + [ + 'NationalNumberPattern' => '[1-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '[1-9]\\d{7}', + 'ExampleNumber' => '12345678', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 808, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_870.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_870.php new file mode 100644 index 00000000000..5656424cae5 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_870.php @@ -0,0 +1,115 @@ + + [ + 'NationalNumberPattern' => '7\\d{11}|[35-7]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 12, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}', + 'ExampleNumber' => '301234567', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 870, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[35-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_878.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_878.php new file mode 100644 index 00000000000..2efb58fd2cc --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_878.php @@ -0,0 +1,114 @@ + + [ + 'NationalNumberPattern' => '10\\d{10}', + 'PossibleLength' => + [ + 0 => 12, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '10\\d{10}', + 'ExampleNumber' => '101234567890', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 878, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_881.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_881.php new file mode 100644 index 00000000000..479d87b5479 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_881.php @@ -0,0 +1,127 @@ + + [ + 'NationalNumberPattern' => '6\\d{9}|[0-36-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6\\d{9}|[0-36-9]\\d{8}', + 'ExampleNumber' => '612345678', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 881, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[0-37-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{5,6})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_882.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_882.php new file mode 100644 index 00000000000..1769e992f42 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_882.php @@ -0,0 +1,211 @@ + + [ + 'NationalNumberPattern' => '[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}', + 'ExampleNumber' => '3421234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 12, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}', + 'ExampleNumber' => '390123456789', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '348[57]\\d{7}', + 'ExampleNumber' => '34851234567', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 882, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '16|342', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '49', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[36]|9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3[23]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '16', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '10|23|3(?:[15]|4[57])|4|51', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '34', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{4,5})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-35]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_883.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_883.php new file mode 100644 index 00000000000..469a8558c9d --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_883.php @@ -0,0 +1,166 @@ + + [ + 'NationalNumberPattern' => '(?:[1-4]\\d|51)\\d{6,10}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + 4 => 12, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}', + 'ExampleNumber' => '510012345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 883, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2,8})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[14]|2[24-689]|3[02-689]|51[24-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '510', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '21', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '51[13]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[235]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_888.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_888.php new file mode 100644 index 00000000000..6d289c0e3c4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_888.php @@ -0,0 +1,113 @@ + + [ + 'NationalNumberPattern' => '\\d{11}', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '\\d{11}', + 'ExampleNumber' => '12345678901', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 888, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_979.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_979.php new file mode 100644 index 00000000000..2512b1a76b7 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_979.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '[1359]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'mobile' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '[1359]\\d{8}', + 'ExampleNumber' => '123456789', + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => '001', + 'countryCode' => 979, + 'internationalPrefix' => '', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1359]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AC.php new file mode 100644 index 00000000000..090c1259b4c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AC.php @@ -0,0 +1,111 @@ + + [ + 'NationalNumberPattern' => '(?:[01589]\\d|[46])\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '6[2-467]\\d{3}', + 'ExampleNumber' => '62889', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4\\d{4}', + 'ExampleNumber' => '40123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:0[1-9]|[1589]\\d)\\d{4}', + 'ExampleNumber' => '542011', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AC', + 'countryCode' => 247, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AD.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AD.php new file mode 100644 index 00000000000..1d8c45c0e14 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AD.php @@ -0,0 +1,152 @@ + + [ + 'NationalNumberPattern' => '(?:1|6\\d)\\d{7}|[135-9]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[78]\\d{5}', + 'ExampleNumber' => '712345', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '690\\d{6}|[356]\\d{5}', + 'ExampleNumber' => '312345', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '180[02]\\d{4}', + 'ExampleNumber' => '18001234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '[19]\\d{5}', + 'ExampleNumber' => '912345', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '1800\\d{4}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'id' => 'AD', + 'countryCode' => 376, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[135-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AE.php new file mode 100644 index 00000000000..beb65418a34 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AE.php @@ -0,0 +1,173 @@ + + [ + 'NationalNumberPattern' => '(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + 6 => 11, + 7 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[2-4679][2-8]\\d{6}', + 'ExampleNumber' => '22345678', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '5[024-68]\\d{7}', + 'ExampleNumber' => '501234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '400\\d{6}|800\\d{2,9}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[02]\\d{5}', + 'ExampleNumber' => '900234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '700[05]\\d{5}', + 'ExampleNumber' => '700012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '600[25]\\d{5}', + 'ExampleNumber' => '600212345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AE', + 'countryCode' => 971, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '60|8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[236]|[479][2-8]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d)(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[479]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AF.php new file mode 100644 index 00000000000..b3b5f5a67e0 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AF.php @@ -0,0 +1,153 @@ + + [ + 'NationalNumberPattern' => '[2-7]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\\d{6}', + 'ExampleNumber' => '234567890', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7\\d{8}', + 'ExampleNumber' => '701234567', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AF', + 'countryCode' => 93, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AG.php new file mode 100644 index 00000000000..c547321db81 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AG.php @@ -0,0 +1,114 @@ + + [ + 'NationalNumberPattern' => '(?:268|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '268(?:4(?:6[0-38]|84)|56[0-2])\\d{4}', + 'ExampleNumber' => '2684601234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '268(?:464|7(?:1[3-9]|[28]\\d|3[0246]|64|7[0-689]))\\d{4}', + 'ExampleNumber' => '2684641234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'NationalNumberPattern' => '26848[01]\\d{4}', + 'ExampleNumber' => '2684801234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '26840[69]\\d{4}', + 'ExampleNumber' => '2684061234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AG', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([457]\\d{6})$|1', + 'nationalPrefixTransformRule' => '268$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '268', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AI.php new file mode 100644 index 00000000000..d6b57e382ae --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AI.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:264|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '264(?:292|4(?:6[12]|9[78]))\\d{4}', + 'ExampleNumber' => '2644612345', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '264(?:235|4(?:69|76)|5(?:3[6-9]|8[1-4])|7(?:29|72))\\d{4}', + 'ExampleNumber' => '2642351234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '264724\\d{4}', + 'ExampleNumber' => '2647241234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AI', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2457]\\d{6})$|1', + 'nationalPrefixTransformRule' => '264$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '264', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AL.php new file mode 100644 index 00000000000..1a73270759f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AL.php @@ -0,0 +1,191 @@ + + [ + 'NationalNumberPattern' => '(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '4505[0-2]\\d{3}|(?:[2358][16-9]\\d[2-9]|4410)\\d{4}|(?:[2358][2-5][2-9]|4(?:[2-57-9][2-9]|6\\d))\\d{5}', + 'ExampleNumber' => '22345678', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6(?:[78][2-9]|9\\d)\\d{6}', + 'ExampleNumber' => '672123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4}', + 'ExampleNumber' => '8001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[1-9]\\d\\d', + 'ExampleNumber' => '900123', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '808[1-9]\\d\\d', + 'ExampleNumber' => '808123', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '700[2-9]\\d{4}', + 'ExampleNumber' => '70021234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AL', + 'countryCode' => 355, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '80|9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '4[2-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2358][2-5]|4', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[23578]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AM.php new file mode 100644 index 00000000000..3ae496cd147 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AM.php @@ -0,0 +1,152 @@ + + [ + 'NationalNumberPattern' => '(?:[1-489]\\d|55|60|77)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:1[0-25]|47)\\d|2(?:2[2-46]|3[1-8]|4[2-69]|5[2-7]|6[1-9]|8[1-7])|3[12]2)\\d{5}', + 'ExampleNumber' => '10123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:33|4[1349]|55|77|88|9[13-9])\\d{6}', + 'ExampleNumber' => '77123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[016]\\d{5}', + 'ExampleNumber' => '90012345', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '80[1-4]\\d{5}', + 'ExampleNumber' => '80112345', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '60(?:2[78]|3[5-9]|4[02-9]|5[0-46-9]|[6-8]\\d|9[0-2])\\d{4}', + 'ExampleNumber' => '60271234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AM', + 'countryCode' => 374, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]0', + ], + 'nationalPrefixFormattingRule' => '0 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2|3[12]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1|47', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[3-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AO.php new file mode 100644 index 00000000000..31f4bc8703e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AO.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '[29]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2\\d(?:[0134][25-9]|[25-9]\\d)\\d{5}', + 'ExampleNumber' => '222123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9[1-59]\\d{7}', + 'ExampleNumber' => '923123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AO', + 'countryCode' => 244, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[29]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AR.php new file mode 100644 index 00000000000..ecdb535e9d2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AR.php @@ -0,0 +1,377 @@ + + [ + 'NationalNumberPattern' => '(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '3888[013-9]\\d{5}|3(?:7(?:1[15]|81)|8(?:21|4[16]|69|9[12]))[46]\\d{5}|(?:2(?:657|9(?:54|66))|3(?:7(?:55|77)|865))[2-8]\\d{5}|(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|(?:2(?:284|3(?:02|23)|920)|3(?:4(?:46|8[27]|92)|541|878))[2-7]\\d{5}|(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:62|76|89)|564))[2-6]\\d{5}|(?:(?:11[1-8]|670)\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-8]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6])))\\d{6}|2(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}', + 'ExampleNumber' => '1123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '93(?:7(?:1[15]|81)[46]|8(?:(?:21|4[16]|69|9[12])[46]|88[013-9]))\\d{5}|9(?:2(?:657|9(?:54|66))|3(?:7(?:55|77)|865))[2-8]\\d{5}|9(?:2(?:2(?:2[59]|44|52)|3(?:26|44)|473|9(?:[07]2|2[26]|34|46))|3327)[45]\\d{5}|9(?:2(?:284|3(?:02|23)|920)|3(?:4(?:46|8[27]|92)|541|878))[2-7]\\d{5}|9(?:2(?:(?:26|62)2|320|477|9(?:42|83))|3(?:329|4(?:62|76|89)|564))[2-6]\\d{5}|(?:675\\d|9(?:11[1-8]\\d|2(?:2(?:0[45]|1[2-6]|3[3-6])|3(?:[06]4|7[45])|494|6(?:04|1[2-8]|[36][45]|4[3-6])|80[45]|9(?:[17][4-6]|[48][45]|9[3-6]))|3(?:364|4(?:1[2-8]|[235][4-6]|84)|5(?:1[2-9]|[38][4-6])|6(?:2[45]|44)|7[069][45]|8(?:0[45]|[17][2-6]|3[4-6]|[58][3-6]))))\\d{6}|92(?:2(?:21|4[23]|6[145]|7[1-4]|8[356]|9[267])|3(?:16|3[13-8]|43|5[346-8]|9[3-5])|475|6(?:2[46]|4[78]|5[1568])|9(?:03|2[1457-9]|3[1356]|4[08]|[56][23]|82))4\\d{5}|9(?:2(?:2(?:57|81)|3(?:24|46|92)|9(?:01|23|64))|3(?:4(?:42|71)|5(?:25|37|4[347]|71)|7(?:18|5[17])))[3-6]\\d{5}|9(?:2(?:2(?:02|2[3467]|4[156]|5[45]|6[6-8]|91)|3(?:1[47]|25|[45][25]|96)|47[48]|625|932)|3(?:38[2578]|4(?:0[0-24-9]|3[78]|4[457]|58|6[03-9]|72|83|9[136-8])|5(?:2[124]|[368][23]|4[2689]|7[2-6])|7(?:16|2[15]|3[145]|4[13]|5[468]|7[2-5]|8[26])|8(?:2[5-7]|3[278]|4[3-5]|5[78]|6[1-378]|[78]7|94)))[4-6]\\d{5}', + 'ExampleNumber' => '91123456789', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7,8}', + 'ExampleNumber' => '8001234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '60[04579]\\d{7}', + 'ExampleNumber' => '6001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '810\\d{7}', + 'ExampleNumber' => '8101234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '810\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'id' => 'AR', + 'countryCode' => 54, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?', + 'nationalPrefixTransformRule' => '9$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '0|1(?:0[0-35-7]|1[02-5]|2[015]|3[47]|4[478])|911', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-8]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])', + 1 => '2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)', + 2 => '2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]', + 3 => '2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[68]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[23]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 8 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{2})(\\d{4})', + 'format' => '$2 15-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:2[2-469]|3[3-578])', + 1 => '9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))', + 2 => '9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)', + 3 => '9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]', + 4 => '9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$2 15-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '91', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{5})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 11 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$2 15-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])', + 1 => '2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)', + 2 => '2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]', + 3 => '2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[68]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[23]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:2[2-469]|3[3-578])', + 1 => '9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))', + 2 => '9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)', + 3 => '9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]', + 4 => '9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]', + ], + ], + 5 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '91', + ], + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{5})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AS.php new file mode 100644 index 00000000000..e8a8aae164f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AS.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|684|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '6846(?:22|33|44|55|77|88|9[19])\\d{4}', + 'ExampleNumber' => '6846221234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '684(?:2(?:48|5[2468]|7[26])|7(?:3[13]|70|82))\\d{4}', + 'ExampleNumber' => '6847331234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AS', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([267]\\d{6})$|1', + 'nationalPrefixTransformRule' => '684$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '684', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AT.php new file mode 100644 index 00000000000..efc68510034 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AT.php @@ -0,0 +1,353 @@ + + [ + 'NationalNumberPattern' => '1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + 4 => 8, + 5 => 9, + 6 => 10, + 7 => 11, + 8 => 12, + 9 => 13, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1(?:11\\d|[2-9]\\d{3,11})|(?:316|463|(?:51|66|73)2)\\d{3,10}|(?:2(?:1[467]|2[13-8]|5[2357]|6[1-46-8]|7[1-8]|8[124-7]|9[1458])|3(?:1[1-578]|3[23568]|4[5-7]|5[1378]|6[1-38]|8[3-68])|4(?:2[1-8]|35|7[1368]|8[2457])|5(?:2[1-8]|3[357]|4[147]|5[12578]|6[37])|6(?:13|2[1-47]|4[135-8]|5[468])|7(?:2[1-8]|35|4[13478]|5[68]|6[16-8]|7[1-6]|9[45]))\\d{4,10}', + 'ExampleNumber' => '1234567890', + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6(?:5[0-3579]|6[013-9]|[7-9]\\d)\\d{4,10}', + 'ExampleNumber' => '664123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + 6 => 13, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6,10}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + 2 => 11, + 3 => 12, + 4 => 13, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:8[69][2-68]|9(?:0[01]|3[019]))\\d{6,10}', + 'ExampleNumber' => '900123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + 2 => 11, + 3 => 12, + 4 => 13, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8(?:10|2[018])\\d{6,10}|828\\d{5}', + 'ExampleNumber' => '810123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + 4 => 12, + 5 => 13, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '5(?:0[1-9]|17|[79]\\d)\\d{2,10}|7[28]0\\d{6,10}', + 'ExampleNumber' => '780123456', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + 6 => 11, + 7 => 12, + 8 => 13, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AT', + 'countryCode' => 43, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '14', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3,12})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:11|[2-9])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '517', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '5[079]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '[18]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3,10})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{4})(\\d{3,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-467]|5[2-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4,7})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3,12})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:11|[2-9])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '517', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '5[079]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3,10})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{3,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-467]|5[2-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4,7})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AU.php new file mode 100644 index 00000000000..6a0502ca1a8 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AU.php @@ -0,0 +1,328 @@ + + [ + 'NationalNumberPattern' => '1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + 6 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}', + 'ExampleNumber' => '212345678', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}', + 'ExampleNumber' => '412345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '180(?:0\\d{3}|2)\\d{3}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '190[0-26]\\d{6}', + 'ExampleNumber' => '1900123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}', + 'ExampleNumber' => '1300123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 10, + 3 => 12, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}', + 'ExampleNumber' => '147101234', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '163\\d{2,6}', + 'ExampleNumber' => '1631234', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '1(?:3(?:00\\d{5}|45[0-4])|802)\\d{3}|1[38]00\\d{6}|13\\d{4}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 10, + 4 => 12, + ], + ], + 'id' => 'AU', + 'countryCode' => 61, + 'internationalPrefix' => '001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011', + 'preferredInternationalPrefix' => '0011', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '(183[12])|0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '16', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '13', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '19', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '180', + 1 => '1802', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '19', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '16', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '14|4', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2378]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '$CC ($1)', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:30|[89])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{4})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '130', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '16', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '16', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '14|4', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2378]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '$CC ($1)', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:30|[89])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AW.php new file mode 100644 index 00000000000..530fb2cf5f1 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AW.php @@ -0,0 +1,106 @@ + + [ + 'NationalNumberPattern' => '(?:[25-79]\\d\\d|800)\\d{4}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '5(?:2\\d|8[1-9])\\d{4}', + 'ExampleNumber' => '5212345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:290|5[69]\\d|6(?:[03]0|22|4[0-2]|[69]\\d)|7(?:[34]\\d|7[07])|9(?:6[45]|9[4-8]))\\d{4}', + 'ExampleNumber' => '5601234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4}', + 'ExampleNumber' => '8001234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{4}', + 'ExampleNumber' => '9001234', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:28\\d|501)\\d{4}', + 'ExampleNumber' => '5011234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AW', + 'countryCode' => 297, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[25-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AX.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AX.php new file mode 100644 index 00000000000..fcacbf7c41a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AX.php @@ -0,0 +1,131 @@ + + [ + 'NationalNumberPattern' => '2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + 6 => 11, + 7 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '18[1-8]\\d{3,6}', + 'ExampleNumber' => '181234567', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}', + 'ExampleNumber' => '412345678', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4,6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '[67]00\\d{5,6}', + 'ExampleNumber' => '600123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}', + 'ExampleNumber' => '10112345', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AX', + 'countryCode' => 358, + 'internationalPrefix' => '00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '18', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AZ.php new file mode 100644 index 00000000000..1dce3d30184 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_AZ.php @@ -0,0 +1,197 @@ + + [ + 'NationalNumberPattern' => '365\\d{6}|(?:[124579]\\d|60|88)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[12]428|3655[02])\\d{4}|(?:2(?:22[0-79]|63[0-28])|3654)\\d{5}|(?:(?:1[28]|46)\\d|2(?:[014-6]2|[23]3))\\d{6}', + 'ExampleNumber' => '123123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '36554\\d{4}|(?:[16]0|4[04]|5[015]|7[07]|99)\\d{7}', + 'ExampleNumber' => '401234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '88\\d{7}', + 'ExampleNumber' => '881234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900200\\d{3}', + 'ExampleNumber' => '900200123', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'AZ', + 'countryCode' => 994, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '90', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1[28]|2|365|46', + 1 => '1[28]|2|365[45]|46', + 2 => '1[28]|2|365(?:4|5[02])|46', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[13-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '90', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1[28]|2|365|46', + 1 => '1[28]|2|365[45]|46', + 2 => '1[28]|2|365(?:4|5[02])|46', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[13-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BA.php new file mode 100644 index 00000000000..2802898bc5a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BA.php @@ -0,0 +1,210 @@ + + [ + 'NationalNumberPattern' => '6\\d{8}|(?:[35689]\\d|49|70)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3(?:[05-79][2-9]|1[4579]|[23][24-9]|4[2-4689]|8[2457-9])|49[2-579]|5(?:0[2-49]|[13][2-9]|[268][2-4679]|4[4689]|5[2-79]|7[2-69]|9[2-4689]))\\d{5}', + 'ExampleNumber' => '30212345', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6040\\d{5}|6(?:03|[1-356]|44|7\\d)\\d{6}', + 'ExampleNumber' => '61123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8[08]\\d{6}', + 'ExampleNumber' => '80123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9[0246]\\d{6}', + 'ExampleNumber' => '90123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8[12]\\d{6}', + 'ExampleNumber' => '82123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '703[235]0\\d{3}|70(?:2[0-5]|3[0146]|[56]0)\\d{4}', + 'ExampleNumber' => '70341234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BA', + 'countryCode' => 387, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6[1-3]|[7-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-5]|6[56]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6[1-3]|[7-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-5]|6[56]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BB.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BB.php new file mode 100644 index 00000000000..bf35c00a794 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BB.php @@ -0,0 +1,118 @@ + + [ + 'NationalNumberPattern' => '(?:246|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '246521[0369]\\d{3}|246(?:2(?:2[78]|7[0-4])|4(?:1[024-6]|2\\d|3[2-9])|5(?:20|[34]\\d|54|7[1-3])|6(?:2\\d|38)|7[35]7|9(?:1[89]|63))\\d{4}', + 'ExampleNumber' => '2464123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '246(?:(?:2(?:[3568]\\d|4[0-57-9])|3(?:5[2-9]|6[0-6])|4(?:46|5\\d)|69[5-7]|8(?:[2-5]\\d|83))\\d|52(?:1[147]|20))\\d{3}', + 'ExampleNumber' => '2462501234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:246976|900[2-9]\\d\\d)\\d{4}', + 'ExampleNumber' => '9002123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'NationalNumberPattern' => '24631\\d{5}', + 'ExampleNumber' => '2463101234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '246(?:292|367|4(?:1[7-9]|3[01]|4[47-9]|67)|7(?:1[2-9]|2\\d|3[016]|53))\\d{4}', + 'ExampleNumber' => '2464301234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BB', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-9]\\d{6})$|1', + 'nationalPrefixTransformRule' => '246$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '246', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BD.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BD.php new file mode 100644 index 00000000000..9e9711ae196 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BD.php @@ -0,0 +1,162 @@ + + [ + 'NationalNumberPattern' => '[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:4(?:31\\d\\d|423)|5222)\\d{3}(?:\\d{2})?|8332[6-9]\\d\\d|(?:3(?:03[56]|224)|4(?:22[25]|653))\\d{3,4}|(?:3(?:42[47]|529|823)|4(?:027|525|65(?:28|8))|562|6257|7(?:1(?:5[3-5]|6[12]|7[156]|89)|22[589]56|32|42675|52(?:[25689](?:56|8)|[347]8)|71(?:6[1267]|75|89)|92374)|82(?:2[59]|32)56|9(?:03[23]56|23(?:256|373)|31|5(?:1|2[4589]56)))\\d{3}|(?:3(?:02[348]|22[35]|324|422)|4(?:22[67]|32[236-9]|6(?:2[46]|5[57])|953)|5526|6(?:024|6655)|81)\\d{4,5}|(?:2(?:7(?:1[0-267]|2[0-289]|3[0-29]|4[01]|5[1-3]|6[013]|7[0178]|91)|8(?:0[125]|1[1-6]|2[0157-9]|3[1-69]|41|6[1-35]|7[1-5]|8[1-8]|9[0-6])|9(?:0[0-2]|1[0-4]|2[568]|3[3-6]|5[5-7]|6[0136-9]|7[0-7]|8[014-9]))|3(?:0(?:2[025-79]|3[2-4])|181|22[12]|32[2356]|824)|4(?:02[09]|22[348]|32[045]|523|6(?:27|54))|666(?:22|53)|7(?:22[57-9]|42[56]|82[35])8|8(?:0[124-9]|2(?:181|2[02-4679]8)|4[12]|[5-7]2)|9(?:[04]2|2(?:2|328)|81))\\d{4}|(?:2(?:222|[45]\\d)\\d|3(?:1(?:2[5-7]|[5-7])|425|822)|4(?:033|1\\d|[257]1|332|4(?:2[246]|5[25])|6(?:2[35]|56|62)|8(?:23|54)|92[2-5])|5(?:02[03489]|22[457]|32[35-79]|42[46]|6(?:[18]|53)|724|826)|6(?:023|2(?:2[2-5]|5[3-5]|8)|32[3478]|42[34]|52[47]|6(?:[18]|6(?:2[34]|5[24]))|[78]2[2-5]|92[2-6])|7(?:02|21\\d|[3-589]1|6[12]|72[24])|8(?:217|3[12]|[5-7]1)|9[24]1)\\d{5}|(?:(?:3[2-8]|5[2-57-9]|6[03-589])1|4[4689][18])\\d{5}|[59]1\\d{5}', + 'ExampleNumber' => '27111234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:1[13-9]\\d|644)\\d{7}|(?:3[78]|44|66)[02-9]\\d{7}', + 'ExampleNumber' => '1812345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[03]\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '96(?:0[469]|1[0-47]|3[389]|43|6[69]|7[78])\\d{6}', + 'ExampleNumber' => '9604123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BD', + 'countryCode' => 880, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{4,6})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '31[5-8]|[459]1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3,7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{3,6})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[13-9]|22', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{7,8})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BE.php new file mode 100644 index 00000000000..9d156b5efd9 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BE.php @@ -0,0 +1,167 @@ + + [ + 'NationalNumberPattern' => '4\\d{8}|[1-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '80[2-8]\\d{5}|(?:1[0-69]|[23][2-8]|4[23]|5\\d|6[013-57-9]|71|8[1-79]|9[2-4])\\d{6}', + 'ExampleNumber' => '12345678', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4[5-9]\\d{7}', + 'ExampleNumber' => '470123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800[1-9]\\d{4}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:70(?:2[0-57]|3[04-7]|44|6[4-69]|7[0579])|90\\d\\d)\\d{4}', + 'ExampleNumber' => '90012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '7879\\d{4}', + 'ExampleNumber' => '78791234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '78(?:0[57]|1[014-8]|2[25]|3[15-8]|48|[56]0|7[06-8]|9\\d)\\d{4}', + 'ExampleNumber' => '78102345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BE', + 'countryCode' => 32, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:80|9)0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[239]|4[23]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[15-8]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '4', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BF.php new file mode 100644 index 00000000000..64a6be59ef3 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BF.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '[025-7]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:0(?:49|5[23]|6[5-7]|9[016-9])|4(?:4[569]|5[4-6]|6[5-7]|7[0179])|5(?:[34]\\d|50|6[5-7]))\\d{4}', + 'ExampleNumber' => '20491234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:0[1-35-7]|5[0-8]|[67]\\d)\\d{6}', + 'ExampleNumber' => '70123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BF', + 'countryCode' => 226, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[025-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BG.php new file mode 100644 index 00000000000..708a6da534c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BG.php @@ -0,0 +1,341 @@ + + [ + 'NationalNumberPattern' => '00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 12, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2\\d{5,7}|(?:43[1-6]|70[1-9])\\d{4,5}|(?:[36]\\d|4[124-7]|[57][1-9]|8[1-6]|9[1-7])\\d{5,6}', + 'ExampleNumber' => '2123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:43[07-9]|99[69]\\d)\\d{5}|(?:8[7-9]|98)\\d{7}', + 'ExampleNumber' => '43012345', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:00800\\d\\d|800)\\d{5}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + 1 => 12, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90\\d{6}', + 'ExampleNumber' => '90123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '700\\d{5}', + 'ExampleNumber' => '70012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BG', + 'countryCode' => 359, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d)(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '43[1-6]|70[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:70|8)0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '43[1-7]|7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[48]|9[08]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d)(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '43[1-6]|70[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:70|8)0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '43[1-7]|7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[48]|9[08]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BH.php new file mode 100644 index 00000000000..a938ef413d3 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BH.php @@ -0,0 +1,106 @@ + + [ + 'NationalNumberPattern' => '[136-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:3[1356]|6[0156]|7\\d)\\d|6(?:1[16]\\d|500|6(?:0\\d|3[12]|44|55|7[7-9]|88)|9[69][69])|7(?:[07]\\d\\d|1(?:11|78)))\\d{4}', + 'ExampleNumber' => '17001234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:3(?:[0-79]\\d|8[0-57-9])\\d|6(?:3(?:00|33|6[16])|441|6(?:3[03-9]|[69]\\d|7[0-689])))\\d{4}', + 'ExampleNumber' => '36001234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8[02369]\\d{6}', + 'ExampleNumber' => '80123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:87|9[0-8])\\d{6}', + 'ExampleNumber' => '90123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '84\\d{6}', + 'ExampleNumber' => '84123456', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BH', + 'countryCode' => 973, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[13679]|8[02-4679]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BI.php new file mode 100644 index 00000000000..69aca845038 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BI.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:[267]\\d|31)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:22|31)\\d{6}', + 'ExampleNumber' => '22201234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:29|[67][125-9])\\d{6}', + 'ExampleNumber' => '79561234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BI', + 'countryCode' => 257, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2367]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BJ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BJ.php new file mode 100644 index 00000000000..67c583a5f4c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BJ.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '[24-689]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:02|1[037]|2[45]|3[68]|4\\d)\\d{5}', + 'ExampleNumber' => '20211234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:4[0-7]|[56]\\d|9[013-9])\\d{6}', + 'ExampleNumber' => '90011234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '857[58]\\d{4}', + 'ExampleNumber' => '85751234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '81\\d{6}', + 'ExampleNumber' => '81123456', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BJ', + 'countryCode' => 229, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[24-689]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BL.php new file mode 100644 index 00000000000..0e1b823142a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BL.php @@ -0,0 +1,98 @@ + + [ + 'NationalNumberPattern' => '590\\d{6}|(?:69|80|9\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}', + 'ExampleNumber' => '590271234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}', + 'ExampleNumber' => '690001234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}', + 'ExampleNumber' => '976012345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BL', + 'countryCode' => 590, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BM.php new file mode 100644 index 00000000000..787a63dccda --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BM.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:441|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '441(?:[46]\\d\\d|5(?:4\\d|60|89))\\d{4}', + 'ExampleNumber' => '4414123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '441(?:[2378]\\d|5[0-39]|9[02])\\d{5}', + 'ExampleNumber' => '4413701234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BM', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-9]\\d{6})$|1', + 'nationalPrefixTransformRule' => '441$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '441', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BN.php new file mode 100644 index 00000000000..247db22813e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BN.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '[2-578]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '22[0-7]\\d{4}|(?:2[013-9]|[34]\\d|5[0-25-9])\\d{5}', + 'ExampleNumber' => '2345678', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:22[89]|[78]\\d\\d)\\d{4}', + 'ExampleNumber' => '7123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '5[34]\\d{5}', + 'ExampleNumber' => '5345678', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BN', + 'countryCode' => 673, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-578]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BO.php new file mode 100644 index 00000000000..51b31961c69 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BO.php @@ -0,0 +1,158 @@ + + [ + 'NationalNumberPattern' => '(?:[2-467]\\d\\d|8001)\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:2\\d\\d|5(?:11|[258]\\d|9[67])|6(?:12|2\\d|9[34])|8(?:2[34]|39|62))|3(?:3\\d\\d|4(?:6\\d|8[24])|8(?:25|42|5[257]|86|9[25])|9(?:[27]\\d|3[2-4]|4[248]|5[24]|6[2-6]))|4(?:4\\d\\d|6(?:11|[24689]\\d|72)))\\d{4}', + 'ExampleNumber' => '22123456', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[67]\\d{7}', + 'ExampleNumber' => '71234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8001[07]\\d{4}', + 'ExampleNumber' => '800171234', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '8001[07]\\d{4}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'id' => 'BO', + 'countryCode' => 591, + 'internationalPrefix' => '00(?:1\\d)?', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0(1\\d)?', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[23]|4[46]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '0$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{8})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '[67]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '0$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '0$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BQ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BQ.php new file mode 100644 index 00000000000..6d6bb944d47 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BQ.php @@ -0,0 +1,101 @@ + + [ + 'NationalNumberPattern' => '(?:[34]1|7\\d)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:318[023]|41(?:6[023]|70)|7(?:1[578]|2[05]|50)\\d)\\d{3}', + 'ExampleNumber' => '7151234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:31(?:8[14-8]|9[14578])|416[14-9]|7(?:0[01]|7[07]|8\\d|9[056])\\d)\\d{3}', + 'ExampleNumber' => '3181234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BQ', + 'countryCode' => 599, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '[347]', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BR.php new file mode 100644 index 00000000000..c87e70b3d3e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BR.php @@ -0,0 +1,274 @@ + + [ + 'NationalNumberPattern' => '(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}', + 'ExampleNumber' => '1123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])(?:7|9\\d)\\d{7}', + 'ExampleNumber' => '11961234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6,7}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '300\\d{6}|[59]00\\d{6,7}', + 'ExampleNumber' => '300123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '(?:30[03]\\d{3}|4(?:0(?:0\\d|20)|370))\\d{4}|300\\d{5}', + 'ExampleNumber' => '40041234', + 'PossibleLength' => + [ + 0 => 8, + 1 => 10, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '30(?:0\\d{5,7}|3\\d{7})|40(?:0\\d|20)\\d{4}|800\\d{6,7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + ], + 'id' => 'BR', + 'countryCode' => 55, + 'internationalPrefix' => '00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?', + 'nationalPrefixTransformRule' => '$2', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3,6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:1[25-8]|2[357-9]|3[02-68]|4[12568]|5|6[0-8]|8[015]|9[0-47-9])|321|610', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '300|4(?:0[02]|37)', + 1 => '4(?:02|37)0|[34]00', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-57]', + 1 => '[2357]|4(?:[0-24-9]|3(?:[0-689]|7[1-9]))', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{2,3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:[358]|90)0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{5})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '0 $CC ($1)', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{5})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[16][1-9]|[2-57-9]', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '0 $CC ($1)', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '300|4(?:0[02]|37)', + 1 => '4(?:02|37)0|[34]00', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2,3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:[358]|90)0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '0 $CC ($1)', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{5})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[16][1-9]|[2-57-9]', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '0 $CC ($1)', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BS.php new file mode 100644 index 00000000000..8cbc54b7a45 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BS.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:242|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[347]|8[0-4]|9[2-467])|461|502|6(?:0[1-5]|12|2[013]|[45]0|7[67]|8[78]|9[89])|7(?:02|88))\\d{4}', + 'ExampleNumber' => '2423456789', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '242(?:3(?:5[79]|7[56]|95)|4(?:[23][1-9]|4[1-35-9]|5[1-8]|6[2-8]|7\\d|81)|5(?:2[45]|3[35]|44|5[1-46-9]|65|77)|6[34]6|7(?:27|38)|8(?:0[1-9]|1[02-9]|2\\d|3[0-4]|[89]9))\\d{4}', + 'ExampleNumber' => '2423591234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '242300\\d{4}|8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '242225\\d{4}', + 'ExampleNumber' => '2422250123', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BS', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([3-8]\\d{6})$|1', + 'nationalPrefixTransformRule' => '242$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '242', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BT.php new file mode 100644 index 00000000000..6f00650bf3e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BT.php @@ -0,0 +1,180 @@ + + [ + 'NationalNumberPattern' => '[17]\\d{7}|[2-8]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[3-6]|[34][5-7]|5[236]|6[2-46]|7[246]|8[2-4])\\d{5}', + 'ExampleNumber' => '2345678', + 'PossibleLength' => + [ + 0 => 7, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:1[67]|77)\\d{6}', + 'ExampleNumber' => '17123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BT', + 'countryCode' => 975, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-68]|7[246]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1[67]|7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-68]|7[246]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1[67]|7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BW.php new file mode 100644 index 00000000000..d4770bc2654 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BW.php @@ -0,0 +1,176 @@ + + [ + 'NationalNumberPattern' => '(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:4[0-48]|6[0-24]|9[0578])|3(?:1[0-35-9]|55|[69]\\d|7[013]|81)|4(?:6[03]|7[1267]|9[0-5])|5(?:3[03489]|4[0489]|7[1-47]|88|9[0-49])|6(?:2[1-35]|5[149]|8[067]))\\d{4}', + 'ExampleNumber' => '2401234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:321|7[1-8]\\d)\\d{5}', + 'ExampleNumber' => '71123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:0800|800\\d)\\d{6}', + 'ExampleNumber' => '0800012345', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90\\d{5}', + 'ExampleNumber' => '9012345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '79(?:1(?:[01]\\d|2[0-8])|2[0-7]\\d)\\d{3}', + 'ExampleNumber' => '79101234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BW', + 'countryCode' => 267, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '90', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[24-6]|3[15-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[37]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BY.php new file mode 100644 index 00000000000..2c1a4c16e28 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BY.php @@ -0,0 +1,198 @@ + + [ + 'NationalNumberPattern' => '(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:5(?:1[1-5]|[24]\\d|6[2-4]|9[1-7])|6(?:[235]\\d|4[1-7])|7\\d\\d)|2(?:1(?:[246]\\d|3[0-35-9]|5[1-9])|2(?:[235]\\d|4[0-8])|3(?:[26]\\d|3[02-79]|4[024-7]|5[03-7])))\\d{5}', + 'ExampleNumber' => '152450911', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:2(?:5[5-79]|9[1-9])|(?:33|44)\\d)\\d{6}', + 'ExampleNumber' => '294911911', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{3,7}|8(?:0[13]|20\\d)\\d{7}', + 'ExampleNumber' => '8011234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:810|902)\\d{7}', + 'ExampleNumber' => '9021234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '249\\d{6}', + 'ExampleNumber' => '249123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '800\\d{3,7}|(?:8(?:0[13]|10|20\\d)|902)\\d{7}', + ], + 'id' => 'BY', + 'countryCode' => 375, + 'internationalPrefix' => '810', + 'preferredInternationalPrefix' => '8~10', + 'nationalPrefix' => '8', + 'nationalPrefixForParsing' => '0|80?', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '800', + ], + 'nationalPrefixFormattingRule' => '8 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '800', + ], + 'nationalPrefixFormattingRule' => '8 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{3})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])', + 1 => '1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])', + ], + 'nationalPrefixFormattingRule' => '8 0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:[56]|7[467])|2[1-3]', + ], + 'nationalPrefixFormattingRule' => '8 0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '[1-4]', + ], + 'nationalPrefixFormattingRule' => '8 0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '8 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BZ.php new file mode 100644 index 00000000000..39815fa6750 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_BZ.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '(?:0800\\d|[2-8])\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:[02]\\d|36|[68]0)|[3-58](?:[02]\\d|[68]0)|7(?:[02]\\d|32|[68]0))\\d{4}', + 'ExampleNumber' => '2221234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6[0-35-7]\\d{5}', + 'ExampleNumber' => '6221234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '0800\\d{7}', + 'ExampleNumber' => '08001234123', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'BZ', + 'countryCode' => 501, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-8]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})(\\d{3})', + 'format' => '$1-$2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CA.php new file mode 100644 index 00000000000..d5e5bfbf729 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CA.php @@ -0,0 +1,129 @@ + + [ + 'NationalNumberPattern' => '(?:[2-8]\\d|90)\\d{8}|3\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}', + 'ExampleNumber' => '5062345678', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}', + 'ExampleNumber' => '5062345678', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '600[2-9]\\d{6}', + 'ExampleNumber' => '6002012345', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '310\\d{4}', + 'ExampleNumber' => '3101234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CA', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '1', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CC.php new file mode 100644 index 00000000000..a8a87787557 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CC.php @@ -0,0 +1,133 @@ + + [ + 'NationalNumberPattern' => '1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}', + 'ExampleNumber' => '891621234', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}', + 'ExampleNumber' => '412345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '180(?:0\\d{3}|2)\\d{3}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '190[0-26]\\d{6}', + 'ExampleNumber' => '1900123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}', + 'ExampleNumber' => '1300123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 10, + 3 => 12, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}', + 'ExampleNumber' => '147101234', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CC', + 'countryCode' => 61, + 'internationalPrefix' => '001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011', + 'preferredInternationalPrefix' => '0011', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '([59]\\d{7})$|0', + 'nationalPrefixTransformRule' => '8$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CD.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CD.php new file mode 100644 index 00000000000..d3b9df3bd07 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CD.php @@ -0,0 +1,151 @@ + + [ + 'NationalNumberPattern' => '[189]\\d{8}|[1-68]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '12\\d{7}|[1-6]\\d{6}', + 'ExampleNumber' => '1234567', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '88\\d{5}|(?:8[0-59]|9[017-9])\\d{7}', + 'ExampleNumber' => '991234567', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CD', + 'countryCode' => 243, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '88', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CF.php new file mode 100644 index 00000000000..6358bd675d1 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CF.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[27]\\d{3}|8776)\\d{4}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2[12]\\d{6}', + 'ExampleNumber' => '21612345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[024-7]\\d{6}', + 'ExampleNumber' => '70012345', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '8776\\d{4}', + 'ExampleNumber' => '87761234', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CF', + 'countryCode' => 236, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[278]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CG.php new file mode 100644 index 00000000000..52eae883d6b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CG.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '222\\d{6}|(?:0\\d|80)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '222[1-589]\\d{5}', + 'ExampleNumber' => '222123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '026(?:1[0-5]|6[6-9])\\d{4}|0(?:[14-6]\\d\\d|2(?:40|5[5-8]|6[07-9]))\\d{5}', + 'ExampleNumber' => '061234567', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '80[0-2]\\d{6}', + 'ExampleNumber' => '800123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CG', + 'countryCode' => 242, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[02]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CH.php new file mode 100644 index 00000000000..3f475f7160c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CH.php @@ -0,0 +1,161 @@ + + [ + 'NationalNumberPattern' => '8\\d{11}|[2-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[12467]|3[1-4]|4[134]|5[256]|6[12]|[7-9]1)\\d{7}', + 'ExampleNumber' => '212345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[35-9]\\d{7}', + 'ExampleNumber' => '781234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[016]\\d{6}', + 'ExampleNumber' => '900123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '84[0248]\\d{6}', + 'ExampleNumber' => '840123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '878\\d{6}', + 'ExampleNumber' => '878123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '74[0248]\\d{6}', + 'ExampleNumber' => '740123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '5[18]\\d{7}', + 'ExampleNumber' => '581234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '860\\d{9}', + 'ExampleNumber' => '860123456789', + 'PossibleLength' => + [ + 0 => 12, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CH', + 'countryCode' => 41, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8[047]|90', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2-79]|81', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CI.php new file mode 100644 index 00000000000..dc59b1b55a9 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CI.php @@ -0,0 +1,124 @@ + + [ + 'NationalNumberPattern' => '[02]\\d{9}', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:[15]\\d{3}|7(?:2(?:0[23]|1[2357]|2[245]|3[45]|4[3-5])|3(?:06|1[69]|[2-6]7)))\\d{5}', + 'ExampleNumber' => '2123456789', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '0[157]\\d{8}', + 'ExampleNumber' => '0123456789', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CI', + 'countryCode' => 225, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d)(\\d{5})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CK.php new file mode 100644 index 00000000000..a33da304e75 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CK.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '[2-578]\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2\\d|3[13-7]|4[1-5])\\d{3}', + 'ExampleNumber' => '21234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[578]\\d{4}', + 'ExampleNumber' => '71234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CK', + 'countryCode' => 682, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-578]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CL.php new file mode 100644 index 00000000000..800ad1d9546 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CL.php @@ -0,0 +1,329 @@ + + [ + 'NationalNumberPattern' => '12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + 2 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:1982[0-6]|3314[05-9])\\d{3}|(?:2(?:1(?:160|962)|3(?:2\\d\\d|3(?:[03467]\\d|1[0-35-9]|2[1-9]|5[0-24-9]|8[0-3])|600)|646[59])|80[1-9]\\d\\d|9(?:3(?:[0-57-9]\\d\\d|6(?:0[02-9]|[1-9]\\d))|6(?:[0-8]\\d\\d|9(?:[02-79]\\d|1[05-9]))|7[1-9]\\d\\d|9(?:[03-9]\\d\\d|1(?:[0235-9]\\d|4[0-24-9])|2(?:[0-79]\\d|8[0-46-9]))))\\d{4}|(?:22|3[2-5]|[47][1-35]|5[1-3578]|6[13-57]|8[1-9]|9[2458])\\d{7}', + 'ExampleNumber' => '221234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '2(?:1982[0-6]|3314[05-9])\\d{3}|(?:2(?:1(?:160|962)|3(?:2\\d\\d|3(?:[03467]\\d|1[0-35-9]|2[1-9]|5[0-24-9]|8[0-3])|600)|646[59])|80[1-9]\\d\\d|9(?:3(?:[0-57-9]\\d\\d|6(?:0[02-9]|[1-9]\\d))|6(?:[0-8]\\d\\d|9(?:[02-79]\\d|1[05-9]))|7[1-9]\\d\\d|9(?:[03-9]\\d\\d|1(?:[0235-9]\\d|4[0-24-9])|2(?:[0-79]\\d|8[0-46-9]))))\\d{4}|(?:22|3[2-5]|[47][1-35]|5[1-3578]|6[13-57]|8[1-9]|9[2458])\\d{7}', + 'ExampleNumber' => '221234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:123|8)00\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '600\\d{7,8}', + 'ExampleNumber' => '6001234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '44\\d{7}', + 'ExampleNumber' => '441234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '600\\d{7,8}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'id' => 'CL', + 'countryCode' => 56, + 'internationalPrefix' => '(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:[03-589]|21)|[29]0|78', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{5})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '219', + 1 => '2196', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '44', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2[1-36]', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '60|8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '60', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '219', + 1 => '2196', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '44', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2[1-36]', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '60|8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '60', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CM.php new file mode 100644 index 00000000000..ca5a4c66d09 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CM.php @@ -0,0 +1,131 @@ + + [ + 'NationalNumberPattern' => '[26]\\d{8}|88\\d{6,7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:22|33)\\d{6}', + 'ExampleNumber' => '222123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:24[23]|6[25-9]\\d)\\d{6}', + 'ExampleNumber' => '671234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '88\\d{6,7}', + 'ExampleNumber' => '88012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CM', + 'countryCode' => 237, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '88', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '[26]|88', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CN.php new file mode 100644 index 00000000000..297f130b180 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CN.php @@ -0,0 +1,459 @@ + + [ + 'NationalNumberPattern' => '1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:10(?:[02-79]\\d\\d|[18](?:0[1-9]|[1-9]\\d))|21(?:[18](?:0[1-9]|[1-9]\\d)|[2-79]\\d\\d))\\d{5}|(?:43[35]|754)\\d{7,8}|8(?:078\\d{7}|51\\d{7,8})|(?:10|(?:2|85)1|43[35]|754)(?:100\\d\\d|95\\d{3,4})|(?:2[02-57-9]|3(?:11|7[179])|4(?:[15]1|3[12])|5(?:1\\d|2[37]|3[12]|51|7[13-79]|9[15])|7(?:[39]1|5[57]|6[09])|8(?:71|98))(?:[02-8]\\d{7}|1(?:0(?:0\\d\\d(?:\\d{3})?|[1-9]\\d{5})|[1-9]\\d{6})|9(?:[0-46-9]\\d{6}|5\\d{3}(?:\\d(?:\\d{2})?)?))|(?:3(?:1[02-9]|35|49|5\\d|7[02-68]|9[1-68])|4(?:1[02-9]|2[179]|3[46-9]|5[2-9]|6[47-9]|7\\d|8[23])|5(?:3[03-9]|4[36]|5[02-9]|6[1-46]|7[028]|80|9[2-46-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[17]\\d|2[248]|3[04-9]|4[3-6]|5[0-3689]|6[2368]|9[02-9])|8(?:1[236-8]|2[5-7]|3\\d|5[2-9]|7[02-9]|8[36-8]|9[1-7])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:[02-8]\\d{6}|1(?:0(?:0\\d\\d(?:\\d{2})?|[1-9]\\d{4})|[1-9]\\d{5})|9(?:[0-46-9]\\d{5}|5\\d{3,5}))', + 'ExampleNumber' => '1012345678', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '1740[0-5]\\d{6}|1(?:[38]\\d|4[57]|[59][0-35-9]|6[25-7]|7[0-35-8])\\d{8}', + 'ExampleNumber' => '13123456789', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:(?:10|21)8|8)00\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 12, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '16[08]\\d{5}', + 'ExampleNumber' => '16812345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '10(?:10\\d{4}|96\\d{3,4})|400\\d{7}|950\\d{7,8}|(?:2[0-57-9]|3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))96\\d{3,4}', + 'ExampleNumber' => '4001234567', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '(?:(?:10|21)8|[48])00\\d{7}|950\\d{7,8}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + 2 => 12, + ], + ], + 'id' => 'CN', + 'countryCode' => 86, + 'internationalPrefix' => '00|1(?:[12]\\d|79)\\d\\d00', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '(1(?:[12]\\d|79)\\d\\d)|0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5,6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '10|96', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:10|2[0-57-9])[19]', + 1 => '(?:10|2[0-57-9])(?:10|9[56])', + 2 => '10(?:10|9[56])|2[0-57-9](?:100|9[56])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + 1 => '1[1-9]|26|[3-9]|(?:10|2[0-57-9])(?:[0-8]|9[0-47-9])', + 2 => '1(?:0(?:[0-8]|9[0-47-9])|[1-9])|2(?:[0-57-9](?:[02-8]|1(?:0[1-9]|[1-9])|9[0-47-9])|6)|[3-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '16[08]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]', + 1 => '(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]', + 2 => '85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])', + 3 => '85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + 1 => '1(?:0(?:[02-8]|1[1-9]|9[0-47-9])|[1-9])|2(?:[0-57-9](?:[0-8]|9[0-47-9])|6)|[3-9]', + 2 => '1(?:0(?:[02-8]|1[1-9]|9[0-47-9])|[1-9])|26|3(?:[0268]|4[0-8]|9[079])|4(?:[049]|2[02-68]|[35]0|6[0-356]|8[014-9])|5(?:0|2[0-24-689]|4[0-2457-9]|6[057-9]|8[1-9]|90)|6(?:[0-24578]|3[06-9]|6[14-79]|9[03-9])|7(?:0[02-9]|2[0135-79]|3[23]|4[0-27-9]|6[1457]|8)|8(?:[046]|1[01459]|2[0-489]|5(?:0|[23][0-8])|8[0-2459]|9[09])|9(?:0[0457]|1[08]|[268]|4[024-9]|5[06-9])|(?:33|85[23]9)[0-46-9]|(?:2[0-57-9]|3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:[0-8]|9[0-47-9])', + 3 => '1(?:0[02-8]|[1-9])|2(?:[0-57-9][0-8]|6)|3(?:[0268]|3[0-46-9]|4[0-8]|9[079])|4(?:[049]|2[02-68]|[35]0|6[0-356]|8[014-9])|5(?:0|2[0-24-689]|4[0-2457-9]|6[057-9]|90)|6(?:[0-24578]|3[06-9]|6[14-79]|9[03-9])|7(?:0[02-9]|2[0135-79]|3[23]|4[0-27-9]|6[1457]|8)|8(?:[046]|1[01459]|2[0-489]|5(?:0|[23](?:[02-8]|1[1-9]|9[0-46-9]))|8[0-2459]|9[09])|9(?:0[0457]|1[08]|[268]|4[024-9]|5[06-9])|(?:10|2[0-57-9])9[0-47-9]|(?:101|58|85[23]10)[1-9]|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:[02-8]|1(?:0[1-9]|[1-9])|9[0-47-9])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:4|80)0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '10|2(?:[02-57-9]|1[1-9])', + 1 => '10|2(?:[02-57-9]|1[1-9])', + 2 => '10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 9 => + [ + 'pattern' => '(\\d{3})(\\d{7,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 11 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-578]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 12 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[3-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 13 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[12]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:10|2[0-57-9])[19]', + 1 => '(?:10|2[0-57-9])(?:10|9[56])', + 2 => '10(?:10|9[56])|2[0-57-9](?:100|9[56])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]', + 1 => '(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]', + 2 => '85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])', + 3 => '85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:4|80)0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '10|2(?:[02-57-9]|1[1-9])', + 1 => '10|2(?:[02-57-9]|1[1-9])', + 2 => '10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{7,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-578]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[3-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[12]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CO.php new file mode 100644 index 00000000000..08670f0707f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CO.php @@ -0,0 +1,195 @@ + + [ + 'NationalNumberPattern' => '(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '601055(?:[0-4]\\d|50)\\d\\d|6010(?:[0-4]\\d|5[0-4])\\d{4}|60(?:[124-7][2-9]|8[1-9])\\d{6}', + 'ExampleNumber' => '6012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '333301[0-5]\\d{3}|3333(?:00|2[5-9]|[3-9]\\d)\\d{4}|(?:3(?:24[1-9]|3(?:00|3[0-24-9]))|9101)\\d{6}|3(?:0[0-5]|1\\d|2[0-3]|5[01]|70)\\d{7}', + 'ExampleNumber' => '3211234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800\\d{7}', + 'ExampleNumber' => '18001234567', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '19(?:0[01]|4[78])\\d{7}', + 'ExampleNumber' => '19001234567', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CO', + 'countryCode' => 57, + 'internationalPrefix' => '00(?:4(?:[14]4|56)|[579])', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0([3579]|4(?:[14]4|56))?', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '0$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3[0-357]|91', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '0$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{7})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '($1)', + 'domesticCarrierCodeFormattingRule' => '0$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3[0-357]|91', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '0$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{7})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CR.php new file mode 100644 index 00000000000..f885600bd30 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CR.php @@ -0,0 +1,140 @@ + + [ + 'NationalNumberPattern' => '(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '210[7-9]\\d{4}|2(?:[024-7]\\d|1[1-9])\\d{5}', + 'ExampleNumber' => '22123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:3005\\d|6500[01])\\d{3}|(?:5[07]|6[0-4]|7[0-3]|8[3-9])\\d{6}', + 'ExampleNumber' => '83123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[059]\\d{7}', + 'ExampleNumber' => '9001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:210[0-6]|4\\d{3}|5100)\\d{4}', + 'ExampleNumber' => '40001234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CR', + 'countryCode' => 506, + 'internationalPrefix' => '00', + 'nationalPrefixForParsing' => '(19(?:0[0-2468]|1[09]|20|66|77|99))', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]|8[3-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CU.php new file mode 100644 index 00000000000..187a64e7c6a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CU.php @@ -0,0 +1,171 @@ + + [ + 'NationalNumberPattern' => '[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3[23]|4[89])\\d{4,6}|(?:31|4[36]|8(?:0[25]|78)\\d)\\d{6}|(?:2[1-4]|4[1257]|7\\d)\\d{5,6}', + 'ExampleNumber' => '71234567', + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5\\d|63)\\d{6}', + 'ExampleNumber' => '51234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '807\\d{7}', + 'ExampleNumber' => '8071234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CU', + 'countryCode' => 53, + 'internationalPrefix' => '119', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{4,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2[1-4]|[34]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{6,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[56]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CV.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CV.php new file mode 100644 index 00000000000..b982ed72c2a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CV.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '(?:[2-59]\\d\\d|800)\\d{4}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:2[1-7]|3[0-8]|4[12]|5[1256]|6\\d|7[1-3]|8[1-5])\\d{4}', + 'ExampleNumber' => '2211234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:36|5[1-389]|9\\d)\\d{5}', + 'ExampleNumber' => '9911234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4}', + 'ExampleNumber' => '8001234', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:3[3-5]|4[356])\\d{5}', + 'ExampleNumber' => '3401234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CV', + 'countryCode' => 238, + 'internationalPrefix' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-589]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CW.php new file mode 100644 index 00000000000..6c31aab9ae8 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CW.php @@ -0,0 +1,130 @@ + + [ + 'NationalNumberPattern' => '(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '9(?:4(?:3[0-5]|4[14]|6\\d)|50\\d|7(?:2[014]|3[02-9]|4[4-9]|6[357]|77|8[7-9])|8(?:3[39]|[46]\\d|7[01]|8[57-9]))\\d{4}', + 'ExampleNumber' => '94351234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '953[01]\\d{4}|9(?:5[12467]|6[5-9])\\d{5}', + 'ExampleNumber' => '95181234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '60[0-2]\\d{4}', + 'ExampleNumber' => '6001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '955\\d{5}', + 'ExampleNumber' => '95581234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CW', + 'countryCode' => 599, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[3467]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9[4-8]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'leadingDigits' => '[69]', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CX.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CX.php new file mode 100644 index 00000000000..288785808b3 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CX.php @@ -0,0 +1,133 @@ + + [ + 'NationalNumberPattern' => '1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}', + 'ExampleNumber' => '891641234', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[0-36-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}', + 'ExampleNumber' => '412345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '180(?:0\\d{3}|2)\\d{3}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '190[0-26]\\d{6}', + 'ExampleNumber' => '1900123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}', + 'ExampleNumber' => '1300123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 10, + 3 => 12, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}', + 'ExampleNumber' => '147101234', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CX', + 'countryCode' => 61, + 'internationalPrefix' => '001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011', + 'preferredInternationalPrefix' => '0011', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '([59]\\d{7})$|0', + 'nationalPrefixTransformRule' => '8$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CY.php new file mode 100644 index 00000000000..fcf08deeade --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CY.php @@ -0,0 +1,102 @@ + + [ + 'NationalNumberPattern' => '(?:[279]\\d|[58]0)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2[2-6]\\d{6}', + 'ExampleNumber' => '22345678', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9(?:10|[4-79]\\d)\\d{5}', + 'ExampleNumber' => '96123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80001234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[09]\\d{5}', + 'ExampleNumber' => '90012345', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '80[1-9]\\d{5}', + 'ExampleNumber' => '80112345', + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '700\\d{5}', + 'ExampleNumber' => '70012345', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:50|77)\\d{6}', + 'ExampleNumber' => '77123456', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CY', + 'countryCode' => 357, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[257-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CZ.php new file mode 100644 index 00000000000..3993f594c48 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_CZ.php @@ -0,0 +1,169 @@ + + [ + 'NationalNumberPattern' => '(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + 2 => 11, + 3 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2\\d|3[1257-9]|4[16-9]|5[13-9])\\d{7}', + 'ExampleNumber' => '212345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:60[1-8]\\d|7(?:0(?:[2-5]\\d|60)|190|[2379]\\d\\d))\\d{5}', + 'ExampleNumber' => '601123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9(?:0[05689]|76)\\d{6}', + 'ExampleNumber' => '900123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8[134]\\d{7}', + 'ExampleNumber' => '811234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70[01]\\d{6}', + 'ExampleNumber' => '700123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9[17]0\\d{6}', + 'ExampleNumber' => '910123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '9(?:5\\d|7[2-4])\\d{6}', + 'ExampleNumber' => '972123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '9(?:3\\d{9}|6\\d{7,10})', + 'ExampleNumber' => '93123456789', + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'CZ', + 'countryCode' => 420, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-8]|9[015-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '96', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DE.php new file mode 100644 index 00000000000..b5b2a718196 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DE.php @@ -0,0 +1,408 @@ + + [ + 'NationalNumberPattern' => '[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + 4 => 8, + 5 => 9, + 6 => 10, + 7 => 11, + 8 => 12, + 9 => 13, + 10 => 14, + 11 => 15, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 2, + 1 => 3, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '32\\d{9,11}|49[1-6]\\d{10}|322\\d{6}|49[0-7]\\d{3,9}|(?:[34]0|[68]9)\\d{3,13}|(?:2(?:0[1-689]|[1-3569]\\d|4[0-8]|7[1-7]|8[0-7])|3(?:[3569]\\d|4[0-79]|7[1-7]|8[1-8])|4(?:1[02-9]|[2-48]\\d|5[0-6]|6[0-8]|7[0-79])|5(?:0[2-8]|[124-6]\\d|[38][0-8]|[79][0-7])|6(?:0[02-9]|[1-358]\\d|[47][0-8]|6[1-9])|7(?:0[2-8]|1[1-9]|[27][0-7]|3\\d|[4-6][0-8]|8[0-5]|9[013-7])|8(?:0[2-9]|1[0-79]|2\\d|3[0-46-9]|4[0-6]|5[013-9]|6[1-8]|7[0-8]|8[0-24-6])|9(?:0[6-9]|[1-4]\\d|[589][0-7]|6[0-8]|7[0-467]))\\d{3,12}', + 'ExampleNumber' => '30123456', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + 6 => 11, + 7 => 12, + 8 => 13, + 9 => 14, + 10 => 15, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 2, + 1 => 3, + 2 => 4, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '15(?:[0-25-9]\\d\\d|310)\\d{6}|1(?:6[023]|7\\d)\\d{7,8}', + 'ExampleNumber' => '15123456789', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7,12}', + 'ExampleNumber' => '8001234567890', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + 2 => 12, + 3 => 13, + 4 => 14, + 5 => 15, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:137[7-9]|900(?:[135]|9\\d))\\d{6}', + 'ExampleNumber' => '9001234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '180\\d{5,11}|13(?:7[1-6]\\d\\d|8)\\d{4}', + 'ExampleNumber' => '18012345', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + 6 => 13, + 7 => 14, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '700\\d{8}', + 'ExampleNumber' => '70012345678', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '16(?:4\\d{1,10}|[89]\\d{1,11})', + 'ExampleNumber' => '16412345', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + 4 => 8, + 5 => 9, + 6 => 10, + 7 => 11, + 8 => 12, + 9 => 13, + 10 => 14, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '18(?:1\\d{5,11}|[2-9]\\d{8})', + 'ExampleNumber' => '18500123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + 4 => 12, + 5 => 13, + 6 => 14, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '1(?:6(?:013|255|399)|7(?:(?:[015]1|[69]3)3|[2-4]55|[78]99))\\d{7,8}|15(?:(?:[03-68]00|113)\\d|2\\d55|7\\d99|9\\d33)\\d{7}', + 'ExampleNumber' => '177991234567', + 'PossibleLength' => + [ + 0 => 12, + 1 => 13, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'DE', + 'countryCode' => 49, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3,13})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3[02]|40|[68]9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3,12})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1', + 1 => '2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{2,11})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]', + 1 => '[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '138', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{5})(\\d{2,10})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{5,11})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '181', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d)(\\d{4,10})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:3|80)|9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{7,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1[67]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{7,12})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{5})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '185', + 1 => '1850', + 2 => '18500', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 11 => + [ + 'pattern' => '(\\d{4})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '18[68]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 12 => + [ + 'pattern' => '(\\d{4})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '15[1279]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 13 => + [ + 'pattern' => '(\\d{5})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '15[03568]', + 1 => '15(?:[0568]|31)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 14 => + [ + 'pattern' => '(\\d{3})(\\d{8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '18', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 15 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{7,8})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:6[023]|7)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 16 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{7})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '15[279]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 17 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{8})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '15', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DJ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DJ.php new file mode 100644 index 00000000000..e0259e953f5 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DJ.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:2\\d|77)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:1[2-5]|7[45])\\d{5}', + 'ExampleNumber' => '21360003', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '77\\d{6}', + 'ExampleNumber' => '77831001', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'DJ', + 'countryCode' => 253, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[27]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DK.php new file mode 100644 index 00000000000..38383fb80b2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DK.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '[2-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:[2-7]\\d|8[126-9]|9[1-46-9])\\d{6}', + 'ExampleNumber' => '32123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[2-7]\\d|8[126-9]|9[1-46-9])\\d{6}', + 'ExampleNumber' => '32123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{6}', + 'ExampleNumber' => '80123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90\\d{6}', + 'ExampleNumber' => '90123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'DK', + 'countryCode' => 45, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DM.php new file mode 100644 index 00000000000..eec51935a53 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DM.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|767|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '767(?:2(?:55|66)|4(?:2[01]|4[0-25-9])|50[0-4])\\d{4}', + 'ExampleNumber' => '7674201234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '767(?:2(?:[2-4689]5|7[5-7])|31[5-7]|61[1-8]|70[1-6])\\d{4}', + 'ExampleNumber' => '7672251234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'DM', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-7]\\d{6})$|1', + 'nationalPrefixTransformRule' => '767$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '767', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DO.php new file mode 100644 index 00000000000..57630041e12 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DO.php @@ -0,0 +1,109 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '8(?:[04]9[2-9]\\d\\d|29(?:2(?:[0-59]\\d|6[04-9]|7[0-27]|8[0237-9])|3(?:[0-35-9]\\d|4[7-9])|[45]\\d\\d|6(?:[0-27-9]\\d|[3-5][1-9]|6[0135-8])|7(?:0[013-9]|[1-37]\\d|4[1-35689]|5[1-4689]|6[1-57-9]|8[1-79]|9[1-8])|8(?:0[146-9]|1[0-48]|[248]\\d|3[1-79]|5[01589]|6[013-68]|7[124-8]|9[0-8])|9(?:[0-24]\\d|3[02-46-9]|5[0-79]|60|7[0169]|8[57-9]|9[02-9])))\\d{4}', + 'ExampleNumber' => '8092345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '8[024]9[2-9]\\d{6}', + 'ExampleNumber' => '8092345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00(?:14|[2-9]\\d)|(?:33|44|55|66|77|88)[2-9]\\d)\\d{5}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'DO', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '8001|8[024]9', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DZ.php new file mode 100644 index 00000000000..3d3df1d5253 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_DZ.php @@ -0,0 +1,151 @@ + + [ + 'NationalNumberPattern' => '(?:[1-4]|[5-79]\\d|80)\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '9619\\d{5}|(?:1\\d|2[013-79]|3[0-8]|4[013-689])\\d{6}', + 'ExampleNumber' => '12345678', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5(?:4[0-29]|5\\d|6[0-2])|6(?:[569]\\d|7[0-6])|7[7-9]\\d)\\d{6}', + 'ExampleNumber' => '551234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '80[3-689]1\\d{5}', + 'ExampleNumber' => '808123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '80[12]1\\d{5}', + 'ExampleNumber' => '801123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '98[23]\\d{6}', + 'ExampleNumber' => '983123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'DZ', + 'countryCode' => 213, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[1-4]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[5-8]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EC.php new file mode 100644 index 00000000000..f58e5bda3e7 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EC.php @@ -0,0 +1,210 @@ + + [ + 'NationalNumberPattern' => '1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[2-7][2-7]\\d{6}', + 'ExampleNumber' => '22123456', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '964[0-2]\\d{5}|9(?:39|[57][89]|6[0-36-9]|[89]\\d)\\d{6}', + 'ExampleNumber' => '991234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800\\d{7}|1[78]00\\d{6}', + 'ExampleNumber' => '18001234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '[2-7]890\\d{4}', + 'ExampleNumber' => '28901234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'EC', + 'countryCode' => 593, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EE.php new file mode 100644 index 00000000000..c67f00edd8b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EE.php @@ -0,0 +1,165 @@ + + [ + 'NationalNumberPattern' => '8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3[23589]|4[3-8]|6\\d|7[1-9]|88)\\d{5}', + 'ExampleNumber' => '3212345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5\\d{5}|8(?:1(?:0(?:0(?:00|[178]\\d)|[3-9]\\d\\d)|(?:1(?:0[236]|1\\d)|(?:2[0-59]|[3-79]\\d)\\d)\\d)|2(?:0(?:0(?:00|4\\d)|(?:19|[2-7]\\d)\\d)|(?:(?:[124-6]\\d|3[5-9])\\d|7(?:[0-79]\\d|8[13-9])|8(?:[2-6]\\d|7[01]))\\d)|[349]\\d{4}))\\d\\d|5(?:(?:[02]\\d|5[0-478])\\d|1(?:[0-8]\\d|95)|6(?:4[0-4]|5[1-589]))\\d{3}', + 'ExampleNumber' => '51234567', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800(?:(?:0\\d\\d|1)\\d|[2-9])\\d{3}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:40\\d\\d|900)\\d{4}', + 'ExampleNumber' => '9001234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70[0-2]\\d{5}', + 'ExampleNumber' => '70012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '800[2-9]\\d{3}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'id' => 'EE', + 'countryCode' => 372, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88', + 1 => '[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[45]|8(?:00|[1-49])', + 1 => '[45]|8(?:00[1-9]|[1-49])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EG.php new file mode 100644 index 00000000000..e3d7d95819a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EG.php @@ -0,0 +1,175 @@ + + [ + 'NationalNumberPattern' => '[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '13[23]\\d{6}|(?:15|57)\\d{6,7}|(?:2[2-4]|3|4[05-8]|5[05]|6[24-689]|8[2468]|9[235-7])\\d{7}', + 'ExampleNumber' => '234567890', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '1[0-25]\\d{8}', + 'ExampleNumber' => '1001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{7}', + 'ExampleNumber' => '9001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'EG', + 'countryCode' => 20, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{7,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[23]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{6,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1[35]|[4-6]|8[2468]|9[235-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EH.php new file mode 100644 index 00000000000..f23bbec9a98 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_EH.php @@ -0,0 +1,97 @@ + + [ + 'NationalNumberPattern' => '[5-8]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '528[89]\\d{5}', + 'ExampleNumber' => '528812345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}', + 'ExampleNumber' => '650123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-7]\\d{6}', + 'ExampleNumber' => '801234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '89\\d{7}', + 'ExampleNumber' => '891234567', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}', + 'ExampleNumber' => '592401234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'EH', + 'countryCode' => 212, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '528[89]', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ER.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ER.php new file mode 100644 index 00000000000..de75744b9e4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ER.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '[178]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:1[12568]|[24]0|55|6[146])|8\\d\\d)\\d{4}', + 'ExampleNumber' => '8370362', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:17[1-3]|7\\d\\d)\\d{4}', + 'ExampleNumber' => '7123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ER', + 'countryCode' => 291, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[178]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ES.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ES.php new file mode 100644 index 00000000000..77f399fbcd6 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ES.php @@ -0,0 +1,165 @@ + + [ + 'NationalNumberPattern' => '[5-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '96906(?:0[0-8]|1[1-9]|[2-9]\\d)\\d\\d|9(?:69(?:0[0-57-9]|[1-9]\\d)|73(?:[0-8]\\d|9[1-9]))\\d{4}|(?:8(?:[1356]\\d|[28][0-8]|[47][1-9])|9(?:[135]\\d|[268][0-8]|4[1-9]|7[124-9]))\\d{6}', + 'ExampleNumber' => '810123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:590[16]00\\d|9(?:6906(?:09|10)|7390\\d\\d))\\d\\d|(?:6\\d|7[1-48])\\d{7}', + 'ExampleNumber' => '612345678', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '[89]00\\d{6}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '80[367]\\d{6}', + 'ExampleNumber' => '803123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '90[12]\\d{6}', + 'ExampleNumber' => '901123456', + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{7}', + 'ExampleNumber' => '701234567', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '51\\d{7}', + 'ExampleNumber' => '511234567', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ES', + 'countryCode' => 34, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '905', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '[79]9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]00', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[5-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]00', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[5-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ET.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ET.php new file mode 100644 index 00000000000..17acabb27c6 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ET.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '(?:11|[2-579]\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '11667[01]\\d{3}|(?:11(?:1(?:1[124]|2[2-7]|3[1-5]|5[5-8]|8[6-8])|2(?:13|3[6-8]|5[89]|7[05-9]|8[2-6])|3(?:2[01]|3[0-289]|4[1289]|7[1-4]|87)|4(?:1[69]|3[2-49]|4[0-3]|6[5-8])|5(?:1[578]|44|5[0-4])|6(?:1[578]|2[69]|39|4[5-7]|5[0-5]|6[0-59]|8[015-8]))|2(?:2(?:11[1-9]|22[0-7]|33\\d|44[1467]|66[1-68])|5(?:11[124-6]|33[2-8]|44[1467]|55[14]|66[1-3679]|77[124-79]|880))|3(?:3(?:11[0-46-8]|(?:22|55)[0-6]|33[0134689]|44[04]|66[01467])|4(?:44[0-8]|55[0-69]|66[0-3]|77[1-5]))|4(?:6(?:119|22[0-24-7]|33[1-5]|44[13-69]|55[14-689]|660|88[1-4])|7(?:(?:11|22)[1-9]|33[13-7]|44[13-6]|55[1-689]))|5(?:7(?:227|55[05]|(?:66|77)[14-8])|8(?:11[149]|22[013-79]|33[0-68]|44[013-8]|550|66[1-5]|77\\d)))\\d{4}', + 'ExampleNumber' => '111112345', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '700[1-9]\\d{5}|(?:7(?:0[1-9]|1[0-8]|22|77|86|99)|9\\d\\d)\\d{6}', + 'ExampleNumber' => '911234567', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ET', + 'countryCode' => 251, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-579]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FI.php new file mode 100644 index 00000000000..3dfc4dde884 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FI.php @@ -0,0 +1,276 @@ + + [ + 'NationalNumberPattern' => '[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + 6 => 11, + 7 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1[3-79][1-8]|[23568][1-8]\\d|9(?:00|[1-8]\\d))\\d{2,6}', + 'ExampleNumber' => '131234567', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4946\\d{2,6}|(?:4[0-8]|50)\\d{4,8}', + 'ExampleNumber' => '412345678', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4,6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '[67]00\\d{5,6}', + 'ExampleNumber' => '600123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '20\\d{4,8}|60[12]\\d{5,6}|7(?:099\\d{4,5}|5[03-9]\\d{3,7})|20[2-59]\\d\\d|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:10|29|3[09]|70[1-5]\\d)\\d{4,8}', + 'ExampleNumber' => '10112345', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '20(?:2[023]|9[89])\\d{1,6}|(?:60[12]\\d|7099)\\d{4,5}|(?:606|7(?:0[78]|1|3\\d))\\d{7}|(?:[1-3]00|7(?:0[1-5]\\d\\d|5[03-9]))\\d{3,7}', + ], + 'id' => 'FI', + 'countryCode' => 358, + 'internationalPrefix' => '00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '75[12]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '20[2-59]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '11', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:[1-3]0|[68])0|70[07-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{4,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[14]|2[09]|50|7[135]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{6,10})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d)(\\d{4,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:1[3-79]|[2568])[1-8]|3(?:0[1-9]|[1-9])|9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '20[2-59]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:[1-3]0|[68])0|70[07-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{4,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[14]|2[09]|50|7[135]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{6,10})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d)(\\d{4,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:1[3-79]|[2568])[1-8]|3(?:0[1-9]|[1-9])|9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'leadingDigits' => '1[03-79]|[2-9]', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FJ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FJ.php new file mode 100644 index 00000000000..076be2f997d --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FJ.php @@ -0,0 +1,136 @@ + + [ + 'NationalNumberPattern' => '45\\d{5}|(?:0800\\d|[235-9])\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '603\\d{4}|(?:3[0-5]|6[25-7]|8[58])\\d{5}', + 'ExampleNumber' => '3212345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[279]\\d|45|5[01568]|8[034679])\\d{5}', + 'ExampleNumber' => '7012345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '0800\\d{7}', + 'ExampleNumber' => '08001234567', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'FJ', + 'countryCode' => 679, + 'internationalPrefix' => '0(?:0|52)', + 'preferredInternationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[235-9]|45', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FK.php new file mode 100644 index 00000000000..13a4110e642 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FK.php @@ -0,0 +1,100 @@ + + [ + 'NationalNumberPattern' => '[2-7]\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[2-47]\\d{4}', + 'ExampleNumber' => '31234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[56]\\d{4}', + 'ExampleNumber' => '51234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'FK', + 'countryCode' => 500, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FM.php new file mode 100644 index 00000000000..77e9b158222 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FM.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:[39]\\d\\d|820)\\d{4}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-6]\\d)\\d)\\d{3}', + 'ExampleNumber' => '3201234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '31(?:00[67]|208|309)\\d\\d|(?:3(?:[2357]0[1-9]|602|804|905)|(?:820|9[2-7]\\d)\\d)\\d{3}', + 'ExampleNumber' => '3501234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'FM', + 'countryCode' => 691, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[389]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FO.php new file mode 100644 index 00000000000..0cd3aec952b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FO.php @@ -0,0 +1,107 @@ + + [ + 'NationalNumberPattern' => '[2-9]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:20|[34]\\d|8[19])\\d{4}', + 'ExampleNumber' => '201234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[27][1-9]|5\\d|9[16])\\d{4}', + 'ExampleNumber' => '211234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[257-9]\\d{3}', + 'ExampleNumber' => '802123', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90(?:[13-5][15-7]|2[125-7]|9\\d)\\d\\d', + 'ExampleNumber' => '901123', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:6[0-36]|88)\\d{4}', + 'ExampleNumber' => '601234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'FO', + 'countryCode' => 298, + 'internationalPrefix' => '00', + 'nationalPrefixForParsing' => '(10(?:01|[12]0|88))', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FR.php new file mode 100644 index 00000000000..a0f76f5f199 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_FR.php @@ -0,0 +1,167 @@ + + [ + 'NationalNumberPattern' => '[1-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:26[013-9]|59[1-35-9])\\d{6}|(?:[13]\\d|2[0-57-9]|4[1-9]|5[0-8])\\d{7}', + 'ExampleNumber' => '123456789', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:6(?:[0-24-8]\\d|3[0-8]|9[589])|7[3-9]\\d)\\d{6}', + 'ExampleNumber' => '612345678', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '801234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '836(?:0[0-36-9]|[1-9]\\d)\\d{4}|8(?:1[2-9]|2[2-47-9]|3[0-57-9]|[569]\\d|8[0-35-9])\\d{6}', + 'ExampleNumber' => '891123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8(?:1[01]|2[0156]|4[02]|84)\\d{6}', + 'ExampleNumber' => '884012345', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9\\d{8}', + 'ExampleNumber' => '912345678', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '80[6-9]\\d{6}', + 'ExampleNumber' => '806123456', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'FR', + 'countryCode' => 33, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '10', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '[1-79]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '[1-79]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GA.php new file mode 100644 index 00000000000..acd0ef553b2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GA.php @@ -0,0 +1,143 @@ + + [ + 'NationalNumberPattern' => '(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[01]1\\d{6}', + 'ExampleNumber' => '01441234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:(?:0[2-7]|7[467])\\d|6(?:0[0-4]|10|[256]\\d))\\d{5}|[2-7]\\d{6}', + 'ExampleNumber' => '06031234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GA', + 'countryCode' => 241, + 'internationalPrefix' => '00', + 'nationalPrefixForParsing' => '0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})', + 'nationalPrefixTransformRule' => '$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '11|[67]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GB.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GB.php new file mode 100644 index 00000000000..0bd691172a7 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GB.php @@ -0,0 +1,244 @@ + + [ + 'NationalNumberPattern' => '[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-79])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}', + 'ExampleNumber' => '1212345678', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + 4 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}', + 'ExampleNumber' => '7400123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[08]\\d{7}|800\\d{6}|8001111', + 'ExampleNumber' => '8001234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d', + 'ExampleNumber' => '9012345678', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{8}', + 'ExampleNumber' => '7012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '56\\d{8}', + 'ExampleNumber' => '5612345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}', + 'ExampleNumber' => '7640123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:3[0347]|55)\\d{8}', + 'ExampleNumber' => '5512345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GB', + 'countryCode' => 44, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'preferredExtnPrefix' => ' x', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '800', + 1 => '8001', + 2 => '80011', + 3 => '800111', + 4 => '8001111', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '845', + 1 => '8454', + 2 => '84546', + 3 => '845464', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '800', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{5})(\\d{4,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:38|5[23]|69|76|94)', + 1 => '1(?:(?:38|69)7|5(?:24|39)|768|946)', + 2 => '1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:[2-69][02-9]|[78])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[25]|7(?:0|6[02-9])', + 1 => '[25]|7(?:0|6(?:[03-9]|2[356]))', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{4})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1389]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GD.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GD.php new file mode 100644 index 00000000000..54d6de08edf --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GD.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:473|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '473(?:2(?:3[0-2]|69)|3(?:2[89]|86)|4(?:[06]8|3[5-9]|4[0-49]|5[5-79]|73|90)|63[68]|7(?:58|84)|800|938)\\d{4}', + 'ExampleNumber' => '4732691234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '473(?:4(?:0[2-79]|1[04-9]|2[0-5]|58)|5(?:2[01]|3[3-8])|901)\\d{4}', + 'ExampleNumber' => '4734031234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GD', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-9]\\d{6})$|1', + 'nationalPrefixTransformRule' => '473$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '473', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GE.php new file mode 100644 index 00000000000..51a8702dd4a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GE.php @@ -0,0 +1,153 @@ + + [ + 'NationalNumberPattern' => '(?:[3-57]\\d\\d|800)\\d{6}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3(?:[256]\\d|4[124-9]|7[0-4])|4(?:1\\d|2[2-7]|3[1-79]|4[2-8]|7[239]|9[1-7]))\\d{6}', + 'ExampleNumber' => '322123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '5(?:(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d|22252[0-4])\\d\\d|(?:5(?:00(?:0\\d|11|22|33|44|5[05]|77|88|9[09])|1(?:1(?:00|[124]\\d|3[01])|4\\d\\d)|(?:44|68)\\d\\d|5(?:[0157-9]\\d\\d|200)|7(?:[0147-9]\\d\\d|5(?:00|[57]5))|8(?:0(?:[018]\\d|2[0-4])|58[89]|8(?:55|88))|9(?:090|[1-35-9]\\d\\d))|790\\d\\d)\\d{4}|5(?:0(?:0[17]0|505)|1(?:0[01]0|1(?:07|33|51))|2(?:0[02]0|2[25]2)|3(?:0[03]0|3[35]3)|(?:40[04]|900)0|5222)[0-4]\\d{3}', + 'ExampleNumber' => '555123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '70[67]\\d{6}', + 'ExampleNumber' => '706123456', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '70[67]\\d{6}', + ], + 'id' => 'GE', + 'countryCode' => 995, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '70', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '32', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[57]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[348]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GF.php new file mode 100644 index 00000000000..87f22a9b508 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GF.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '[56]94\\d{6}|(?:80|9\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '594(?:[02-49]\\d|1[0-5]|5[6-9]|6[0-3]|80)\\d{4}', + 'ExampleNumber' => '594101234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '694(?:[0-249]\\d|3[0-8])\\d{4}', + 'ExampleNumber' => '694201234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:(?:396|76\\d)\\d|476[0-5])\\d{4}', + 'ExampleNumber' => '976012345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GF', + 'countryCode' => 594, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[56]|9[47]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GG.php new file mode 100644 index 00000000000..05e7ed03e3f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GG.php @@ -0,0 +1,130 @@ + + [ + 'NationalNumberPattern' => '(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1481[25-9]\\d{5}', + 'ExampleNumber' => '1481256789', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:(?:781|839)\\d|911[17])\\d{5}', + 'ExampleNumber' => '7781123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[08]\\d{7}|800\\d{6}|8001111', + 'ExampleNumber' => '8001234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d', + 'ExampleNumber' => '9012345678', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{8}', + 'ExampleNumber' => '7012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '56\\d{8}', + 'ExampleNumber' => '5612345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}', + 'ExampleNumber' => '7640123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:3[0347]|55)\\d{8}', + 'ExampleNumber' => '5512345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GG', + 'countryCode' => 44, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '([25-9]\\d{5})$|0', + 'nationalPrefixTransformRule' => '1481$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GH.php new file mode 100644 index 00000000000..0efcee56841 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GH.php @@ -0,0 +1,185 @@ + + [ + 'NationalNumberPattern' => '(?:[235]\\d{3}|800)\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '3082[0-5]\\d{4}|3(?:0(?:[237]\\d|8[01])|[167](?:2[0-6]|7\\d|80)|2(?:2[0-5]|7\\d|80)|3(?:2[0-3]|7\\d|80)|4(?:2[013-9]|3[01]|7\\d|80)|5(?:2[0-7]|7\\d|80)|8(?:2[0-2]|7\\d|80)|9(?:[28]0|7\\d))\\d{5}', + 'ExampleNumber' => '302345678', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:2(?:[0346-9]\\d|5[67])|5(?:[03-7]\\d|9[1-9]))\\d{6}', + 'ExampleNumber' => '231234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'id' => 'GH', + 'countryCode' => 233, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[237]|8[0-2]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[235]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[235]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GI.php new file mode 100644 index 00000000000..0d914d4eeb6 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GI.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:[25]\\d|60)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2190[0-2]\\d{3}|2(?:0(?:[02]\\d|3[01])|16[24-9]|2[2-5]\\d)\\d{4}', + 'ExampleNumber' => '20012345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '5251[0-4]\\d{3}|(?:5(?:[146-8]\\d\\d|250)|60(?:1[01]|6\\d))\\d{4}', + 'ExampleNumber' => '57123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GI', + 'countryCode' => 350, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GL.php new file mode 100644 index 00000000000..df0a77201f0 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GL.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '(?:19|[2-689]\\d|70)\\d{4}', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:19|3[1-7]|[68][1-9]|70|9\\d)\\d{4}', + 'ExampleNumber' => '321000', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[245]\\d{5}', + 'ExampleNumber' => '221234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{4}', + 'ExampleNumber' => '801234', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '3[89]\\d{4}', + 'ExampleNumber' => '381234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GL', + 'countryCode' => 299, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '19|[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GM.php new file mode 100644 index 00000000000..94ee01615ea --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GM.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '[2-9]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:4(?:[23]\\d\\d|4(?:1[024679]|[6-9]\\d))|5(?:5(?:3\\d|4[0-7])|6[67]\\d|7(?:1[04]|2[035]|3[58]|48))|8\\d{3})\\d{3}', + 'ExampleNumber' => '5661234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[23679]\\d|5[0-489])\\d{5}', + 'ExampleNumber' => '3012345', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GM', + 'countryCode' => 220, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GN.php new file mode 100644 index 00000000000..08063df917a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GN.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '722\\d{6}|(?:3|6\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '3(?:0(?:24|3[12]|4[1-35-7]|5[13]|6[189]|[78]1|9[1478])|1\\d\\d)\\d{4}', + 'ExampleNumber' => '30241234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6[0-356]\\d{7}', + 'ExampleNumber' => '601123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '722\\d{6}', + 'ExampleNumber' => '722123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GN', + 'countryCode' => 224, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[67]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GP.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GP.php new file mode 100644 index 00000000000..50137f4e12f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GP.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '590\\d{6}|(?:69|80|9\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}', + 'ExampleNumber' => '590201234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}', + 'ExampleNumber' => '690001234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}', + 'ExampleNumber' => '976012345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GP', + 'countryCode' => 590, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[569]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GQ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GQ.php new file mode 100644 index 00000000000..d4e885ab911 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GQ.php @@ -0,0 +1,120 @@ + + [ + 'NationalNumberPattern' => '222\\d{6}|(?:3\\d|55|[89]0)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '33[0-24-9]\\d[46]\\d{4}|3(?:33|5\\d)\\d[7-9]\\d{4}', + 'ExampleNumber' => '333091234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:222|55\\d)\\d{6}', + 'ExampleNumber' => '222123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d[1-9]\\d{5}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90\\d[1-9]\\d{5}', + 'ExampleNumber' => '900123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GQ', + 'countryCode' => 240, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[235]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GR.php new file mode 100644 index 00000000000..3a5b6b2e479 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GR.php @@ -0,0 +1,164 @@ + + [ + 'NationalNumberPattern' => '5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + 2 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:1\\d\\d|2(?:2[1-46-9]|[36][1-8]|4[1-7]|5[1-4]|7[1-5]|[89][1-9])|3(?:1\\d|2[1-57]|[35][1-3]|4[13]|7[1-7]|8[124-6]|9[1-79])|4(?:1\\d|2[1-8]|3[1-4]|4[13-5]|6[1-578]|9[1-5])|5(?:1\\d|[29][1-4]|3[1-5]|4[124]|5[1-6])|6(?:1\\d|[269][1-6]|3[1245]|4[1-7]|5[13-9]|7[14]|8[1-5])|7(?:1\\d|2[1-5]|3[1-6]|4[1-7]|5[1-57]|6[135]|9[125-7])|8(?:1\\d|2[1-5]|[34][1-4]|9[1-57]))\\d{6}', + 'ExampleNumber' => '2123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '68[57-9]\\d{7}|(?:69|94)\\d{8}', + 'ExampleNumber' => '6912345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7,9}', + 'ExampleNumber' => '8001234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[19]\\d{7}', + 'ExampleNumber' => '9091234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8(?:0[16]|12|[27]5|50)\\d{7}', + 'ExampleNumber' => '8011234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{8}', + 'ExampleNumber' => '7012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '5005000\\d{3}', + 'ExampleNumber' => '5005000123', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GR', + 'countryCode' => 30, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '21|7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2689]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GT.php new file mode 100644 index 00000000000..c68af8cd523 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GT.php @@ -0,0 +1,137 @@ + + [ + 'NationalNumberPattern' => '80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[267][2-9]\\d{6}', + 'ExampleNumber' => '22456789', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[3-5]\\d\\d|80[0-4])\\d{5}', + 'ExampleNumber' => '51234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '18[01]\\d{8}', + 'ExampleNumber' => '18001112222', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '19\\d{9}', + 'ExampleNumber' => '19001112222', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GT', + 'countryCode' => 502, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-8]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GU.php new file mode 100644 index 00000000000..3fbf178de1b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GU.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|671|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '671(?:2\\d\\d|3(?:00|3[39]|4[349]|55|6[26])|4(?:00|56|7[1-9]|8[02-46-9])|5(?:55|6[2-5]|88)|6(?:3[2-578]|4[24-9]|5[34]|78|8[235-9])|7(?:[0479]7|2[0167]|3[45]|8[7-9])|8(?:[2-57-9]8|6[48])|9(?:2[29]|6[79]|7[1279]|8[7-9]|9[78]))\\d{4}', + 'ExampleNumber' => '6713001234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '671(?:2\\d\\d|3(?:00|3[39]|4[349]|55|6[26])|4(?:00|56|7[1-9]|8[02-46-9])|5(?:55|6[2-5]|88)|6(?:3[2-578]|4[24-9]|5[34]|78|8[235-9])|7(?:[0479]7|2[0167]|3[45]|8[7-9])|8(?:[2-57-9]8|6[48])|9(?:2[29]|6[79]|7[1279]|8[7-9]|9[78]))\\d{4}', + 'ExampleNumber' => '6713001234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GU', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-9]\\d{6})$|1', + 'nationalPrefixTransformRule' => '671$1', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '671', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GW.php new file mode 100644 index 00000000000..01b4ea3811f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GW.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '[49]\\d{8}|4\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '443\\d{6}', + 'ExampleNumber' => '443201234', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9(?:5\\d|6[569]|77)\\d{6}', + 'ExampleNumber' => '955012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '40\\d{5}', + 'ExampleNumber' => '4012345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GW', + 'countryCode' => 245, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '40', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[49]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GY.php new file mode 100644 index 00000000000..1555c816944 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_GY.php @@ -0,0 +1,106 @@ + + [ + 'NationalNumberPattern' => '(?:[2-8]\\d{3}|9008)\\d{3}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:1[6-9]|2[0-35-9]|3[1-4]|5[3-9]|6\\d|7[0-79])|3(?:2[25-9]|3\\d)|4(?:4[0-24]|5[56])|50[0-6]|77[1-57])\\d{4}', + 'ExampleNumber' => '2201234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:510|6\\d\\d|7(?:[01]\\d|2[156]|31|49))\\d{4}', + 'ExampleNumber' => '6091234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:289|8(?:00|6[28]|88|99))\\d{4}', + 'ExampleNumber' => '2891234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9008\\d{3}', + 'ExampleNumber' => '9008123', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '515\\d{4}', + 'ExampleNumber' => '5151234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'GY', + 'countryCode' => 592, + 'internationalPrefix' => '001', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HK.php new file mode 100644 index 00000000000..5722884176b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HK.php @@ -0,0 +1,177 @@ + + [ + 'NationalNumberPattern' => '8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:[13-9]\\d|2[013-9])\\d|3(?:(?:[1569][0-24-9]|4[0-246-9]|7[0-24-69])\\d|8(?:4[0-8]|[59]\\d|6[01]))|58(?:0[1-9]|1[2-9]))\\d{4}', + 'ExampleNumber' => '21234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:4(?:44[0-25-9]|6(?:1[0-7]|4[0-57-9]|6[0-4]))|5(?:73[0-6]|95[0-8])|6(?:26[013-8]|66[0-3])|70(?:7[1-8]|8[0-4])|848[0-35-9]|9(?:29[013-9]|39[01]|59[0-4]|899))\\d{4}|(?:4(?:4[0-35-8]|6[02357-9])|5(?:[1-59][0-46-9]|6[0-4689]|7[0-246-9])|6(?:0[1-9]|[13-59]\\d|[268][0-57-9]|7[0-79])|70[129]|84[0-29]|9(?:0[1-9]|1[02-9]|[2358][0-8]|[467]\\d))\\d{5}', + 'ExampleNumber' => '51234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900(?:[0-24-9]\\d{7}|3\\d{1,4})', + 'ExampleNumber' => '90012345678', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 11, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '8(?:1[0-4679]\\d|2(?:[0-36]\\d|7[0-4])|3(?:[034]\\d|2[09]|70))\\d{4}', + 'ExampleNumber' => '81123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '7(?:1(?:0[0-38]|1[0-3679]|3[013]|69|9[0136])|2(?:[02389]\\d|1[18]|7[27-9])|3(?:[0-38]\\d|7[0-369]|9[2357-9])|47\\d|5(?:[178]\\d|5[0-5])|6(?:0[0-7]|2[236-9]|[35]\\d)|7(?:[27]\\d|8[7-9])|8(?:[23689]\\d|7[1-9])|9(?:[025]\\d|6[0-246-8]|7[0-36-9]|8[238]))\\d{4}', + 'ExampleNumber' => '71123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '30(?:0[1-9]|[15-7]\\d|2[047]|89)\\d{4}', + 'ExampleNumber' => '30161234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'HK', + 'countryCode' => 852, + 'internationalPrefix' => '00(?:30|5[09]|[126-9]?)', + 'preferredInternationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '900', + 1 => '9003', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]|8[1-4]|9(?:0[1-9]|[1-8])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HN.php new file mode 100644 index 00000000000..f4dd83c1d02 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HN.php @@ -0,0 +1,151 @@ + + [ + 'NationalNumberPattern' => '8\\d{10}|[237-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:2(?:0[0-59]|1[1-9]|[23]\\d|4[02-6]|5[57]|6[245]|7[0135689]|8[01346-9]|9[0-2])|4(?:0[578]|2[3-59]|3[13-9]|4[0-68]|5[1-3589])|5(?:0[2357-9]|1[1-356]|4[03-5]|5\\d|6[014-69]|7[04]|80)|6(?:[056]\\d|17|2[067]|3[047]|4[0-378]|[78][0-8]|9[01])|7(?:0[5-79]|6[46-9]|7[02-9]|8[034]|91)|8(?:79|8[0-357-9]|9[1-57-9]))\\d{4}', + 'ExampleNumber' => '22123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[37-9]\\d{7}', + 'ExampleNumber' => '91234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8002\\d{7}', + 'ExampleNumber' => '80021234567', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '8002\\d{7}', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'id' => 'HN', + 'countryCode' => 504, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[237-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[237-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HR.php new file mode 100644 index 00000000000..7b61e56f9d7 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HR.php @@ -0,0 +1,217 @@ + + [ + 'NationalNumberPattern' => '(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1\\d{7}|(?:2[0-3]|3[1-5]|4[02-47-9]|5[1-3])\\d{6,7}', + 'ExampleNumber' => '12345678', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9(?:(?:0[1-9]|[12589]\\d)\\d\\d|7(?:[0679]\\d\\d|5(?:[01]\\d|44|55|77|9[5-7])))\\d{4}|98\\d{6}', + 'ExampleNumber' => '921234567', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{5,7}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '6[01459]\\d{6}|6[01]\\d{4,5}', + 'ExampleNumber' => '611234', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '7[45]\\d{6}', + 'ExampleNumber' => '74123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '62\\d{6,7}|72\\d{6}', + 'ExampleNumber' => '62123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'HR', + 'countryCode' => 385, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6[01]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6|7[245]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-57]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HT.php new file mode 100644 index 00000000000..d06ce9c5444 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HT.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '(?:[2-489]\\d|55)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:2\\d|5[1-5]|81|9[149])\\d{5}', + 'ExampleNumber' => '22453300', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[34]\\d|55)\\d{6}', + 'ExampleNumber' => '34101234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8\\d{7}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:[67][0-4]|8[0-3589]|9\\d)\\d{5}', + 'ExampleNumber' => '98901234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'HT', + 'countryCode' => 509, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-589]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HU.php new file mode 100644 index 00000000000..bc821606d1b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_HU.php @@ -0,0 +1,158 @@ + + [ + 'NationalNumberPattern' => '[235-7]\\d{8}|[1-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1\\d|[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6[23689]|8[2-57-9]|9[2-69])\\d{6}', + 'ExampleNumber' => '12345678', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[257]0|3[01])\\d{7}', + 'ExampleNumber' => '201234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:[48]0\\d|680[29])\\d{5}', + 'ExampleNumber' => '80123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9[01]\\d{6}', + 'ExampleNumber' => '90123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '21\\d{7}', + 'ExampleNumber' => '211234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '38\\d{7}', + 'ExampleNumber' => '381234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '(?:[48]0\\d|680[29])\\d{5}', + ], + 'id' => 'HU', + 'countryCode' => 36, + 'internationalPrefix' => '00', + 'nationalPrefix' => '06', + 'nationalPrefixForParsing' => '06', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '(06 $1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]', + ], + 'nationalPrefixFormattingRule' => '(06 $1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '06 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ID.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ID.php new file mode 100644 index 00000000000..1917e07d559 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ID.php @@ -0,0 +1,393 @@ + + [ + 'NationalNumberPattern' => '(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + 6 => 13, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2[124]\\d{7,8}|619\\d{8}|2(?:1(?:14|500)|2\\d{3})\\d{3}|61\\d{5,8}|(?:2(?:[35][1-4]|6[0-8]|7[1-6]|8\\d|9[1-8])|3(?:1|[25][1-8]|3[1-68]|4[1-3]|6[1-3568]|7[0-469]|8\\d)|4(?:0[1-589]|1[01347-9]|2[0-36-8]|3[0-24-68]|43|5[1-378]|6[1-5]|7[134]|8[1245])|5(?:1[1-35-9]|2[25-8]|3[124-9]|4[1-3589]|5[1-46]|6[1-8])|6(?:[25]\\d|3[1-69]|4[1-6])|7(?:02|[125][1-9]|[36]\\d|4[1-8]|7[0-36-9])|9(?:0[12]|1[013-8]|2[0-479]|5[125-8]|6[23679]|7[159]|8[01346]))\\d{5,8}', + 'ExampleNumber' => '218350123', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '8[1-35-9]\\d{7,10}', + 'ExampleNumber' => '812345678', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + 2 => 11, + 3 => 12, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '00[17]803\\d{7}|(?:177\\d|800)\\d{5,7}|001803\\d{6}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + 4 => 12, + 5 => 13, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '809\\d{7}', + 'ExampleNumber' => '8091234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '804\\d{7}', + 'ExampleNumber' => '8041234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:1500|8071\\d{3})\\d{3}', + 'ExampleNumber' => '8071123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '001803\\d{6,7}|(?:007803\\d|8071)\\d{6}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 12, + 2 => 13, + ], + ], + 'id' => 'ID', + 'countryCode' => 62, + 'internationalPrefix' => '00[89]', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '15', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{5,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2[124]|[36]1', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{5,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '800', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{5,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-79]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})(\\d{3})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '8[1-35-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{6,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '804', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4,5})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '001', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '15', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{5,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2[124]|[36]1', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{5,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '800', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{5,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-79]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})(\\d{3})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '8[1-35-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{6,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '804', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4,5})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IE.php new file mode 100644 index 00000000000..60587bb4d5a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IE.php @@ -0,0 +1,254 @@ + + [ + 'NationalNumberPattern' => '(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1\\d|21)\\d{6,7}|(?:2[24-9]|4(?:0[24]|5\\d|7)|5(?:0[45]|1\\d|8)|6(?:1\\d|[237-9])|9(?:1\\d|[35-9]))\\d{5}|(?:23|4(?:[1-469]|8\\d)|5[23679]|6[4-6]|7[14]|9[04])\\d{7}', + 'ExampleNumber' => '2212345', + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '8(?:22|[35-9]\\d)\\d{6}', + 'ExampleNumber' => '850123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800\\d{6}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '15(?:1[2-8]|[2-8]0|9[089])\\d{6}', + 'ExampleNumber' => '1520123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '18[59]0\\d{6}', + 'ExampleNumber' => '1850123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '700\\d{6}', + 'ExampleNumber' => '700123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '76\\d{7}', + 'ExampleNumber' => '761234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '818\\d{6}', + 'ExampleNumber' => '818123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '88210[1-9]\\d{4}|8(?:[35-79]5\\d\\d|8(?:[013-9]\\d\\d|2(?:[01][1-9]|[2-9]\\d)))\\d{5}', + 'ExampleNumber' => '8551234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '18[59]0\\d{6}', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'id' => 'IE', + 'countryCode' => 353, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2[24-9]|47|58|6[237-9]|9[35-9]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[45]0', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2569]|4[1-69]|7[14]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '70', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '81', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[78]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '4', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{2})(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IL.php new file mode 100644 index 00000000000..c2a1f72fbda --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IL.php @@ -0,0 +1,233 @@ + + [ + 'NationalNumberPattern' => '1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '153\\d{8,9}|29[1-9]\\d{5}|(?:2[0-8]|[3489]\\d)\\d{6}', + 'ExampleNumber' => '21234567', + 'PossibleLength' => + [ + 0 => 8, + 1 => 11, + 2 => 12, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '55410\\d{4}|5(?:(?:[02][02-9]|[149][2-9]|[36]\\d|8[3-7])\\d|5(?:01|2\\d|3[0-3]|4[34]|5[0-25689]|6[6-8]|7[0-267]|8[7-9]|9[1-9]))\\d{5}', + 'ExampleNumber' => '502345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1(?:255|80[019]\\d{3})\\d{3}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '1212\\d{4}|1(?:200|9(?:0[0-2]|19))\\d{6}', + 'ExampleNumber' => '1919123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '1700\\d{6}', + 'ExampleNumber' => '1700123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '7(?:38(?:0\\d|5[09]|88)|8(?:33|55|77|81)\\d)\\d{4}|7(?:18|2[23]|3[237]|47|6[258]|7\\d|82|9[2-9])\\d{6}', + 'ExampleNumber' => '771234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '1599\\d{6}', + 'ExampleNumber' => '1599123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '151\\d{8,9}', + 'ExampleNumber' => '15112340000', + 'PossibleLength' => + [ + 0 => 11, + 1 => 12, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '1700\\d{6}', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'id' => 'IL', + 'countryCode' => 972, + 'internationalPrefix' => '0(?:0|1[2-9])', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{3})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '125', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{2})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '121', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-489]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[57]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '12', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{4})(\\d{6})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '159', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1-$2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '1[7-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})', + 'format' => '$1-$2 $3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '15', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IM.php new file mode 100644 index 00000000000..b837f8923ef --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IM.php @@ -0,0 +1,102 @@ + + [ + 'NationalNumberPattern' => '1624\\d{6}|(?:[3578]\\d|90)\\d{8}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1624(?:230|[5-8]\\d\\d)\\d{3}', + 'ExampleNumber' => '1624756789', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '76245[06]\\d{4}|7(?:4576|[59]24\\d|624[0-4689])\\d{5}', + 'ExampleNumber' => '7924123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '808162\\d{4}', + 'ExampleNumber' => '8081624567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '8(?:440[49]06|72299\\d)\\d{3}|(?:8(?:45|70)|90[0167])624\\d{4}', + 'ExampleNumber' => '9016247890', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{8}', + 'ExampleNumber' => '7012345678', + ], + 'voip' => + [ + 'NationalNumberPattern' => '56\\d{8}', + 'ExampleNumber' => '5612345678', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '3440[49]06\\d{3}|(?:3(?:08162|3\\d{4}|45624|7(?:0624|2299))|55\\d{4})\\d{4}', + 'ExampleNumber' => '5512345678', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'IM', + 'countryCode' => 44, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '([25-8]\\d{5})$|0', + 'nationalPrefixTransformRule' => '1624$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '74576|(?:16|7[56])24', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IN.php new file mode 100644 index 00000000000..4c075ea5eb2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IN.php @@ -0,0 +1,390 @@ + + [ + 'NationalNumberPattern' => '(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + 4 => 12, + 5 => 13, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2717(?:[2-7]\\d|95)\\d{4}|(?:271[0-689]|782[0-6])[2-7]\\d{5}|(?:170[24]|2(?:(?:[02][2-79]|90)\\d|80[13468])|(?:3(?:23|80)|683|79[1-7])\\d|4(?:20[24]|72[2-8])|552[1-7])\\d{6}|(?:11|33|4[04]|80)[2-7]\\d{7}|(?:342|674|788)(?:[0189][2-7]|[2-7]\\d)\\d{5}|(?:1(?:2[0-249]|3[0-25]|4[145]|[59][14]|6[014]|7[1257]|8[01346])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568]|9[14])|3(?:26|4[13]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[014-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|2[14]|3[134]|4[47]|5[15]|[67]1)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91))[2-7]\\d{6}|(?:1(?:2[35-8]|3[346-9]|4[236-9]|[59][0235-9]|6[235-9]|7[34689]|8[257-9])|2(?:1[134689]|3[24-8]|4[2-8]|5[25689]|6[2-4679]|7[3-79]|8[2-479]|9[235-9])|3(?:01|1[79]|2[1245]|4[5-8]|5[125689]|6[235-7]|7[157-9]|8[2-46-8])|4(?:1[14578]|2[5689]|3[2-467]|5[4-7]|6[35]|73|8[2689]|9[2389])|5(?:[16][146-9]|2[14-8]|3[1346]|4[14-69]|5[46]|7[2-4]|8[2-8]|9[246])|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])|7(?:1[013-9]|2[0235-9]|3[2679]|4[1-35689]|5[2-46-9]|[67][02-9]|8[013-7]|9[089])|8(?:1[1357-9]|2[235-8]|3[03-57-9]|4[0-24-9]|5\\d|6[2457-9]|7[1-6]|8[1256]|9[2-4]))\\d[2-7]\\d{5}', + 'ExampleNumber' => '7410410123', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:61279|7(?:887[02-9]|9(?:313|79[07-9]))|8(?:079[04-9]|(?:84|91)7[02-8]))\\d{5}|(?:6(?:12|[2-47]1|5[17]|6[13]|80)[0189]|7(?:1(?:2[0189]|9[0-5])|2(?:[14][017-9]|8[0-59])|3(?:2[5-8]|[34][017-9]|9[016-9])|4(?:1[015-9]|[29][89]|39|8[389])|5(?:[15][017-9]|2[04-9]|9[7-9])|6(?:0[0-47]|1[0-257-9]|2[0-4]|3[19]|5[4589])|70[0289]|88[089]|97[02-8])|8(?:0(?:6[67]|7[02-8])|70[017-9]|84[01489]|91[0-289]))\\d{6}|(?:7(?:31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[0189]\\d|7[02-8])\\d{5}|(?:6(?:[09]\\d|1[04679]|2[03689]|3[05-9]|4[0489]|50|6[069]|7[07]|8[7-9])|7(?:0\\d|2[0235-79]|3[05-8]|40|5[0346-8]|6[6-9]|7[1-9]|8[0-79]|9[089])|8(?:0[01589]|1[0-57-9]|2[235-9]|3[03-57-9]|[45]\\d|6[02457-9]|7[1-69]|8[0-25-9]|9[02-9])|9\\d\\d)\\d{7}|(?:6(?:(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|8[124-6])\\d|7(?:[235689]\\d|4[0189]))|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-5])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]|881))[0189]\\d{5}', + 'ExampleNumber' => '8123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '000800\\d{7}|1(?:600\\d{6}|80(?:0\\d{4,9}|3\\d{9}))', + 'ExampleNumber' => '1800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '186[12]\\d{9}', + 'ExampleNumber' => '1861123456789', + 'PossibleLength' => + [ + 0 => 13, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '1860\\d{7}', + 'ExampleNumber' => '18603451234', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '140\\d{7}', + 'ExampleNumber' => '1409305260', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '1(?:600\\d{6}|800\\d{4,9})|(?:000800|18(?:03\\d\\d|6(?:0|[12]\\d\\d)))\\d{7}', + ], + 'id' => 'IN', + 'countryCode' => 91, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{7})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '575', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{8})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '5(?:0|2[23]|3[03]|[67]1|88)', + 1 => '5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)', + 2 => '5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{4,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '180', + 1 => '1800', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '140', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '11|2[02]|33|4[04]|79[1-7]|80[2-46]', + 1 => '11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])', + 2 => '11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]', + 1 => '1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]', + 2 => '1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 6 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807', + 1 => '1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]', + 2 => '1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 7 => + [ + 'pattern' => '(\\d{5})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[6-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 8 => + [ + 'pattern' => '(\\d{4})(\\d{2,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:6|8[06])', + 1 => '1(?:6|8[06]0)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 9 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '18', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{8})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '5(?:0|2[23]|3[03]|[67]1|88)', + 1 => '5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)', + 2 => '5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '180', + 1 => '1800', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '140', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '11|2[02]|33|4[04]|79[1-7]|80[2-46]', + 1 => '11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])', + 2 => '11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]', + 1 => '1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]', + 2 => '1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 5 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807', + 1 => '1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]', + 2 => '1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 6 => + [ + 'pattern' => '(\\d{5})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[6-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 7 => + [ + 'pattern' => '(\\d{4})(\\d{2,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:6|8[06])', + 1 => '1(?:6|8[06]0)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 8 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '18', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IO.php new file mode 100644 index 00000000000..ab3274a54dd --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IO.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '3\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '37\\d{5}', + 'ExampleNumber' => '3709100', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '38\\d{5}', + 'ExampleNumber' => '3801234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'IO', + 'countryCode' => 246, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IQ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IQ.php new file mode 100644 index 00000000000..0dd09656c79 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IQ.php @@ -0,0 +1,159 @@ + + [ + 'NationalNumberPattern' => '(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1\\d{7}|(?:2[13-5]|3[02367]|4[023]|5[03]|6[026])\\d{6,7}', + 'ExampleNumber' => '12345678', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[3-9]\\d{8}', + 'ExampleNumber' => '7912345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'IQ', + 'countryCode' => 964, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IR.php new file mode 100644 index 00000000000..b8ed112f239 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IR.php @@ -0,0 +1,180 @@ + + [ + 'NationalNumberPattern' => '[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + 4 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])(?:[03-57]\\d{7}|[16]\\d{3}(?:\\d{4})?|[289]\\d{3}(?:\\d(?:\\d{3})?)?)|94(?:000[09]|(?:12\\d|30[0-2])\\d|2(?:121|[2689]0\\d)|4(?:111|40\\d))\\d{4}', + 'ExampleNumber' => '2123456789', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9(?:(?:0(?:[0-35]\\d|4[4-6])|(?:[13]\\d|2[0-3])\\d)\\d|9(?:[0-46]\\d\\d|5[15]0|8(?:[12]\\d|88)|9(?:0[0-3]|[19]\\d|21|69|77|8[7-9])))\\d{5}', + 'ExampleNumber' => '9123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '96(?:0[12]|2[16-8]|3(?:08|[14]5|[23]|66)|4(?:0|80)|5[01]|6[89]|86|9[19])', + 'ExampleNumber' => '9601', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '9(?:4440\\d{5}|6(?:0[12]|2[16-8]|3(?:08|[14]5|[23]|66)|4(?:0|80)|5[01]|6[89]|86|9[19]))', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 10, + ], + ], + 'id' => 'IR', + 'countryCode' => 98, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4,5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '96', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{4,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-8]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IS.php new file mode 100644 index 00000000000..fe29bb6544b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IS.php @@ -0,0 +1,140 @@ + + [ + 'NationalNumberPattern' => '(?:38\\d|[4-9])\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:4(?:1[0-24-69]|2[0-7]|[37][0-8]|4[0-24589]|5[0-68]|6\\d|8[0-36-8])|5(?:05|[156]\\d|2[02578]|3[0-579]|4[03-7]|7[0-2578]|8[0-35-9]|9[013-689])|872)\\d{4}', + 'ExampleNumber' => '4101234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:38[589]\\d\\d|6(?:1[1-8]|2[0-6]|3[026-9]|4[014679]|5[0159]|6[0-69]|70|8[06-8]|9\\d)|7(?:5[057]|[6-9]\\d)|8(?:2[0-59]|[3-69]\\d|8[238]))\\d{4}', + 'ExampleNumber' => '6111234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-8]\\d{4}', + 'ExampleNumber' => '8001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90(?:0\\d|1[5-79]|2[015-79]|3[135-79]|4[125-7]|5[25-79]|7[1-37]|8[0-35-7])\\d{3}', + 'ExampleNumber' => '9001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '49[0-24-79]\\d{4}', + 'ExampleNumber' => '4921234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '809\\d{4}', + 'ExampleNumber' => '8091234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '(?:689|8(?:7[18]|80)|95[48])\\d{4}', + 'ExampleNumber' => '6891234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'IS', + 'countryCode' => 354, + 'internationalPrefix' => '00|1(?:0(?:01|[12]0)|100)', + 'preferredInternationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[4-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IT.php new file mode 100644 index 00000000000..9c73360679d --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_IT.php @@ -0,0 +1,410 @@ + + [ + 'NationalNumberPattern' => '0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + 6 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}', + 'ExampleNumber' => '0212345678', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '3[2-9]\\d{7,8}|(?:31|43)\\d{8}', + 'ExampleNumber' => '3123456789', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80(?:0\\d{3}|3)\\d{3}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}', + 'ExampleNumber' => '899123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '84(?:[08]\\d{3}|[17])\\d{3}', + 'ExampleNumber' => '848123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '1(?:78\\d|99)\\d{6}', + 'ExampleNumber' => '1781234567', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '55\\d{8}', + 'ExampleNumber' => '5512345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '3[2-8]\\d{9,10}', + 'ExampleNumber' => '33101234501', + 'PossibleLength' => + [ + 0 => 11, + 1 => 12, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '848\\d{6}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'id' => 'IT', + 'countryCode' => 39, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4,5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:0|9[246])', + 1 => '1(?:0|9(?:2[2-9]|[46]))', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:1|92)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{4,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0[26]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0[13-57-9][0159]|8(?:03|4[17]|9[2-5])', + 1 => '0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{2,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0(?:[13-579][2-46-8]|8[236-8])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '894', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0[26]|5', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:44|[679])|[378]|43', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0[13-57-9][0159]|14', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0[26]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 11 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4,5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{4,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0[26]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0[13-57-9][0159]|8(?:03|4[17]|9[2-5])', + 1 => '0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{2,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0(?:[13-579][2-46-8]|8[236-8])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '894', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0[26]|5', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:44|[679])|[378]|43', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0[13-57-9][0159]|14', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0[26]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4,5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JE.php new file mode 100644 index 00000000000..085996b1c6c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JE.php @@ -0,0 +1,99 @@ + + [ + 'NationalNumberPattern' => '1534\\d{6}|(?:[3578]\\d|90)\\d{8}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1534[0-24-8]\\d{5}', + 'ExampleNumber' => '1534456789', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}', + 'ExampleNumber' => '7797712345', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80(?:07(?:35|81)|8901)\\d{4}', + 'ExampleNumber' => '8007354567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}', + 'ExampleNumber' => '9018105678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '701511\\d{4}', + 'ExampleNumber' => '7015115678', + ], + 'voip' => + [ + 'NationalNumberPattern' => '56\\d{8}', + 'ExampleNumber' => '5612345678', + ], + 'pager' => + [ + 'NationalNumberPattern' => '76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}', + 'ExampleNumber' => '7640123456', + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}', + 'ExampleNumber' => '5512345678', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'JE', + 'countryCode' => 44, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '([0-24-8]\\d{5})$|0', + 'nationalPrefixTransformRule' => '1534$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JM.php new file mode 100644 index 00000000000..024970faab8 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JM.php @@ -0,0 +1,109 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|658|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '8766060\\d{3}|(?:658(?:2(?:[0-8]\\d|9[0-46-9])|[3-9]\\d\\d)|876(?:52[35]|6(?:0[1-3579]|1[0235-9]|[23]\\d|40|5[06]|6[2-589]|7[0-25-9]|8[04]|9[4-9])|7(?:0[2-689]|[1-6]\\d|8[056]|9[45])|9(?:0[1-8]|1[02378]|[2-8]\\d|9[2-468])))\\d{4}', + 'ExampleNumber' => '8765230123', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:658295|876(?:2(?:0[1-9]|[13-9]\\d|2[013-9])|[348]\\d\\d|5(?:0[1-9]|[1-9]\\d)|6(?:4[89]|6[67])|7(?:0[07]|7\\d|8[1-47-9]|9[0-36-9])|9(?:[01]9|9[0579])))\\d{4}', + 'ExampleNumber' => '8762101234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'JM', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '658|876', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JO.php new file mode 100644 index 00000000000..3c96bb3f839 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JO.php @@ -0,0 +1,171 @@ + + [ + 'NationalNumberPattern' => '(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '87(?:000|90[01])\\d{3}|(?:2(?:6(?:2[0-35-9]|3[0-578]|4[24-7]|5[0-24-8]|[6-8][023]|9[0-3])|7(?:0[1-79]|10|2[014-7]|3[0-689]|4[019]|5[0-3578]))|32(?:0[1-69]|1[1-35-7]|2[024-7]|3\\d|4[0-3]|[5-7][023])|53(?:0[0-3]|[13][023]|2[0-59]|49|5[0-35-9]|6[15]|7[45]|8[1-6]|9[0-36-9])|6(?:2(?:[05]0|22)|3(?:00|33)|4(?:0[0-25]|1[2-7]|2[0569]|[38][07-9]|4[025689]|6[0-589]|7\\d|9[0-2])|5(?:[01][056]|2[034]|3[0-57-9]|4[178]|5[0-69]|6[0-35-9]|7[1-379]|8[0-68]|9[0239]))|87(?:20|7[078]|99))\\d{4}', + 'ExampleNumber' => '62001234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:[78][0-25-9]|9\\d)\\d{6}', + 'ExampleNumber' => '790123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{6}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9\\d{7}', + 'ExampleNumber' => '90012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '85\\d{6}', + 'ExampleNumber' => '85012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{7}', + 'ExampleNumber' => '700123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '74(?:66|77)\\d{5}', + 'ExampleNumber' => '746612345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '8(?:10|8\\d)\\d{5}', + 'ExampleNumber' => '88101234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'JO', + 'countryCode' => 962, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2356]|87', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '70', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JP.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JP.php new file mode 100644 index 00000000000..bead7a66d33 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_JP.php @@ -0,0 +1,418 @@ + + [ + 'NationalNumberPattern' => '00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + 4 => 12, + 5 => 13, + 6 => 14, + 7 => 15, + 8 => 16, + 9 => 17, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:1[235-8]|2[3-6]|3[3-9]|4[2-6]|[58][2-8]|6[2-7]|7[2-9]|9[1-9])|(?:2[2-9]|[36][1-9])\\d|4(?:[2-578]\\d|6[02-8]|9[2-59])|5(?:[2-589]\\d|6[1-9]|7[2-8])|7(?:[25-9]\\d|3[4-9]|4[02-9])|8(?:[2679]\\d|3[2-9]|4[5-9]|5[1-9]|8[03-9])|9(?:[2-58]\\d|[679][1-9]))\\d{6}', + 'ExampleNumber' => '312345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[7-9]0[1-9]\\d{7}', + 'ExampleNumber' => '9012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '00777(?:[01]|5\\d)\\d\\d|(?:00(?:7778|882[1245])|(?:120|800\\d)\\d\\d)\\d{4}|00(?:37|66|78)\\d{6,13}', + 'ExampleNumber' => '120123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '990\\d{6}', + 'ExampleNumber' => '990123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '60\\d{7}', + 'ExampleNumber' => '601234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '50[1-9]\\d{7}', + 'ExampleNumber' => '5012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '20\\d{8}', + 'ExampleNumber' => '2012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '570\\d{6}', + 'ExampleNumber' => '570123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '00(?:777(?:[01]|(?:5|8\\d)\\d)|882[1245]\\d\\d)\\d\\d|00(?:37|66|78)\\d{6,13}', + ], + 'id' => 'JP', + 'countryCode' => 81, + 'internationalPrefix' => '010', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '(000[259]\\d{6})$|(?:(?:003768)0?)|0', + 'nationalPrefixTransformRule' => '$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '007', + 1 => '0077', + 2 => '00777', + 3 => '00777[01]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:12|57|99)0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d)(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])', + 1 => '1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]', + 2 => '1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '60', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[36]|4(?:2[09]|7[01])', + 1 => '[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])', + 1 => '1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]', + 2 => '1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[14]|[289][2-9]|5[3-9]|7[2-4679]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{3,4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '007', + 1 => '0077', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '008', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '800', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[257-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 11 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3,4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 12 => + [ + 'pattern' => '(\\d{4})(\\d{4})(\\d{4,5})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 13 => + [ + 'pattern' => '(\\d{4})(\\d{5})(\\d{5,6})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 14 => + [ + 'pattern' => '(\\d{4})(\\d{6})(\\d{6,7})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:12|57|99)0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d)(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])', + 1 => '1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]', + 2 => '1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '60', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[36]|4(?:2[09]|7[01])', + 1 => '[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])', + 1 => '1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]', + 2 => '1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[14]|[289][2-9]|5[3-9]|7[2-4679]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '800', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[257-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KE.php new file mode 100644 index 00000000000..8aefddb3795 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KE.php @@ -0,0 +1,156 @@ + + [ + 'NationalNumberPattern' => '(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:4[245]|5[1-79]|6[01457-9])\\d{5,7}|(?:4[136]|5[08]|62)\\d{7}|(?:[24]0|66)\\d{6,7}', + 'ExampleNumber' => '202012345', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:1(?:0[0-6]|1[0-5]|2[014]|30)|7\\d\\d)\\d{6}', + 'ExampleNumber' => '712123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800[02-8]\\d{5,6}', + 'ExampleNumber' => '800223456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[02-9]\\d{5}', + 'ExampleNumber' => '900223456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KE', + 'countryCode' => 254, + 'internationalPrefix' => '000', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[24-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[17]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KG.php new file mode 100644 index 00000000000..0152d2a0882 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KG.php @@ -0,0 +1,155 @@ + + [ + 'NationalNumberPattern' => '8\\d{9}|[235-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '312(?:5[0-79]\\d|9(?:[0-689]\\d|7[0-24-9]))\\d{3}|(?:3(?:1(?:2[0-46-8]|3[1-9]|47|[56]\\d)|2(?:22|3[0-479]|6[0-7])|4(?:22|5[6-9]|6\\d)|5(?:22|3[4-7]|59|6\\d)|6(?:22|5[35-7]|6\\d)|7(?:22|3[468]|4[1-9]|59|[67]\\d)|9(?:22|4[1-8]|6\\d))|6(?:09|12|2[2-4])\\d)\\d{5}', + 'ExampleNumber' => '312123456', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '312(?:58\\d|973)\\d{3}|(?:2(?:0[0-35]|2\\d)|5[0-24-7]\\d|600|7(?:[07]\\d|55)|88[08]|9(?:12|9[05-9]))\\d{6}', + 'ExampleNumber' => '700123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6,7}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KG', + 'countryCode' => 996, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3(?:1[346]|[24-79])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[235-79]|88', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d)(\\d{2,3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KH.php new file mode 100644 index 00000000000..27daba8610a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KH.php @@ -0,0 +1,152 @@ + + [ + 'NationalNumberPattern' => '1\\d{9}|[1-9]\\d{7,8}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '23(?:4(?:[2-4]|[56]\\d)|[568]\\d\\d)\\d{4}|23[236-9]\\d{5}|(?:2[4-6]|3[2-6]|4[2-4]|[5-7][2-5])(?:(?:[237-9]|4[56]|5\\d)\\d{5}|6\\d{5,6})', + 'ExampleNumber' => '23756789', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:(?:1[28]|3[18]|9[67])\\d|6[016-9]|7(?:[07-9]|[16]\\d)|8(?:[013-79]|8\\d))\\d{6}|(?:1\\d|9[0-57-9])\\d{6}|(?:2[3-6]|3[2-6]|4[2-4]|[5-7][2-5])48\\d{5}', + 'ExampleNumber' => '91234567', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800(?:1\\d|2[019])\\d{4}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '1900(?:1\\d|2[09])\\d{4}', + 'ExampleNumber' => '1900123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KH', + 'countryCode' => 855, + 'internationalPrefix' => '00[14-9]', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KI.php new file mode 100644 index 00000000000..0331d82b651 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KI.php @@ -0,0 +1,109 @@ + + [ + 'NationalNumberPattern' => '(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:[24]\\d|3[1-9]|50|65(?:02[12]|12[56]|22[89]|[3-5]00)|7(?:27\\d\\d|3100|5(?:02[12]|12[56]|22[89]|[34](?:00|81)|500))|8[0-5])\\d{3}', + 'ExampleNumber' => '31234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:6200[01]|7(?:310[1-9]|5(?:02[03-9]|12[0-47-9]|22[0-7]|[34](?:0[1-9]|8[02-9])|50[1-9])))\\d{3}|(?:63\\d\\d|7(?:(?:[0146-9]\\d|2[0-689])\\d|3(?:[02-9]\\d|1[1-9])|5(?:[0-2][013-9]|[34][1-79]|5[1-9]|[6-9]\\d)))\\d{4}', + 'ExampleNumber' => '72001234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '30(?:0[01]\\d\\d|12(?:11|20))\\d\\d', + 'ExampleNumber' => '30010000', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KI', + 'countryCode' => 686, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KM.php new file mode 100644 index 00000000000..b954cc93354 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KM.php @@ -0,0 +1,118 @@ + + [ + 'NationalNumberPattern' => '[3478]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '7[4-7]\\d{5}', + 'ExampleNumber' => '7712345', + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[34]\\d{6}', + 'ExampleNumber' => '3212345', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '8\\d{6}', + 'ExampleNumber' => '8001234', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KM', + 'countryCode' => 269, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3478]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KN.php new file mode 100644 index 00000000000..9bad748d7bf --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KN.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '869(?:2(?:29|36)|302|4(?:6[015-9]|70)|56[5-7])\\d{4}', + 'ExampleNumber' => '8692361234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '869(?:48[89]|55[6-8]|66\\d|76[02-7])\\d{4}', + 'ExampleNumber' => '8697652917', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KN', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-7]\\d{6})$|1', + 'nationalPrefixTransformRule' => '869$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '869', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KP.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KP.php new file mode 100644 index 00000000000..1236f92e709 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KP.php @@ -0,0 +1,154 @@ + + [ + 'NationalNumberPattern' => '85\\d{6}|(?:19\\d|[2-7])\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:195|2)\\d|3[19]|4[159]|5[37]|6[17]|7[39]|85)\\d{6}', + 'ExampleNumber' => '21234567', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '19[1-3]\\d{7}', + 'ExampleNumber' => '1921234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '238[02-9]\\d{4}|2(?:[0-24-9]\\d|3[0-79])\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'id' => 'KP', + 'countryCode' => 850, + 'internationalPrefix' => '00|99', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KR.php new file mode 100644 index 00000000000..1b4a5b29960 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KR.php @@ -0,0 +1,379 @@ + + [ + 'NationalNumberPattern' => '00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + 6 => 12, + 7 => 13, + 8 => 14, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + 1 => 4, + 2 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2|3[1-3]|[46][1-4]|5[1-5])[1-9]\\d{6,7}|(?:3[1-3]|[46][1-4]|5[1-5])1\\d{2,3}', + 'ExampleNumber' => '22123456', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 8, + 3 => 9, + 4 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + 1 => 4, + 2 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '1(?:05(?:[0-8]\\d|9[0-6])|22[13]\\d)\\d{4,5}|1(?:0[0-46-9]|[16-9]\\d|2[013-9])\\d{6,7}', + 'ExampleNumber' => '1020000000', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '00(?:308\\d{6,7}|798\\d{7,9})|(?:00368|80)\\d{7}', + 'ExampleNumber' => '801234567', + 'PossibleLength' => + [ + 0 => 9, + 1 => 11, + 2 => 12, + 3 => 13, + 4 => 14, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '60[2-9]\\d{6}', + 'ExampleNumber' => '602345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '50\\d{8,9}', + 'ExampleNumber' => '5012345678', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '70\\d{8}', + 'ExampleNumber' => '7012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '15\\d{7,8}', + 'ExampleNumber' => '1523456789', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '1(?:5(?:22|33|44|66|77|88|99)|6(?:[07]0|44|6[0168]|88)|8(?:00|33|55|77|99))\\d{4}', + 'ExampleNumber' => '15441234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '00(?:3(?:08\\d{6,7}|68\\d{7})|798\\d{7,9})', + 'PossibleLength' => + [ + 0 => 11, + 1 => 12, + 2 => 13, + 3 => 14, + ], + ], + 'id' => 'KR', + 'countryCode' => 82, + 'internationalPrefix' => '00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0(8(?:[1-46-8]|5\\d\\d))?', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1[016-9]1', + 1 => '1[016-9]11', + 2 => '1[016-9]114', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:3[1-3]|[46][1-4]|5[1-5])1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{3,4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '60|8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[1346]|5[1-5]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[57]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{5})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '003', + 1 => '0030', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{2})(\\d{5})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{5})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{5})(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:3[1-3]|[46][1-4]|5[1-5])1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3,4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '60|8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[1346]|5[1-5]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[57]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{5})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '0$CC-$1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KW.php new file mode 100644 index 00000000000..849f37ac417 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KW.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '18\\d{5}|(?:[2569]\\d|41)\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:[23]\\d\\d|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7]))\\d{4}', + 'ExampleNumber' => '22345678', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:41\\d\\d|5(?:(?:[05]\\d|1[0-7]|6[56])\\d|2(?:22|5[25])|7(?:55|77)|88[58])|6(?:(?:0[034679]|5[015-9]|6\\d)\\d|1(?:00|11|6[16])|2[26]2|3[36]3|4[46]4|7(?:0[013-9]|[67]\\d)|8[68]8|9(?:[069]\\d|3[039]))|9(?:(?:[04679]\\d|8[057-9])\\d|1(?:1[01]|99)|2(?:00|2\\d)|3(?:00|3[03])|5(?:00|5\\d)))\\d{4}', + 'ExampleNumber' => '50012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '18\\d{5}', + 'ExampleNumber' => '1801234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KW', + 'countryCode' => 965, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[169]|2(?:[235]|4[1-35-9])|52', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[245]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KY.php new file mode 100644 index 00000000000..1d7ae8f7b09 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KY.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '(?:345|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '345(?:2(?:22|3[23]|44|66)|333|444|6(?:23|38|40)|7(?:30|4[35-79]|6[6-9]|77)|8(?:00|1[45]|[48]8)|9(?:14|4[035-9]))\\d{4}', + 'ExampleNumber' => '3452221234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '345(?:32[1-9]|42[0-4]|5(?:1[67]|2[5-79]|4[6-9]|50|76)|649|82[56]|9(?:1[679]|2[2-9]|3[06-9]|90))\\d{4}', + 'ExampleNumber' => '3453231234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:345976|900[2-9]\\d\\d)\\d{4}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '345849\\d{4}', + 'ExampleNumber' => '3458491234', + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'KY', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-9]\\d{6})$|1', + 'nationalPrefixTransformRule' => '345$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '345', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KZ.php new file mode 100644 index 00000000000..d8c3c2231e4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_KZ.php @@ -0,0 +1,130 @@ + + [ + 'NationalNumberPattern' => '(?:33622|8\\d{8})\\d{5}|[78]\\d{9}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 14, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:33622|7(?:1(?:0(?:[23]\\d|4[0-3]|59|63)|1(?:[23]\\d|4[0-79]|59)|2(?:[23]\\d|59)|3(?:2\\d|3[0-79]|4[0-35-9]|59)|4(?:[24]\\d|3[013-9]|5[1-9]|97)|5(?:2\\d|3[1-9]|4[0-7]|59)|6(?:[2-4]\\d|5[19]|61)|72\\d|8(?:[27]\\d|3[1-46-9]|4[0-5]|59))|2(?:1(?:[23]\\d|4[46-9]|5[3469])|2(?:2\\d|3[0679]|46|5[12679])|3(?:[2-4]\\d|5[139])|4(?:2\\d|3[1-35-9]|59)|5(?:[23]\\d|4[0-8]|59|61)|6(?:2\\d|3[1-9]|4[0-4]|59)|7(?:[2379]\\d|40|5[279])|8(?:[23]\\d|4[0-3]|59)|9(?:2\\d|3[124578]|59))))\\d{5}', + 'ExampleNumber' => '7123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:0[0-25-8]|47|6[0-4]|7[15-8]|85)\\d{7}', + 'ExampleNumber' => '7710009998', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|108\\d{3})\\d{7}', + 'ExampleNumber' => '8001234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '809\\d{7}', + 'ExampleNumber' => '8091234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '808\\d{7}', + 'ExampleNumber' => '8081234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '751\\d{7}', + 'ExampleNumber' => '7511234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '751\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'id' => 'KZ', + 'countryCode' => 7, + 'internationalPrefix' => '810', + 'preferredInternationalPrefix' => '8~10', + 'nationalPrefix' => '8', + 'nationalPrefixForParsing' => '8', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '33|7', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LA.php new file mode 100644 index 00000000000..e1d496eca4f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LA.php @@ -0,0 +1,158 @@ + + [ + 'NationalNumberPattern' => '[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[13]|[35-7][14]|41|8[1468])\\d{6}', + 'ExampleNumber' => '21212862', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:20(?:[2359]\\d|7[6-8]|88)|302\\d)\\d{6}', + 'ExampleNumber' => '2023123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '30[013-9]\\d{6}', + 'ExampleNumber' => '301234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LA', + 'countryCode' => 856, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2[13]|3[14]|[4-8]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '30[013-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[23]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LB.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LB.php new file mode 100644 index 00000000000..62857aaa444 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LB.php @@ -0,0 +1,131 @@ + + [ + 'NationalNumberPattern' => '[27-9]\\d{7}|[13-9]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '7(?:62|8[0-7]|9[04-9])\\d{4}|(?:[14-69]\\d|2(?:[14-69]\\d|[78][1-9])|7[2-57]|8[02-9])\\d{5}', + 'ExampleNumber' => '1123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '793(?:[01]\\d|2[0-4])\\d{3}|(?:(?:3|81)\\d|7(?:[01]\\d|6[013-9]|8[89]|9[12]))\\d{5}', + 'ExampleNumber' => '71123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9[01]\\d{6}', + 'ExampleNumber' => '90123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '80\\d{6}', + 'ExampleNumber' => '80123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LB', + 'countryCode' => 961, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[27-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LC.php new file mode 100644 index 00000000000..7fc21daa5b5 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LC.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|758|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '758(?:234|4(?:30|5\\d|6[2-9]|8[0-2])|57[0-2]|(?:63|75)8)\\d{4}', + 'ExampleNumber' => '7584305678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '758(?:28[4-7]|384|4(?:6[01]|8[4-9])|5(?:1[89]|20|84)|7(?:1[2-9]|2\\d|3[0-3])|812)\\d{4}', + 'ExampleNumber' => '7582845678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LC', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-8]\\d{6})$|1', + 'nationalPrefixTransformRule' => '758$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '758', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LI.php new file mode 100644 index 00000000000..4bf8d552ebe --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LI.php @@ -0,0 +1,160 @@ + + [ + 'NationalNumberPattern' => '[68]\\d{8}|(?:[2378]\\d|90)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:01|1[27]|2[02]|3\\d|6[02-578]|96)|3(?:[24]0|33|7[0135-7]|8[048]|9[0269]))\\d{4}', + 'ExampleNumber' => '2345678', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:6(?:(?:4[5-9]|5[0-469])\\d|6(?:[024-6]\\d|[17]0|3[7-9]))\\d|7(?:[37-9]\\d|42|56))\\d{4}', + 'ExampleNumber' => '660234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8002[28]\\d\\d|80(?:05\\d|9)\\d{4}', + 'ExampleNumber' => '8002222', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90(?:02[258]|1(?:23|3[14])|66[136])\\d\\d', + 'ExampleNumber' => '9002222', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '870(?:28|87)\\d\\d', + 'ExampleNumber' => '8702812', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '697(?:42|56|[78]\\d)\\d{4}', + 'ExampleNumber' => '697861234', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LI', + 'countryCode' => 423, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '(1001)|0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2379]|8(?:0[09]|7)', + 1 => '[2379]|8(?:0(?:02|9)|7)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '69', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LK.php new file mode 100644 index 00000000000..92112ab335c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LK.php @@ -0,0 +1,132 @@ + + [ + 'NationalNumberPattern' => '[1-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:12[2-9]|602|8[12]\\d|9(?:1\\d|22|9[245]))\\d{6}|(?:11|2[13-7]|3[1-8]|4[157]|5[12457]|6[35-7])[2-57]\\d{6}', + 'ExampleNumber' => '112345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:[0-25-8]\\d|4[0-4])\\d{6}', + 'ExampleNumber' => '712345678', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '1973\\d{5}', + 'ExampleNumber' => '197312345', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LK', + 'countryCode' => 94, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-689]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LR.php new file mode 100644 index 00000000000..db8b5543307 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LR.php @@ -0,0 +1,151 @@ + + [ + 'NationalNumberPattern' => '(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2\\d{7}', + 'ExampleNumber' => '21234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:(?:(?:22|33)0|555|(?:77|88)\\d)\\d|4(?:240|[67]))\\d{5}|[56]\\d{6}', + 'ExampleNumber' => '770123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '332(?:02|[34]\\d)\\d{4}', + 'ExampleNumber' => '332021234', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LR', + 'countryCode' => 231, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '4[67]|[56]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-578]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LS.php new file mode 100644 index 00000000000..b74165eb16b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LS.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[256]\\d\\d|800)\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2\\d{7}', + 'ExampleNumber' => '22123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[56]\\d{7}', + 'ExampleNumber' => '50123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800[1256]\\d{4}', + 'ExampleNumber' => '80021234', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LS', + 'countryCode' => 266, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2568]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LT.php new file mode 100644 index 00000000000..99777a461bc --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LT.php @@ -0,0 +1,138 @@ + + [ + 'NationalNumberPattern' => '(?:[3469]\\d|52|[78]0)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3[1478]|4[124-6]|52)\\d{6}', + 'ExampleNumber' => '31234567', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6\\d{7}', + 'ExampleNumber' => '61234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[02]\\d{5}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9(?:0[0239]|10)\\d{5}', + 'ExampleNumber' => '90012345', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '808\\d{5}', + 'ExampleNumber' => '80812345', + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70[05]\\d{5}', + 'ExampleNumber' => '70012345', + ], + 'voip' => + [ + 'NationalNumberPattern' => '[89]01\\d{5}', + 'ExampleNumber' => '80123456', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '70[67]\\d{5}', + 'ExampleNumber' => '70712345', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LT', + 'countryCode' => 370, + 'internationalPrefix' => '00', + 'nationalPrefix' => '8', + 'nationalPrefixForParsing' => '[08]', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '52[0-7]', + ], + 'nationalPrefixFormattingRule' => '(8-$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[7-9]', + ], + 'nationalPrefixFormattingRule' => '8 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '37|4(?:[15]|6[1-8])', + ], + 'nationalPrefixFormattingRule' => '(8-$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[3-6]', + ], + 'nationalPrefixFormattingRule' => '(8-$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LU.php new file mode 100644 index 00000000000..90719362785 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LU.php @@ -0,0 +1,234 @@ + + [ + 'NationalNumberPattern' => '35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + 4 => 8, + 5 => 9, + 6 => 10, + 7 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:35[013-9]|80[2-9]|90[89])\\d{1,8}|(?:2[2-9]|3[0-46-9]|[457]\\d|8[13-9]|9[2-579])\\d{2,9}', + 'ExampleNumber' => '27123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6(?:[269][18]|5[1568]|7[189]|81)\\d{6}', + 'ExampleNumber' => '628123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[015]\\d{5}', + 'ExampleNumber' => '90012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '801\\d{5}', + 'ExampleNumber' => '80112345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '20(?:1\\d{5}|[2-689]\\d{1,7})', + 'ExampleNumber' => '20201234', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + 4 => 8, + 5 => 9, + 6 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LU', + 'countryCode' => 352, + 'internationalPrefix' => '00', + 'nationalPrefixForParsing' => '(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '20[2-689]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:[0367]|4[3-8])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '80[01]|90[015]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '20', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:[0367]|4[3-8])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LV.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LV.php new file mode 100644 index 00000000000..6aff8486003 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LV.php @@ -0,0 +1,106 @@ + + [ + 'NationalNumberPattern' => '(?:[268]\\d|90)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '6\\d{7}', + 'ExampleNumber' => '63123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '23(?:23[0-57-9]|33[0238])\\d{3}|2(?:[0-24-9]\\d\\d|3(?:0[07]|[14-9]\\d|2[024-9]|3[0-24-9]))\\d{4}', + 'ExampleNumber' => '21234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{6}', + 'ExampleNumber' => '80123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90\\d{6}', + 'ExampleNumber' => '90123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '81\\d{6}', + 'ExampleNumber' => '81123456', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LV', + 'countryCode' => 371, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[269]|8[01]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LY.php new file mode 100644 index 00000000000..01e97559cd0 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_LY.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '[2-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:0[56]|[1-6]\\d|7[124579]|8[124])|3(?:1\\d|2[2356])|4(?:[17]\\d|2[1-357]|5[2-4]|8[124])|5(?:[1347]\\d|2[1-469]|5[13-5]|8[1-4])|6(?:[1-479]\\d|5[2-57]|8[1-5])|7(?:[13]\\d|2[13-79])|8(?:[124]\\d|5[124]|84))\\d{6}', + 'ExampleNumber' => '212345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9[1-6]\\d{7}', + 'ExampleNumber' => '912345678', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'LY', + 'countryCode' => 218, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MA.php new file mode 100644 index 00000000000..7bedefaf351 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MA.php @@ -0,0 +1,144 @@ + + [ + 'NationalNumberPattern' => '[5-8]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}', + 'ExampleNumber' => '520123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-4]|5[01]|8[0-3]))\\d{6}', + 'ExampleNumber' => '650123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-7]\\d{6}', + 'ExampleNumber' => '801234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '89\\d{7}', + 'ExampleNumber' => '891234567', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}', + 'ExampleNumber' => '592401234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MA', + 'countryCode' => 212, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '5[45]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{5})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{6})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[5-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MC.php new file mode 100644 index 00000000000..be1bd7d70af --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MC.php @@ -0,0 +1,197 @@ + + [ + 'NationalNumberPattern' => '(?:[3489]|6\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:870|9[2-47-9]\\d)\\d{5}', + 'ExampleNumber' => '99123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4(?:[46]\\d|5[1-9])\\d{5}|(?:3|6\\d)\\d{7}', + 'ExampleNumber' => '612345678', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:800|90\\d)\\d{5}', + 'ExampleNumber' => '90123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '8[07]0\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'id' => 'MC', + 'countryCode' => 377, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '87', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '4', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[389]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '4', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[389]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MD.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MD.php new file mode 100644 index 00000000000..3dca6e8b89b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MD.php @@ -0,0 +1,128 @@ + + [ + 'NationalNumberPattern' => '(?:[235-7]\\d|[89]0)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:2[1-9]|3[1-79])\\d|5(?:33|5[257]))\\d{5}', + 'ExampleNumber' => '22212345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '562\\d{5}|(?:6\\d|7[16-9])\\d{6}', + 'ExampleNumber' => '62112345', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[056]\\d{5}', + 'ExampleNumber' => '90012345', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '808\\d{5}', + 'ExampleNumber' => '80812345', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '3[08]\\d{6}', + 'ExampleNumber' => '30123456', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '803\\d{5}', + 'ExampleNumber' => '80312345', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MD', + 'countryCode' => 373, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '22|3', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[25-7]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ME.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ME.php new file mode 100644 index 00000000000..84b393d330b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ME.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:20[2-8]|3(?:[0-2][2-7]|3[24-7])|4(?:0[2-467]|1[2467])|5(?:0[2467]|1[24-7]|2[2-467]))\\d{5}', + 'ExampleNumber' => '30234567', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6(?:[07-9]\\d|3[024]|6[0-25])\\d{5}', + 'ExampleNumber' => '67622901', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80(?:[0-2578]|9\\d)\\d{5}', + 'ExampleNumber' => '80080002', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9(?:4[1568]|5[178])\\d{5}', + 'ExampleNumber' => '94515151', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '78[1-49]\\d{5}', + 'ExampleNumber' => '78108780', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '77[1-9]\\d{5}', + 'ExampleNumber' => '77273012', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ME', + 'countryCode' => 382, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MF.php new file mode 100644 index 00000000000..7c3470dc847 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MF.php @@ -0,0 +1,98 @@ + + [ + 'NationalNumberPattern' => '590\\d{6}|(?:69|80|9\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}', + 'ExampleNumber' => '590271234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))\\d{4}', + 'ExampleNumber' => '690001234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:(?:39[5-7]|76[018])\\d|475[0-5])\\d{4}', + 'ExampleNumber' => '976012345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MF', + 'countryCode' => 590, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MG.php new file mode 100644 index 00000000000..5b9bcd6170c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MG.php @@ -0,0 +1,121 @@ + + [ + 'NationalNumberPattern' => '[23]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2072[29]\\d{4}|20(?:2\\d|4[47]|5[3467]|6[279]|7[35]|8[268]|9[245])\\d{5}', + 'ExampleNumber' => '202123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '3[2-47-9]\\d{7}', + 'ExampleNumber' => '321234567', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '22\\d{7}', + 'ExampleNumber' => '221234567', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MG', + 'countryCode' => 261, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '([24-9]\\d{6})$|0', + 'nationalPrefixTransformRule' => '20$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{3})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[23]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MH.php new file mode 100644 index 00000000000..a8e7f9992c4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MH.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '329\\d{4}|(?:[256]\\d|45)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:247|528|625)\\d{4}', + 'ExampleNumber' => '2471234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:(?:23|54)5|329|45[35-8])\\d{4}', + 'ExampleNumber' => '2351234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '635\\d{4}', + 'ExampleNumber' => '6351234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MH', + 'countryCode' => 692, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-6]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MK.php new file mode 100644 index 00000000000..290dd32e1cd --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MK.php @@ -0,0 +1,142 @@ + + [ + 'NationalNumberPattern' => '[2-578]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:2(?:62|77)0|3444)\\d|4[56]440)\\d{3}|(?:34|4[357])700\\d{3}|(?:2(?:[0-3]\\d|5[0-578]|6[01]|82)|3(?:1[3-68]|[23][2-68]|4[23568])|4(?:[23][2-68]|4[3-68]|5[2568]|6[25-8]|7[24-68]|8[4-68]))\\d{5}', + 'ExampleNumber' => '22012345', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:3555|(?:474|9[019]7)7)\\d{3}|7(?:[0-25-8]\\d\\d|3(?:[1-48]\\d|6[01]|7[01578])|4(?:2\\d|60|7[01578])|9(?:[2-4]\\d|5[01]|7[015]))\\d{4}', + 'ExampleNumber' => '72345678', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '5\\d{7}', + 'ExampleNumber' => '50012345', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8(?:0[1-9]|[1-9]\\d)\\d{5}', + 'ExampleNumber' => '80123456', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MK', + 'countryCode' => 389, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2|34[47]|4(?:[37]7|5[47]|64)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[347]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d)(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[58]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ML.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ML.php new file mode 100644 index 00000000000..50e825565bf --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ML.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '[24-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:07[0-8]|12[67])\\d{4}|(?:2(?:02|1[4-689])|4(?:0[0-4]|4[1-39]))\\d{5}', + 'ExampleNumber' => '20212345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '2(?:0(?:01|79)|17\\d)\\d{4}|(?:5[01]|[679]\\d|8[2-49])\\d{6}', + 'ExampleNumber' => '65012345', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{6}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '80\\d{6}', + ], + 'id' => 'ML', + 'countryCode' => 223, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '67[057-9]|74[045]', + 1 => '67(?:0[09]|[59]9|77|8[89])|74(?:0[02]|44|55)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[24-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[24-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MM.php new file mode 100644 index 00000000000..630f01fcf34 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MM.php @@ -0,0 +1,240 @@ + + [ + 'NationalNumberPattern' => '1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:(?:2\\d|3[56]|[89][0-6])\\d|4(?:2[29]|62|7[0-2]|83)|6)|2(?:2(?:00|8[34])|4(?:0\\d|[26]2|7[0-2]|83)|51\\d\\d)|4(?:2(?:2\\d\\d|48[013])|3(?:20\\d|4(?:70|83)|56)|420\\d|5470)|6(?:0(?:[23]|88\\d)|(?:124|[56]2\\d)\\d|2472|3(?:20\\d|470)|4(?:2[04]\\d|472)|7(?:(?:3\\d|8[01459])\\d|4[67]0)))\\d{4}|5(?:2(?:2\\d{5,6}|47[02]\\d{4})|(?:3472|4(?:2(?:1|86)|470)|522\\d|6(?:20\\d|483)|7(?:20\\d|48[01])|8(?:20\\d|47[02])|9(?:20\\d|470))\\d{4})|7(?:(?:0470|4(?:25\\d|470)|5(?:202|470|96\\d))\\d{4}|1(?:20\\d{4,5}|4(?:70|83)\\d{4}))|8(?:1(?:2\\d{5,6}|4(?:10|7[01]\\d)\\d{3})|2(?:2\\d{5,6}|(?:320|490\\d)\\d{3})|(?:3(?:2\\d\\d|470)|4[24-7]|5(?:(?:2\\d|51)\\d|4(?:[1-35-9]\\d|4[0-57-9]))|6[23])\\d{4})|(?:1[2-6]\\d|4(?:2[24-8]|3[2-7]|[46][2-6]|5[3-5])|5(?:[27][2-8]|3[2-68]|4[24-8]|5[23]|6[2-4]|8[24-7]|9[2-7])|6(?:[19]20|42[03-6]|(?:52|7[45])\\d)|7(?:[04][24-8]|[15][2-7]|22|3[2-4])|8(?:1[2-689]|2[2-8]|[35]2\\d))\\d{4}|25\\d{5,6}|(?:2[2-9]|6(?:1[2356]|[24][2-6]|3[24-6]|5[2-4]|6[2-8]|7[235-7]|8[245]|9[24])|8(?:3[24]|5[245]))\\d{4}', + 'ExampleNumber' => '1234567', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:17[01]|9(?:2(?:[0-4]|[56]\\d\\d)|(?:3(?:[0-36]|4\\d)|(?:6\\d|8[89]|9[4-8])\\d|7(?:3|40|[5-9]\\d))\\d|4(?:(?:[0245]\\d|[1379])\\d|88)|5[0-6])\\d)\\d{4}|9[69]1\\d{6}|9(?:[68]\\d|9[089])\\d{5}', + 'ExampleNumber' => '92123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80080(?:0[1-9]|2\\d)\\d{3}', + 'ExampleNumber' => '8008001234', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '1333\\d{4}|[12]468\\d{4}', + 'ExampleNumber' => '13331234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MM', + 'countryCode' => 95, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '16|2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[12]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[4-7]|8[1-35]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4,6})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:2[0-4]|[35-9]|4[137-9])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '92', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d)(\\d{5})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MN.php new file mode 100644 index 00000000000..eefe62a0b49 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MN.php @@ -0,0 +1,183 @@ + + [ + 'NationalNumberPattern' => '[12]\\d{7,9}|[5-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[12]2[1-3]\\d{5,6}|(?:(?:[12](?:1|27)|5[368])\\d\\d|7(?:0(?:[0-5]\\d|7[078]|80)|128))\\d{4}|[12](?:3[2-8]|4[2-68]|5[1-4689])\\d{6,7}', + 'ExampleNumber' => '53123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:83[01]|92[039])\\d{5}|(?:5[05]|6[069]|8[015689]|9[013-9])\\d{6}', + 'ExampleNumber' => '88123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '712[0-79]\\d{4}|7(?:1[013-9]|[25-9]\\d)\\d{5}', + 'ExampleNumber' => '75123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MN', + 'countryCode' => 976, + 'internationalPrefix' => '001', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[12]1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[5-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[12]2[1-3]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{5,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[12](?:27|3[2-8]|4[2-68]|5[1-4689])', + 1 => '[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{5})(\\d{4,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[12]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MO.php new file mode 100644 index 00000000000..7f2303ead9c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MO.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '0800\\d{3}|(?:28|[68]\\d)\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:28[2-9]|8(?:11|[2-57-9]\\d))\\d{5}', + 'ExampleNumber' => '28212345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6800[0-79]\\d{3}|6(?:[235]\\d\\d|6(?:0[0-5]|[1-9]\\d)|8(?:0[1-9]|[14-8]\\d|2[5-9]|[39][0-4]))\\d{4}', + 'ExampleNumber' => '66123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '0800\\d{3}', + 'ExampleNumber' => '0800501', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MO', + 'countryCode' => 853, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[268]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MP.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MP.php new file mode 100644 index 00000000000..d3357d3b6b8 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MP.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '[58]\\d{9}|(?:67|90)0\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '670(?:2(?:3[3-7]|56|8[4-8])|32[1-38]|4(?:33|8[348])|5(?:32|55|88)|6(?:64|70|82)|78[3589]|8[3-9]8|989)\\d{4}', + 'ExampleNumber' => '6702345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '670(?:2(?:3[3-7]|56|8[4-8])|32[1-38]|4(?:33|8[348])|5(?:32|55|88)|6(?:64|70|82)|78[3589]|8[3-9]8|989)\\d{4}', + 'ExampleNumber' => '6702345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MP', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-9]\\d{6})$|1', + 'nationalPrefixTransformRule' => '670$1', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '670', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MQ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MQ.php new file mode 100644 index 00000000000..cff1f9b810c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MQ.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '596\\d{6}|(?:69|80|9\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '596(?:[03-7]\\d|1[05]|2[7-9]|8[0-39]|9[04-9])\\d{4}', + 'ExampleNumber' => '596301234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '69(?:6(?:[0-46-9]\\d|5[0-6])|727)\\d{4}', + 'ExampleNumber' => '696201234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:397[0-3]|477[0-5]|76(?:6\\d|7[0-367]))\\d{4}', + 'ExampleNumber' => '976612345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MQ', + 'countryCode' => 596, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[569]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MR.php new file mode 100644 index 00000000000..0e7bef724bc --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MR.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[2-4]\\d\\d|800)\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:25[08]|35\\d|45[1-7])\\d{5}', + 'ExampleNumber' => '35123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[2-4][0-46-9]\\d{6}', + 'ExampleNumber' => '22123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MR', + 'countryCode' => 222, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2-48]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MS.php new file mode 100644 index 00000000000..0fb8bfd55ba --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MS.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|664|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '6644(?:1[0-3]|91)\\d{4}', + 'ExampleNumber' => '6644912345', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '664(?:3(?:49|9[1-6])|49[2-6])\\d{4}', + 'ExampleNumber' => '6644923456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MS', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([34]\\d{6})$|1', + 'nationalPrefixTransformRule' => '664$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '664', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MT.php new file mode 100644 index 00000000000..57f6f56f3c7 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MT.php @@ -0,0 +1,102 @@ + + [ + 'NationalNumberPattern' => '3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '20(?:3[1-4]|6[059])\\d{4}|2(?:0[19]|[1-357]\\d|60)\\d{5}', + 'ExampleNumber' => '21001234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:7(?:210|[79]\\d\\d)|9(?:[29]\\d\\d|69[67]|8(?:1[1-3]|89|97)))\\d{4}', + 'ExampleNumber' => '96961234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800(?:02|[3467]\\d)\\d{3}', + 'ExampleNumber' => '80071234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '5(?:0(?:0(?:37|43)|(?:6\\d|70|9[0168])\\d)|[12]\\d0[1-5])\\d{3}', + 'ExampleNumber' => '50037123', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '3550\\d{4}', + 'ExampleNumber' => '35501234', + ], + 'pager' => + [ + 'NationalNumberPattern' => '7117\\d{4}', + 'ExampleNumber' => '71171234', + ], + 'uan' => + [ + 'NationalNumberPattern' => '501\\d{5}', + 'ExampleNumber' => '50112345', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MT', + 'countryCode' => 356, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2357-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MU.php new file mode 100644 index 00000000000..5ca02353bb9 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MU.php @@ -0,0 +1,155 @@ + + [ + 'NationalNumberPattern' => '(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:[0346-8]\\d|1[0-7])|4(?:[013568]\\d|2[4-8])|54(?:[3-5]\\d|71)|6\\d\\d|8(?:14|3[129]))\\d{4}', + 'ExampleNumber' => '54480123', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '5(?:4(?:2[1-389]|7[1-9])|87[15-8])\\d{4}|(?:5(?:2[5-9]|4[3-689]|[57]\\d|8[0-689]|9[0-8])|7(?:0[0-3]|3[013]))\\d{5}', + 'ExampleNumber' => '52512345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '802\\d{7}|80[0-2]\\d{4}', + 'ExampleNumber' => '8001234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '30\\d{5}', + 'ExampleNumber' => '3012345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '3(?:20|9\\d)\\d{4}', + 'ExampleNumber' => '3201234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MU', + 'countryCode' => 230, + 'internationalPrefix' => '0(?:0|[24-7]0|3[03])', + 'preferredInternationalPrefix' => '020', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-46]|8[013]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[57]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{5})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MV.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MV.php new file mode 100644 index 00000000000..f6f91f9b975 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MV.php @@ -0,0 +1,140 @@ + + [ + 'NationalNumberPattern' => '(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3(?:0[0-3]|3[0-59])|6(?:[58][024689]|6[024-68]|7[02468]))\\d{4}', + 'ExampleNumber' => '6701234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:46[46]|[79]\\d\\d)\\d{4}', + 'ExampleNumber' => '7712345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{7}', + 'ExampleNumber' => '9001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '4(?:0[01]|50)\\d{4}', + 'ExampleNumber' => '4001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MV', + 'countryCode' => 960, + 'internationalPrefix' => '0(?:0|19)', + 'preferredInternationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[34679]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MW.php new file mode 100644 index 00000000000..1a1541310f4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MW.php @@ -0,0 +1,143 @@ + + [ + 'NationalNumberPattern' => '(?:[1289]\\d|31|77)\\d{7}|1\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1[2-9]|2[12]\\d\\d)\\d{5}', + 'ExampleNumber' => '1234567', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '111\\d{6}|(?:31|77|[89][89])\\d{7}', + 'ExampleNumber' => '991234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MW', + 'countryCode' => 265, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[2-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[137-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MX.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MX.php new file mode 100644 index 00000000000..a4007901137 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MX.php @@ -0,0 +1,242 @@ + + [ + 'NationalNumberPattern' => '1(?:(?:22|44|7[27]|87|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-689]|8[1-69]|9[1-8])|[2-9]\\d)\\d{8}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '657[12]\\d{6}|(?:2(?:0[01]|2\\d|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1346][1-9]|[27]\\d|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[0-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}', + 'ExampleNumber' => '2001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '657[12]\\d{6}|(?:1(?:2(?:2[1-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[24-7][1-9]|3[1-8]|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1-467][1-9]|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|[69][1-9]|7[12]|8[1-8]))|2(?:2\\d|3[1-35-8]|4[13-9]|7[1-689]|8[1-578]|9[467])|3(?:1[1-79]|[2458][1-9]|3\\d|7[1-8]|9[1-5])|4(?:1[1-57-9]|[25-7][1-9]|3[1-8]|4\\d|8[1-35-9]|9[2-689])|5(?:[56]\\d|88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[1-57-9]|7[1-7]|8[67]|9[4-8])|7(?:[1346][1-9]|[27]\\d|5[13-9]|8[1-69]|9[17])|8(?:1\\d|2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[0-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|6[1-9]|7[12]|8[1-8]|9\\d))\\d{7}', + 'ExampleNumber' => '12221234567', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|88)\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{7}', + 'ExampleNumber' => '9001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '300\\d{7}', + 'ExampleNumber' => '3001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '500\\d{7}', + 'ExampleNumber' => '5001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MX', + 'countryCode' => 52, + 'internationalPrefix' => '0[09]', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '01', + 'nationalPrefixForParsing' => '0(?:[12]|4[45])|1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '53', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '33|5[56]|81', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:33|5[56]|81)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '33|5[56]|81', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:33|5[56]|81)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MY.php new file mode 100644 index 00000000000..938e1615d20 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MY.php @@ -0,0 +1,203 @@ + + [ + 'NationalNumberPattern' => '1\\d{8,9}|(?:3\\d|[4-9])\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3(?:2[0-36-9]|3[0-368]|4[0-278]|5[0-24-8]|6[0-467]|7[1246-9]|8\\d|9[0-57])\\d|4(?:2[0-689]|[3-79]\\d|8[1-35689])|5(?:2[0-589]|[3468]\\d|5[0-489]|7[1-9]|9[23])|6(?:2[2-9]|3[1357-9]|[46]\\d|5[0-6]|7[0-35-9]|85|9[015-8])|7(?:[2579]\\d|3[03-68]|4[0-8]|6[5-9]|8[0-35-9])|8(?:[24][2-8]|3[2-5]|5[2-7]|6[2-589]|7[2-578]|[89][2-9])|9(?:0[57]|13|[25-7]\\d|[3489][0-8]))\\d{5}', + 'ExampleNumber' => '323856789', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '1(?:1888[689]|4400|8(?:47|8[27])[0-4])\\d{4}|1(?:0(?:[23568]\\d|4[0-6]|7[016-9]|9[0-8])|1(?:[1-5]\\d\\d|6(?:0[5-9]|[1-9]\\d)|7(?:[0-4]\\d|5[0-7]))|(?:[269]\\d|[37][1-9]|4[235-9])\\d|5(?:31|9\\d\\d)|8(?:1[23]|[236]\\d|4[06]|5(?:46|[7-9])|7[016-9]|8[01]|9[0-8]))\\d{5}', + 'ExampleNumber' => '123456789', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1[378]00\\d{6}', + 'ExampleNumber' => '1300123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '1600\\d{6}', + 'ExampleNumber' => '1600123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '15(?:4(?:6[0-4]\\d|8(?:0[125]|[17]\\d|21|3[01]|4[01589]|5[014]|6[02]))|6(?:32[0-6]|78\\d))\\d{4}', + 'ExampleNumber' => '1546012345', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MY', + 'countryCode' => 60, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[4-79]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:[02469]|[378][1-9]|53)|8', + 1 => '1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{2})(\\d{4})', + 'format' => '$1-$2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '1(?:[367]|80)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '15', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MZ.php new file mode 100644 index 00000000000..40a19d8b49e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_MZ.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '(?:2|8\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:[1346]\\d|5[0-2]|[78][12]|93)\\d{5}', + 'ExampleNumber' => '21123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '8[2-79]\\d{7}', + 'ExampleNumber' => '821234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'MZ', + 'countryCode' => 258, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2|8[2-79]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NA.php new file mode 100644 index 00000000000..1d83be93d83 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NA.php @@ -0,0 +1,157 @@ + + [ + 'NationalNumberPattern' => '[68]\\d{7,8}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '64426\\d{3}|6(?:1(?:2[2-7]|3[01378]|4[0-4])|254|32[0237]|4(?:27|41|5[25])|52[236-8]|626|7(?:2[2-4]|30))\\d{4,5}|6(?:1(?:(?:0\\d|2[0189]|3[24-69]|4[5-9])\\d|17|69|7[014])|2(?:17|5[0-36-8]|69|70)|3(?:17|2[14-689]|34|6[289]|7[01]|81)|4(?:17|2[0-2]|4[06]|5[0137]|69|7[01])|5(?:17|2[0459]|69|7[01])|6(?:17|25|38|42|69|7[01])|7(?:17|2[569]|3[13]|6[89]|7[01]))\\d{4}', + 'ExampleNumber' => '61221234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:60|8[1245])\\d{7}', + 'ExampleNumber' => '811234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{7}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '8701\\d{5}', + 'ExampleNumber' => '870123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '8(?:3\\d\\d|86)\\d{5}', + 'ExampleNumber' => '88612345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NA', + 'countryCode' => 264, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '88', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '87', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NC.php new file mode 100644 index 00000000000..f67ad0d8965 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NC.php @@ -0,0 +1,135 @@ + + [ + 'NationalNumberPattern' => '(?:050|[2-57-9]\\d\\d)\\d{3}', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[03-9]|3[0-5]|4[1-7]|88)\\d{4}', + 'ExampleNumber' => '201234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5[0-4]|[79]\\d|8[0-79])\\d{4}', + 'ExampleNumber' => '751234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '050\\d{3}', + 'ExampleNumber' => '050012', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '36\\d{4}', + 'ExampleNumber' => '366711', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NC', + 'countryCode' => 687, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '5[6-8]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1.$2.$3', + 'leadingDigitsPatterns' => + [ + 0 => '[02-57-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1.$2.$3', + 'leadingDigitsPatterns' => + [ + 0 => '[02-57-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NE.php new file mode 100644 index 00000000000..cf0bed3d4eb --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NE.php @@ -0,0 +1,120 @@ + + [ + 'NationalNumberPattern' => '[027-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:0(?:20|3[1-8]|4[13-5]|5[14]|6[14578]|7[1-578])|1(?:4[145]|5[14]|6[14-68]|7[169]|88))\\d{4}', + 'ExampleNumber' => '20201234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:23|7[047]|[89]\\d)\\d{6}', + 'ExampleNumber' => '93123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '08\\d{6}', + 'ExampleNumber' => '08123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '09\\d{6}', + 'ExampleNumber' => '09123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NE', + 'countryCode' => 227, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '08', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[089]|2[013]|7[047]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NF.php new file mode 100644 index 00000000000..013b3220be0 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NF.php @@ -0,0 +1,138 @@ + + [ + 'NationalNumberPattern' => '[13]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:06|17|28|39)|3[0-2]\\d)\\d{3}', + 'ExampleNumber' => '106609', + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:14|3[58])\\d{4}', + 'ExampleNumber' => '381234', + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NF', + 'countryCode' => 672, + 'internationalPrefix' => '00', + 'nationalPrefixForParsing' => '([0-258]\\d{4})$', + 'nationalPrefixTransformRule' => '3$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1[0-3]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[13]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NG.php new file mode 100644 index 00000000000..907bb99e0d2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NG.php @@ -0,0 +1,236 @@ + + [ + 'NationalNumberPattern' => '2[0-24-9]\\d{8}|[78]\\d{10,13}|[7-9]\\d{9}|[1-9]\\d{7}|[124-7]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 10, + 3 => 11, + 4 => 12, + 5 => 13, + 6 => 14, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '20(?:[1259]\\d|3[013-9]|4[1-8]|6[024-689]|7[1-79]|8[2-9])\\d{6}|(?:(?:[1-356]\\d|4[02-8]|8[2-9])\\d|9(?:0[3-9]|[1-9]\\d))\\d{5}|7(?:0(?:[013-689]\\d|2[0-24-9])\\d{3,4}|[1-79]\\d{6})|(?:[12]\\d|4[147]|5[14579]|6[1578]|7[1-3578])\\d{5}', + 'ExampleNumber' => '18040123', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:702[0-24-9]|819[01])\\d{6}|(?:7(?:0[13-9]|[12]\\d)|8(?:0[1-9]|1[0-8])|9(?:0[1-9]|1[1-6]))\\d{7}', + 'ExampleNumber' => '8021234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7,11}', + 'ExampleNumber' => '80017591759', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + 2 => 12, + 3 => 13, + 4 => 14, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '700\\d{7,11}', + 'ExampleNumber' => '7001234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + 2 => 12, + 3 => 13, + 4 => 14, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NG', + 'countryCode' => 234, + 'internationalPrefix' => '009', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '78', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[12]|9(?:0[3-9]|[1-9])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-6]|7(?:0[0-689]|[1-79])|8[2-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[7-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '20[129]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4,5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[78]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{5})(\\d{5,6})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[78]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NI.php new file mode 100644 index 00000000000..ccbf4c6bfc2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NI.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:1800|[25-8]\\d{3})\\d{4}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2\\d{7}', + 'ExampleNumber' => '21234567', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5(?:5[0-7]|[78]\\d)|6(?:20|3[035]|4[045]|5[05]|77|8[1-9]|9[059])|(?:7[5-8]|8\\d)\\d)\\d{5}', + 'ExampleNumber' => '81234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800\\d{4}', + 'ExampleNumber' => '18001234', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NI', + 'countryCode' => 505, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[125-8]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NL.php new file mode 100644 index 00000000000..59396fa8b93 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NL.php @@ -0,0 +1,320 @@ + + [ + 'NationalNumberPattern' => '(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + 6 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:[035]\\d|1[13-578]|6[124-8]|7[24]|8[0-467])|2(?:[0346]\\d|2[2-46-9]|5[125]|9[479])|3(?:[03568]\\d|1[3-8]|2[01]|4[1-8])|4(?:[0356]\\d|1[1-368]|7[58]|8[15-8]|9[23579])|5(?:[0358]\\d|[19][1-9]|2[1-57-9]|4[13-8]|6[126]|7[0-3578])|7\\d\\d)\\d{6}', + 'ExampleNumber' => '101234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:6[1-58]|970\\d)\\d{7}', + 'ExampleNumber' => '612345678', + 'PossibleLength' => + [ + 0 => 9, + 1 => 11, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4,7}', + 'ExampleNumber' => '8001234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[069]\\d{4,7}', + 'ExampleNumber' => '9061234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:85|91)\\d{7}', + 'ExampleNumber' => '851234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '66\\d{7}', + 'ExampleNumber' => '662345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '140(?:1[035]|2[0346]|3[03568]|4[0356]|5[0358]|8[458])|(?:140(?:1[16-8]|2[259]|3[124]|4[17-9]|5[124679]|7)|8[478]\\d{6})\\d', + 'ExampleNumber' => '14020', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '140(?:1[035]|2[0346]|3[03568]|4[0356]|5[0358]|8[458])|140(?:1[16-8]|2[259]|3[124]|4[17-9]|5[124679]|7)\\d', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'id' => 'NL', + 'countryCode' => 31, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1[238]|[34]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '14', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{4,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[89]0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '66', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d)(\\d{8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[16-8]|2[259]|3[124]|4[17-9]|5[124679]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-578]|91', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[89]0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '66', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[16-8]|2[259]|3[124]|4[17-9]|5[124679]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-578]|91', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NO.php new file mode 100644 index 00000000000..5417640015a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NO.php @@ -0,0 +1,144 @@ + + [ + 'NationalNumberPattern' => '(?:0|[2-9]\\d{3})\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[1-4]|3[1-3578]|5[1-35-7]|6[1-4679]|7[0-8])\\d{6}', + 'ExampleNumber' => '21234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:4[015-8]|9\\d)\\d{6}', + 'ExampleNumber' => '40612345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[01]\\d{5}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '82[09]\\d{5}', + 'ExampleNumber' => '82012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '810(?:0[0-6]|[2-8]\\d)\\d{3}', + 'ExampleNumber' => '81021234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '880\\d{5}', + 'ExampleNumber' => '88012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '85[0-5]\\d{5}', + 'ExampleNumber' => '85012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}', + 'ExampleNumber' => '02000', + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '81[23]\\d{5}', + 'ExampleNumber' => '81212345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NO', + 'countryCode' => 47, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2-79]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'leadingDigits' => '[02-689]|7[0-8]', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NP.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NP.php new file mode 100644 index 00000000000..c74195a067d --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NP.php @@ -0,0 +1,211 @@ + + [ + 'NationalNumberPattern' => '(?:1\\d|9)\\d{9}|[1-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 10, + 2 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1[0-6]\\d|99[02-6])\\d{5}|(?:2[13-79]|3[135-8]|4[146-9]|5[135-7]|6[13-9]|7[15-9]|8[1-46-9]|9[1-7])[2-6]\\d{5}', + 'ExampleNumber' => '14567890', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9(?:00|6[0-3]|7[024-6]|8[0-24-68])\\d{7}', + 'ExampleNumber' => '9841234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1(?:66001|800\\d\\d)\\d{5}', + 'ExampleNumber' => '16600101234', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NP', + 'countryCode' => 977, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '1[2-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '1[01]|[2-8]|9(?:[1-59]|[67][2-6])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{5})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '1[2-6]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '1[01]|[2-8]|9(?:[1-59]|[67][2-6])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NR.php new file mode 100644 index 00000000000..d6751662b0f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NR.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:444|(?:55|8\\d)\\d|666)\\d{4}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '444\\d{4}', + 'ExampleNumber' => '4441234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:55[3-9]|666|8\\d\\d)\\d{4}', + 'ExampleNumber' => '5551234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NR', + 'countryCode' => 674, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[4-68]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NU.php new file mode 100644 index 00000000000..1538986e527 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NU.php @@ -0,0 +1,117 @@ + + [ + 'NationalNumberPattern' => '(?:[4-7]|888\\d)\\d{3}', + 'PossibleLength' => + [ + 0 => 4, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[47]\\d{3}', + 'ExampleNumber' => '7012', + 'PossibleLength' => + [ + 0 => 4, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[56]|888[1-9])\\d{3}', + 'ExampleNumber' => '8884012', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NU', + 'countryCode' => 683, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NZ.php new file mode 100644 index 00000000000..d035d645cbe --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_NZ.php @@ -0,0 +1,204 @@ + + [ + 'NationalNumberPattern' => '[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '24099\\d{3}|(?:3[2-79]|[49][2-9]|6[235-9]|7[2-57-9])\\d{6}', + 'ExampleNumber' => '32345678', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '2(?:[0-27-9]\\d|6)\\d{6,7}|2(?:1\\d|75)\\d{5}', + 'ExampleNumber' => '211234567', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '508\\d{6,7}|80\\d{6,8}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:1[13-57-9]\\d{5}|50(?:0[08]|30|66|77|88))\\d{3}|90\\d{6,8}', + 'ExampleNumber' => '900123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{7}', + 'ExampleNumber' => '701234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '8(?:1[16-9]|22|3\\d|4[045]|5[459]|6[235-9]|7[0-3579]|90)\\d{2,7}', + 'ExampleNumber' => '83012378', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'NZ', + 'countryCode' => 64, + 'internationalPrefix' => '0(?:0|161)', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8[1-79]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '50[036-8]|8|90', + 1 => '50(?:[0367]|88)|8|90', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '24|[346]|7[2-57-9]|9[2-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:10|74)|[589]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1|2[028]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:[169]|7[0-35-9])|7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_OM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_OM.php new file mode 100644 index 00000000000..4ece1a58d41 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_OM.php @@ -0,0 +1,146 @@ + + [ + 'NationalNumberPattern' => '(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2[1-6]\\d{6}', + 'ExampleNumber' => '23123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:1505|90[1-9]\\d)\\d{4}|(?:7[126-9]|9[1-9])\\d{6}', + 'ExampleNumber' => '92123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8007\\d{4,5}|(?:500|800[05])\\d{4}', + 'ExampleNumber' => '80071234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{5}', + 'ExampleNumber' => '90012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'OM', + 'countryCode' => 968, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[58]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[179]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PA.php new file mode 100644 index 00000000000..31d6e7dca3b --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PA.php @@ -0,0 +1,148 @@ + + [ + 'NationalNumberPattern' => '(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 10, + 3 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:0\\d|1[479]|2[37]|3[0137]|4[17]|5[05]|6[058]|7[0167]|8[2358]|9[1389])|2(?:[0235-79]\\d|1[0-7]|4[013-9]|8[02-9])|3(?:[089]\\d|1[0-7]|2[0-5]|33|4[0-79]|5[0-35]|6[068]|7[0-8])|4(?:00|3[0-579]|4\\d|7[0-57-9])|5(?:[01]\\d|2[0-7]|[56]0|79)|7(?:0[09]|2[0-26-8]|3[03]|4[04]|5[05-9]|6[0156]|7[0-24-9]|8[5-9]|90)|8(?:09|2[89]|3\\d|4[0-24-689]|5[014]|8[02])|9(?:0[5-9]|1[0135-8]|2[036-9]|3[35-79]|40|5[0457-9]|6[05-9]|7[04-9]|8[35-8]|9\\d))\\d{4}', + 'ExampleNumber' => '2001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:1[16]1|21[89]|6\\d{3}|8(?:1[01]|7[23]))\\d{4}', + 'ExampleNumber' => '61234567', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4,5}|(?:00800|800\\d)\\d{6}', + 'ExampleNumber' => '8001234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:8(?:22|55|60|7[78]|86)|9(?:00|81))\\d{4}', + 'ExampleNumber' => '8601234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PA', + 'countryCode' => 507, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-57-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[68]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PE.php new file mode 100644 index 00000000000..61b191c6998 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PE.php @@ -0,0 +1,179 @@ + + [ + 'NationalNumberPattern' => '(?:[14-8]|9\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:4[34]|5[14])[0-8]\\d|7(?:173|3[0-8]\\d)|8(?:10[05689]|6(?:0[06-9]|1[6-9]|29)|7(?:0[569]|[56]0)))\\d{4}|(?:1[0-8]|4[12]|5[236]|6[1-7]|7[246]|8[2-4])\\d{6}', + 'ExampleNumber' => '11234567', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9\\d{8}', + 'ExampleNumber' => '912345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '805\\d{5}', + 'ExampleNumber' => '80512345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '801\\d{5}', + 'ExampleNumber' => '80112345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '80[24]\\d{5}', + 'ExampleNumber' => '80212345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PE', + 'countryCode' => 51, + 'internationalPrefix' => '00|19(?:1[124]|77|90)00', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '0', + 'preferredExtnPrefix' => ' Anexo ', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[4-8]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PF.php new file mode 100644 index 00000000000..81e849476c9 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PF.php @@ -0,0 +1,153 @@ + + [ + 'NationalNumberPattern' => '4\\d{5}(?:\\d{2})?|8\\d{7,8}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '4(?:0[4-689]|9[4-68])\\d{5}', + 'ExampleNumber' => '40412345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '8[7-9]\\d{6}', + 'ExampleNumber' => '87123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '499\\d{5}', + 'ExampleNumber' => '49901234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '44\\d{4}', + 'ExampleNumber' => '440123', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '44\\d{4}', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'id' => 'PF', + 'countryCode' => 689, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '44', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '4|8[7-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PG.php new file mode 100644 index 00000000000..c4a535565a2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PG.php @@ -0,0 +1,140 @@ + + [ + 'NationalNumberPattern' => '(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:3[0-2]|4[257]|5[34]|9[78])\\d|64[1-9]|85[02-46-9])\\d{4}', + 'ExampleNumber' => '3123456', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:7\\d|8[1-38])\\d{6}', + 'ExampleNumber' => '70123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '180\\d{4}', + 'ExampleNumber' => '1801234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '2(?:0[0-57]|7[568])\\d{4}', + 'ExampleNumber' => '2751234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '27[01]\\d{4}', + 'ExampleNumber' => '2700123', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PG', + 'countryCode' => 675, + 'internationalPrefix' => '00|140[1-3]', + 'preferredInternationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '18|[2-69]|85', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[78]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PH.php new file mode 100644 index 00000000000..98c9f918ec3 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PH.php @@ -0,0 +1,233 @@ + + [ + 'NationalNumberPattern' => '(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + 6 => 13, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:2[3-8]|3[2-68]|4[2-9]|5[2-6]|6[2-58]|7[24578])\\d{3}|88(?:22\\d\\d|42))\\d{4}|(?:2|8[2-8]\\d\\d)\\d{5}', + 'ExampleNumber' => '232345678', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 9, + 3 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:8(?:1[37]|9[5-8])|9(?:0[5-9]|1[0-24-9]|[235-7]\\d|4[2-9]|8[135-9]|9[1-9]))\\d{7}', + 'ExampleNumber' => '9051234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800\\d{7,9}', + 'ExampleNumber' => '180012345678', + 'PossibleLength' => + [ + 0 => 11, + 1 => 12, + 2 => 13, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PH', + 'countryCode' => 63, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2', + 1 => '3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{5})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '346|4(?:27|9[35])|883', + 1 => '3469|4(?:279|9(?:30|56))|8834', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-7]|8[2-8]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PK.php new file mode 100644 index 00000000000..7abb646bbbf --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PK.php @@ -0,0 +1,235 @@ + + [ + 'NationalNumberPattern' => '122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 11, + 4 => 12, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:21|42)[2-9]|58[126])\\d{7}|(?:2[25]|4[0146-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]\\d{6,7}|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8]))[2-9]\\d{5,6}', + 'ExampleNumber' => '2123456789', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '3(?:[0-247]\\d|3[0-79]|55|64)\\d{7}', + 'ExampleNumber' => '3012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}(?:\\d{3})?', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + 1 => 11, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{5}', + 'ExampleNumber' => '90012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '122\\d{6}', + 'ExampleNumber' => '122044444', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:2(?:[125]|3[2358]|4[2-4]|9[2-8])|4(?:[0-246-9]|5[3479])|5(?:[1-35-7]|4[2-467])|6(?:0[468]|[1-8])|7(?:[14]|2[236])|8(?:[16]|2[2-689]|3[23578]|4[3478]|5[2356])|9(?:1|22|3[27-9]|4[2-6]|6[3569]|9[2-7]))111\\d{6}', + 'ExampleNumber' => '21111825888', + 'PossibleLength' => + [ + 0 => 11, + 1 => 12, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PK', + 'countryCode' => 92, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2,7})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{6,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])', + 1 => '9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{7,8})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{5})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '58', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[24-9]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PL.php new file mode 100644 index 00000000000..ef3e76a6dd0 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PL.php @@ -0,0 +1,214 @@ + + [ + 'NationalNumberPattern' => '(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '47\\d{7}|(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])(?:[02-9]\\d{6}|1(?:[0-8]\\d{5}|9\\d{3}(?:\\d{2})?))', + 'ExampleNumber' => '123456789', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '21(?:1[013-5]|2\\d)\\d{5}|(?:45|5[0137]|6[069]|7[2389]|88)\\d{7}', + 'ExampleNumber' => '512345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6,7}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '70[01346-8]\\d{6}', + 'ExampleNumber' => '701234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '801\\d{6}', + 'ExampleNumber' => '801234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '39\\d{7}', + 'ExampleNumber' => '391234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '64\\d{4,7}', + 'ExampleNumber' => '641234567', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '804\\d{6}', + 'ExampleNumber' => '804123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PL', + 'countryCode' => 48, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '19', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '11|20|64', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1', + 1 => '(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '64', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1[2-8]|[2-7]|8[1-79]|9[145]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PM.php new file mode 100644 index 00000000000..347777b1b87 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PM.php @@ -0,0 +1,145 @@ + + [ + 'NationalNumberPattern' => '[45]\\d{5}|(?:708|80\\d)\\d{6}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:4[1-35-7]|5[01])\\d{4}', + 'ExampleNumber' => '430123', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:4[02-4]|5[056]|708[45][0-5])\\d{4}', + 'ExampleNumber' => '551234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PM', + 'countryCode' => 508, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[45]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PR.php new file mode 100644 index 00000000000..9168399b790 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PR.php @@ -0,0 +1,109 @@ + + [ + 'NationalNumberPattern' => '(?:[589]\\d\\d|787)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:787|939)[2-9]\\d{6}', + 'ExampleNumber' => '7872345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:787|939)[2-9]\\d{6}', + 'ExampleNumber' => '7872345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PR', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '1', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '787|939', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PS.php new file mode 100644 index 00000000000..0a3f797dfc9 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PS.php @@ -0,0 +1,160 @@ + + [ + 'NationalNumberPattern' => '[2489]2\\d{6}|(?:1\\d|5)\\d{8}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:22[2-47-9]|42[45]|82[014-68]|92[3569])\\d{5}', + 'ExampleNumber' => '22234567', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '5[69]\\d{7}', + 'ExampleNumber' => '599123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800\\d{6}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '1700\\d{6}', + 'ExampleNumber' => '1700123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PS', + 'countryCode' => 970, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2489]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PT.php new file mode 100644 index 00000000000..4f25051f0de --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PT.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '1693\\d{5}|(?:[26-9]\\d|30)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:[12]\\d|3[1-689]|4[1-59]|[57][1-9]|6[1-35689]|8[1-69]|9[1256])\\d{6}', + 'ExampleNumber' => '212345678', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6(?:[06]92(?:30|9\\d)|[35]92(?:3[034]|9\\d))\\d{3}|(?:(?:16|6[0356])93|9(?:[1-36]\\d\\d|480))\\d{5}', + 'ExampleNumber' => '912345678', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[02]\\d{6}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:6(?:0[178]|4[68])\\d|76(?:0[1-57]|1[2-47]|2[237]))\\d{5}', + 'ExampleNumber' => '760123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '80(?:8\\d|9[1579])\\d{5}', + 'ExampleNumber' => '808123456', + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '884[0-4689]\\d{5}', + 'ExampleNumber' => '884123456', + ], + 'voip' => + [ + 'NationalNumberPattern' => '30\\d{7}', + 'ExampleNumber' => '301234567', + ], + 'pager' => + [ + 'NationalNumberPattern' => '6(?:222\\d|8988)\\d{4}', + 'ExampleNumber' => '622212345', + ], + 'uan' => + [ + 'NationalNumberPattern' => '70(?:38[01]|596|(?:7\\d|8[17])\\d)\\d{4}', + 'ExampleNumber' => '707123456', + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '600\\d{6}|6[06]923[34]\\d{3}', + 'ExampleNumber' => '600110000', + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PT', + 'countryCode' => 351, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2[12]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '16|[236-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PW.php new file mode 100644 index 00000000000..fa555169f21 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PW.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:[24-8]\\d\\d|345|900)\\d{4}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:55|77)|345|488|5(?:35|44|87)|6(?:22|54|79)|7(?:33|47)|8(?:24|55|76)|900)\\d{4}', + 'ExampleNumber' => '2771234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:(?:46|83)[0-5]|6[2-4689]0)\\d{4}|(?:45|77|88)\\d{5}', + 'ExampleNumber' => '6201234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PW', + 'countryCode' => 680, + 'internationalPrefix' => '01[12]', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PY.php new file mode 100644 index 00000000000..58a6075913f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_PY.php @@ -0,0 +1,233 @@ + + [ + 'NationalNumberPattern' => '59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36])\\d{5,7}|(?:2(?:2[4-68]|[4-68]\\d|7[15]|9[1-5])|3(?:18|3[167]|4[2357]|51|[67]\\d)|4(?:3[12]|5[13]|9[1-47])|5(?:[1-4]\\d|5[02-4])|6(?:3[1-3]|44|7[1-8])|7(?:4[0-4]|5\\d|6[1-578]|75|8[0-8])|858)\\d{5,6}', + 'ExampleNumber' => '212345678', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9(?:51|6[129]|7[1-6]|8[1-7]|9[1-5])\\d{6}', + 'ExampleNumber' => '961456789', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '9800\\d{5,7}', + 'ExampleNumber' => '98000123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + 2 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '8700[0-4]\\d{4}', + 'ExampleNumber' => '870012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '[2-9]0\\d{4,7}', + 'ExampleNumber' => '201234567', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'PY', + 'countryCode' => 595, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '87', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:[5-79]|8[1-7])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-8]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_QA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_QA.php new file mode 100644 index 00000000000..43d0afd485c --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_QA.php @@ -0,0 +1,141 @@ + + [ + 'NationalNumberPattern' => '800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '4(?:1111|2022)\\d{3}|4(?:[04]\\d\\d|14[0-6]|999)\\d{4}', + 'ExampleNumber' => '44123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[35-7]\\d{7}', + 'ExampleNumber' => '33123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{4}|(?:0080[01]|800)\\d{6}', + 'ExampleNumber' => '8001234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + 2 => 11, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '2[16]\\d{5}', + 'ExampleNumber' => '2123456', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'QA', + 'countryCode' => 974, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2[16]|8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[3-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RE.php new file mode 100644 index 00000000000..a02482a419e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RE.php @@ -0,0 +1,106 @@ + + [ + 'NationalNumberPattern' => '(?:26|[689]\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}', + 'ExampleNumber' => '262161234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '69(?:2\\d\\d|3(?:[06][0-6]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))\\d{4}', + 'ExampleNumber' => '692123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{7}', + 'ExampleNumber' => '801234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '89[1-37-9]\\d{6}', + 'ExampleNumber' => '891123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8(?:1[019]|2[0156]|84|90)\\d{6}', + 'ExampleNumber' => '810123456', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:399[0-3]|479[0-5]|76(?:2[27]|3[0-37]))\\d{4}', + 'ExampleNumber' => '939901234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'RE', + 'countryCode' => 262, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2689]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RO.php new file mode 100644 index 00000000000..337efedb294 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RO.php @@ -0,0 +1,165 @@ + + [ + 'NationalNumberPattern' => '(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[23][13-6]\\d{7}|(?:2(?:19\\d|[3-6]\\d9)|31\\d\\d)\\d\\d', + 'ExampleNumber' => '211234567', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7020\\d{5}|(?:6(?:2\\d|40)|7(?:0[013-9]|1[0-3]|[2-7]\\d|8[03-8]|9[0-39]))\\d{6}', + 'ExampleNumber' => '712034567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[0136]\\d{6}', + 'ExampleNumber' => '900123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '801\\d{6}', + 'ExampleNumber' => '801123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:37\\d|80[578])\\d{6}', + 'ExampleNumber' => '372123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'RO', + 'countryCode' => 40, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'preferredExtnPrefix' => ' int ', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2[3-6]', + 1 => '2[3-6]\\d9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '219|31', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[23]1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[236-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RS.php new file mode 100644 index 00000000000..700f47e20d2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RS.php @@ -0,0 +1,160 @@ + + [ + 'NationalNumberPattern' => '38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + 6 => 12, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:11[1-9]\\d|(?:2[389]|39)(?:0[2-9]|[2-9]\\d))\\d{3,8}|(?:1[02-9]|2[0-24-7]|3[0-8])[2-9]\\d{4,9}', + 'ExampleNumber' => '10234567', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + 5 => 12, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6(?:[0-689]|7\\d)\\d{6,7}', + 'ExampleNumber' => '601234567', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{3,9}', + 'ExampleNumber' => '80012345', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:78\\d|90[0169])\\d{3,7}', + 'ExampleNumber' => '90012345', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '7[06]\\d{4,10}', + 'ExampleNumber' => '700123456', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'RS', + 'countryCode' => 381, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3,9})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:2[389]|39)0|[7-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{5,10})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-36]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RU.php new file mode 100644 index 00000000000..2adaf3268b4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RU.php @@ -0,0 +1,266 @@ + + [ + 'NationalNumberPattern' => '8\\d{13}|[347-9]\\d{9}', + 'PossibleLength' => + [ + 0 => 10, + 1 => 14, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3(?:0[12]|4[1-35-79]|5[1-3]|65|8[1-58]|9[0145])|4(?:01|1[1356]|2[13467]|7[1-5]|8[1-7]|9[1-689])|8(?:1[1-8]|2[01]|3[13-6]|4[0-8]|5[15]|6[1-35-79]|7[1-37-9]))\\d{7}', + 'ExampleNumber' => '3011234567', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9\\d{9}', + 'ExampleNumber' => '9123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:0[04]|108\\d{3})\\d{7}', + 'ExampleNumber' => '8001234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '80[39]\\d{7}', + 'ExampleNumber' => '8091234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '808\\d{7}', + 'ExampleNumber' => '8081234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'RU', + 'countryCode' => 7, + 'internationalPrefix' => '810', + 'preferredInternationalPrefix' => '8~10', + 'nationalPrefix' => '8', + 'nationalPrefixForParsing' => '8', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[0-79]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '7(?:1[0-8]|2[1-9])', + 1 => '7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))', + 2 => '7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{5})(\\d)(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '7(?:1[0-68]|2[1-9])', + 1 => '7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))', + 2 => '7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '[349]|8(?:[02-7]|1[1-8])', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 5 => + [ + 'pattern' => '(\\d{4})(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '7(?:1[0-8]|2[1-9])', + 1 => '7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))', + 2 => '7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{5})(\\d)(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '7(?:1[0-68]|2[1-9])', + 1 => '7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))', + 2 => '7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '[349]|8(?:[02-7]|1[1-8])', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '8 ($1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => true, + 'leadingDigits' => '3[04-689]|[489]', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RW.php new file mode 100644 index 00000000000..327dd683fcb --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_RW.php @@ -0,0 +1,147 @@ + + [ + 'NationalNumberPattern' => '(?:06|[27]\\d\\d|[89]00)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:06|2[23568]\\d)\\d{6}', + 'ExampleNumber' => '250123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[237-9]\\d{7}', + 'ExampleNumber' => '720123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{6}', + 'ExampleNumber' => '900123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'RW', + 'countryCode' => 250, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[7-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SA.php new file mode 100644 index 00000000000..16c66111733 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SA.php @@ -0,0 +1,187 @@ + + [ + 'NationalNumberPattern' => '92\\d{7}|(?:[15]|8\\d)\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1(?:1\\d|2[24-8]|3[35-8]|4[3-68]|6[2-5]|7[235-7])\\d{6}', + 'ExampleNumber' => '112345678', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '579[01]\\d{5}|5(?:[013-689]\\d|7[0-8])\\d{6}', + 'ExampleNumber' => '512345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7}', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '925\\d{6}', + 'ExampleNumber' => '925012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '920\\d{6}', + 'ExampleNumber' => '920012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '811\\d{7}', + 'ExampleNumber' => '8110123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SA', + 'countryCode' => 966, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '81', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SB.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SB.php new file mode 100644 index 00000000000..6923070f990 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SB.php @@ -0,0 +1,121 @@ + + [ + 'NationalNumberPattern' => '(?:[1-6]|[7-9]\\d\\d)\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1[4-79]|[23]\\d|4[0-2]|5[03]|6[0-37])\\d{3}', + 'ExampleNumber' => '40123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '48\\d{3}|(?:(?:7[1-9]|8[4-9])\\d|9(?:1[2-9]|2[013-9]|3[0-2]|[46]\\d|5[0-46-9]|7[0-689]|8[0-79]|9[0-8]))\\d{4}', + 'ExampleNumber' => '7421234', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1[38]\\d{3}', + 'ExampleNumber' => '18123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '5[12]\\d{3}', + 'ExampleNumber' => '51123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SB', + 'countryCode' => 677, + 'internationalPrefix' => '0[01]', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7|8[4-9]|9(?:[1-8]|9[0-8])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SC.php new file mode 100644 index 00000000000..5c38ccb7314 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SC.php @@ -0,0 +1,109 @@ + + [ + 'NationalNumberPattern' => '800\\d{4}|(?:[249]\\d|64)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '4[2-46]\\d{5}', + 'ExampleNumber' => '4217123', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '2[125-8]\\d{5}', + 'ExampleNumber' => '2510123', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800[08]\\d{3}', + 'ExampleNumber' => '8000000', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '971\\d{4}|(?:64|95)\\d{5}', + 'ExampleNumber' => '6412345', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SC', + 'countryCode' => 248, + 'internationalPrefix' => '010|0[0-2]', + 'preferredInternationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[246]|9[57]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SD.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SD.php new file mode 100644 index 00000000000..5518b999176 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SD.php @@ -0,0 +1,114 @@ + + [ + 'NationalNumberPattern' => '[19]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1(?:5\\d|8[35-7])\\d{6}', + 'ExampleNumber' => '153123456', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:1[0-2]|9[0-3569])\\d{7}', + 'ExampleNumber' => '911231234', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SD', + 'countryCode' => 249, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[19]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SE.php new file mode 100644 index 00000000000..5a78c3cb411 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SE.php @@ -0,0 +1,392 @@ + + [ + 'NationalNumberPattern' => '(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:(?:[12][136]|3[356]|4[0246]|6[03]|8\\d)\\d|90[1-9])\\d{4,6}|(?:1(?:2[0-35]|4[0-4]|5[0-25-9]|7[13-6]|[89]\\d)|2(?:2[0-7]|4[0136-8]|5[0138]|7[018]|8[01]|9[0-57])|3(?:0[0-4]|1\\d|2[0-25]|4[056]|7[0-2]|8[0-3]|9[023])|4(?:1[013-8]|3[0135]|5[14-79]|7[0-246-9]|8[0156]|9[0-689])|5(?:0[0-6]|[15][0-5]|2[0-68]|3[0-4]|4\\d|6[03-5]|7[013]|8[0-79]|9[01])|6(?:1[1-3]|2[0-4]|4[02-57]|5[0-37]|6[0-3]|7[0-2]|8[0247]|9[0-356])|9(?:1[0-68]|2\\d|3[02-5]|4[0-3]|5[0-4]|[68][01]|7[0135-8]))\\d{5,6}', + 'ExampleNumber' => '8123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[02369]\\d{7}', + 'ExampleNumber' => '701234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '20\\d{4,7}', + 'ExampleNumber' => '20123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '649\\d{6}|99[1-59]\\d{4}(?:\\d{3})?|9(?:00|39|44)[1-8]\\d{3,6}', + 'ExampleNumber' => '9001234567', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '77[0-7]\\d{6}', + 'ExampleNumber' => '771234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '75[1-8]\\d{6}', + 'ExampleNumber' => '751234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '74[02-9]\\d{6}', + 'ExampleNumber' => '740123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '10[1-8]\\d{6}', + 'ExampleNumber' => '102345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '(?:25[245]|67[3-68])\\d{9}', + 'ExampleNumber' => '254123456789', + 'PossibleLength' => + [ + 0 => 12, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SE', + 'countryCode' => 46, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2,3})(\\d{2})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '20', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:00|39|44|9)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[12][136]|3[356]|4[0246]|6[03]|90[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{2,3})(\\d{2})(\\d{2})', + 'format' => '$1-$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{2,3})(\\d{2})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{2,3})(\\d{3})', + 'format' => '$1-$2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:00|39|44)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})', + 'format' => '$1-$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1-$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '10|7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1-$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1-$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 10 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1-$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 11 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1-$2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '[26]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2,3})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '20', + ], + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:00|39|44|9)', + ], + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[12][136]|3[356]|4[0246]|6[03]|90[1-9]', + ], + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{2,3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{2,3})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])', + ], + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{2,3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9(?:00|39|44)', + ], + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]', + ], + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '10|7', + ], + ], + 8 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + ], + 9 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])', + ], + ], + 10 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{3})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + ], + 11 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4 $5', + 'leadingDigitsPatterns' => + [ + 0 => '[26]', + ], + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SG.php new file mode 100644 index 00000000000..c02f480ed9f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SG.php @@ -0,0 +1,231 @@ + + [ + 'NationalNumberPattern' => '(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 10, + 2 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '662[0-24-9]\\d{4}|6(?:[0-578]\\d|6[013-57-9]|9[0-35-9])\\d{5}', + 'ExampleNumber' => '61234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '8(?:09|95)[0-2]\\d{4}|(?:8(?:0[1-8]|[1-8]\\d|9[0-4])|9[0-8]\\d)\\d{5}', + 'ExampleNumber' => '81234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:18|8)00\\d{7}', + 'ExampleNumber' => '18001234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '1900\\d{7}', + 'ExampleNumber' => '19001234567', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:3[12]\\d|666)\\d{5}', + 'ExampleNumber' => '31234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '7000\\d{7}', + 'ExampleNumber' => '70001234567', + 'PossibleLength' => + [ + 0 => 11, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SG', + 'countryCode' => 65, + 'internationalPrefix' => '0[0-3]\\d', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4,5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '1[013-9]|77', + 1 => '1(?:[013-8]|9(?:0[1-9]|[1-9]))|77', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[369]|8(?:0[1-9]|[1-9])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{4})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[369]|8(?:0[1-9]|[1-9])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{4})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SH.php new file mode 100644 index 00000000000..e4a78acf569 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SH.php @@ -0,0 +1,108 @@ + + [ + 'NationalNumberPattern' => '(?:[256]\\d|8)\\d{3}', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:[0-57-9]\\d|6[4-9])\\d\\d', + 'ExampleNumber' => '22158', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[56]\\d{4}', + 'ExampleNumber' => '51234', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '262\\d\\d', + 'ExampleNumber' => '26212', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SH', + 'countryCode' => 290, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => true, + 'leadingDigits' => '[256]', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SI.php new file mode 100644 index 00000000000..53374999074 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SI.php @@ -0,0 +1,170 @@ + + [ + 'NationalNumberPattern' => '[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:[1-357][2-8]|4[24-8])\\d{6}', + 'ExampleNumber' => '12345678', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '65(?:[178]\\d|5[56]|6[01])\\d{4}|(?:[37][01]|4[0139]|51|6[489])\\d{6}', + 'ExampleNumber' => '31234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{4,6}', + 'ExampleNumber' => '80123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '89[1-3]\\d{2,5}|90\\d{4,6}', + 'ExampleNumber' => '90123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:59\\d\\d|8(?:1(?:[67]\\d|8[0-589])|2(?:0\\d|2[0-37-9]|8[0-2489])|3[389]\\d))\\d{4}', + 'ExampleNumber' => '59012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SI', + 'countryCode' => 386, + 'internationalPrefix' => '00|10(?:22|66|88|99)', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8[09]|9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '59|8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[37][01]|4[0139]|51|6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[1-57]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SJ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SJ.php new file mode 100644 index 00000000000..11152bd4682 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SJ.php @@ -0,0 +1,120 @@ + + [ + 'NationalNumberPattern' => '0\\d{4}|(?:[489]\\d|79)\\d{6}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '79\\d{6}', + 'ExampleNumber' => '79123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:4[015-8]|9\\d)\\d{6}', + 'ExampleNumber' => '41234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[01]\\d{5}', + 'ExampleNumber' => '80012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '82[09]\\d{5}', + 'ExampleNumber' => '82012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '810(?:0[0-6]|[2-8]\\d)\\d{3}', + 'ExampleNumber' => '81021234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '880\\d{5}', + 'ExampleNumber' => '88012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '85[0-5]\\d{5}', + 'ExampleNumber' => '85012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:0[2-9]|81(?:0(?:0[7-9]|1\\d)|5\\d\\d))\\d{3}', + 'ExampleNumber' => '02000', + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '81[23]\\d{5}', + 'ExampleNumber' => '81212345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SJ', + 'countryCode' => 47, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '79', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SK.php new file mode 100644 index 00000000000..711a76bec6a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SK.php @@ -0,0 +1,260 @@ + + [ + 'NationalNumberPattern' => '[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:16|[2-9]\\d{3})|(?:(?:[3-5][1-8]\\d|819)\\d|601[1-5])\\d)\\d{4}|(?:2|[3-5][1-8])1[67]\\d{3}|[3-5][1-8]16\\d\\d', + 'ExampleNumber' => '221234567', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '909[1-9]\\d{5}|9(?:0[1-8]|1[0-24-9]|4[03-57-9]|5\\d)\\d{6}', + 'ExampleNumber' => '912123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '9(?:00|[78]\\d)\\d{6}', + 'ExampleNumber' => '900123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8[5-9]\\d{7}', + 'ExampleNumber' => '850123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '6(?:02|5[0-4]|9[0-6])\\d{6}', + 'ExampleNumber' => '690123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '9090\\d{3}', + 'ExampleNumber' => '9090123', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '96\\d{7}', + 'ExampleNumber' => '961234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '9090\\d{3}|(?:602|8(?:00|[5-9]\\d)|9(?:00|[78]\\d))\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'id' => 'SK', + 'countryCode' => 421, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '21', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-5][1-8]1', + 1 => '[3-5][1-8]1[67]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '909', + 1 => '9090', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1/$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[689]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1/$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[3-5]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{2})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '21', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-5][1-8]1', + 1 => '[3-5][1-8]1[67]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3})(\\d{2})', + 'format' => '$1/$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[689]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1/$2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[3-5]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SL.php new file mode 100644 index 00000000000..f2918b09ef8 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SL.php @@ -0,0 +1,122 @@ + + [ + 'NationalNumberPattern' => '(?:[237-9]\\d|66)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '22[2-4][2-9]\\d{4}', + 'ExampleNumber' => '22221234', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:25|3[0-5]|66|7[2-9]|8[08]|9[09])\\d{6}', + 'ExampleNumber' => '25123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SL', + 'countryCode' => 232, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[236-9]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SM.php new file mode 100644 index 00000000000..990f758dab0 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SM.php @@ -0,0 +1,186 @@ + + [ + 'NationalNumberPattern' => '(?:0549|[5-7]\\d)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '0549(?:8[0157-9]|9\\d)\\d{4}', + 'ExampleNumber' => '0549886377', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6[16]\\d{6}', + 'ExampleNumber' => '66661212', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '7[178]\\d{6}', + 'ExampleNumber' => '71123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '5[158]\\d{6}', + 'ExampleNumber' => '58001110', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SM', + 'countryCode' => 378, + 'internationalPrefix' => '00', + 'nationalPrefixForParsing' => '([89]\\d{5})$', + 'nationalPrefixTransformRule' => '0549$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[5-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[5-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SN.php new file mode 100644 index 00000000000..8492337e174 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SN.php @@ -0,0 +1,116 @@ + + [ + 'NationalNumberPattern' => '(?:[378]\\d|93)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '3(?:0(?:1[0-2]|80)|282|3(?:8[1-9]|9[3-9])|611)\\d{5}', + 'ExampleNumber' => '301012345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:(?:[06-8]\\d|21|90)\\d|5(?:01|[19]0|25|[38]3|[4-7]\\d))\\d{5}', + 'ExampleNumber' => '701234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '88[4689]\\d{6}', + 'ExampleNumber' => '884123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '81[02468]\\d{6}', + 'ExampleNumber' => '810123456', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '(?:3(?:392|9[01]\\d)\\d|93(?:3[13]0|929))\\d{4}', + 'ExampleNumber' => '933301234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SN', + 'countryCode' => 221, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[379]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SO.php new file mode 100644 index 00000000000..9889a70b6de --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SO.php @@ -0,0 +1,188 @@ + + [ + 'NationalNumberPattern' => '[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1\\d|2[0-79]|3[0-46-8]|4[0-7]|5[57-9])\\d{5}|(?:[134]\\d|8[125])\\d{4}', + 'ExampleNumber' => '4012345', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:(?:15|(?:3[59]|4[89]|6\\d|7[79]|8[08])\\d|9(?:0\\d|[2-9]))\\d|2(?:4\\d|8))\\d{5}|(?:[67]\\d\\d|904)\\d{5}', + 'ExampleNumber' => '71123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SO', + 'countryCode' => 252, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8[125]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{6})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '[134]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[15]|2[0-79]|3[0-46-8]|4[0-7]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d)(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:2|90)4|[67]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[348]|64|79|90', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{2})(\\d{5,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1|28|6[0-35-9]|77|9[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SR.php new file mode 100644 index 00000000000..9180ca6cc16 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SR.php @@ -0,0 +1,143 @@ + + [ + 'NationalNumberPattern' => '(?:[2-5]|68|[78]\\d)\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[1-3]|3[0-7]|(?:4|68)\\d|5[2-58])\\d{4}', + 'ExampleNumber' => '211234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:7[124-7]|8[124-9])\\d{5}', + 'ExampleNumber' => '7412345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '56\\d{4}', + 'ExampleNumber' => '561234', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SR', + 'countryCode' => 597, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '56', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-5]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[6-8]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SS.php new file mode 100644 index 00000000000..933a94917e8 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SS.php @@ -0,0 +1,114 @@ + + [ + 'NationalNumberPattern' => '[19]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '1[89]\\d{7}', + 'ExampleNumber' => '181234567', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:12|9[1257-9])\\d{7}', + 'ExampleNumber' => '977123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SS', + 'countryCode' => 211, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[19]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ST.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ST.php new file mode 100644 index 00000000000..8a6771f2545 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ST.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:22|9\\d)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '22\\d{5}', + 'ExampleNumber' => '2221234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '900[5-9]\\d{3}|9(?:0[1-9]|[89]\\d)\\d{4}', + 'ExampleNumber' => '9812345', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ST', + 'countryCode' => 239, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[29]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SV.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SV.php new file mode 100644 index 00000000000..1274ec9dfdc --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SV.php @@ -0,0 +1,152 @@ + + [ + 'NationalNumberPattern' => '[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:79(?:0[0347-9]|[1-9]\\d)|89(?:0[024589]|[1-9]\\d))\\d{3}|2(?:[1-69]\\d|[78][0-8])\\d{5}', + 'ExampleNumber' => '21234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '[67]\\d{7}', + 'ExampleNumber' => '70123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{8}|80[01]\\d{4}', + 'ExampleNumber' => '8001234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 11, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{4}(?:\\d{4})?', + 'ExampleNumber' => '9001234', + 'PossibleLength' => + [ + 0 => 7, + 1 => 11, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SV', + 'countryCode' => 503, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[267]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SX.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SX.php new file mode 100644 index 00000000000..e6077ce2055 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SX.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '7215(?:4[2-8]|8[239]|9[056])\\d{4}', + 'ExampleNumber' => '7215425678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7215(?:1[02]|2\\d|5[034679]|8[014-8])\\d{4}', + 'ExampleNumber' => '7215205678', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SX', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '(5\\d{6})$|1', + 'nationalPrefixTransformRule' => '721$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '721', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SY.php new file mode 100644 index 00000000000..e19d84ed1c1 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SY.php @@ -0,0 +1,141 @@ + + [ + 'NationalNumberPattern' => '[1-39]\\d{8}|[1-5]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '21\\d{6,7}|(?:1(?:[14]\\d|[2356])|2[235]|3(?:[13]\\d|4)|4[134]|5[1-3])\\d{6}', + 'ExampleNumber' => '112345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9[1-689]\\d{7}', + 'ExampleNumber' => '944567890', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'SY', + 'countryCode' => 963, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-5]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SZ.php new file mode 100644 index 00000000000..d726500634e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_SZ.php @@ -0,0 +1,140 @@ + + [ + 'NationalNumberPattern' => '0800\\d{4}|(?:[237]\\d|900)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '[23][2-5]\\d{6}', + 'ExampleNumber' => '22171234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[6-9]\\d{6}', + 'ExampleNumber' => '76123456', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '0800\\d{4}', + 'ExampleNumber' => '08001234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{6}', + 'ExampleNumber' => '900012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '70\\d{6}', + 'ExampleNumber' => '70012345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '0800\\d{4}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'id' => 'SZ', + 'countryCode' => 268, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[0237]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{5})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TA.php new file mode 100644 index 00000000000..7c63f68335a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TA.php @@ -0,0 +1,103 @@ + + [ + 'NationalNumberPattern' => '8\\d{3}', + 'PossibleLength' => + [ + 0 => 4, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '8\\d{3}', + 'ExampleNumber' => '8999', + ], + 'mobile' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TA', + 'countryCode' => 290, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '8', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TC.php new file mode 100644 index 00000000000..a1cfc5a0857 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TC.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|649|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '649(?:266|712|9(?:4\\d|50))\\d{4}', + 'ExampleNumber' => '6497121234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '649(?:2(?:3[129]|4[1-79])|3\\d\\d|4[34][1-3])\\d{4}', + 'ExampleNumber' => '6492311234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'NationalNumberPattern' => '649(?:71[01]|966)\\d{4}', + 'ExampleNumber' => '6497101234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TC', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-479]\\d{6})$|1', + 'nationalPrefixTransformRule' => '649$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '649', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TD.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TD.php new file mode 100644 index 00000000000..7efd3356224 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TD.php @@ -0,0 +1,113 @@ + + [ + 'NationalNumberPattern' => '(?:22|[69]\\d|77)\\d{6}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '22(?:[37-9]0|5[0-5]|6[89])\\d{4}', + 'ExampleNumber' => '22501234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:6[0235689]|77|9\\d)\\d{6}', + 'ExampleNumber' => '63012345', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TD', + 'countryCode' => 235, + 'internationalPrefix' => '00|16', + 'preferredInternationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[2679]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TG.php new file mode 100644 index 00000000000..8d316a81f36 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TG.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '[279]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:2[2-7]|3[23]|4[45]|55|6[67]|77)\\d{5}', + 'ExampleNumber' => '22212345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:7[019]|9[0-36-9])\\d{6}', + 'ExampleNumber' => '90112345', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TG', + 'countryCode' => 228, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[279]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TH.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TH.php new file mode 100644 index 00000000000..710c93708f7 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TH.php @@ -0,0 +1,156 @@ + + [ + 'NationalNumberPattern' => '(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + 3 => 13, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1[0689]|2\\d|3[2-9]|4[2-5]|5[2-6]|7[3-7])\\d{6}', + 'ExampleNumber' => '21234567', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '67(?:1[0-8]|2[4-7])\\d{5}|(?:14|6[1-6]|[89]\\d)\\d{7}', + 'ExampleNumber' => '812345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '(?:001800\\d|1800)\\d{6}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 10, + 1 => 13, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '1900\\d{6}', + 'ExampleNumber' => '1900123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '6[08]\\d{7}', + 'ExampleNumber' => '601234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TH', + 'countryCode' => 66, + 'internationalPrefix' => '00[1-9]', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[13-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TJ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TJ.php new file mode 100644 index 00000000000..089d0adbfe5 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TJ.php @@ -0,0 +1,164 @@ + + [ + 'NationalNumberPattern' => '[0-57-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + 1 => 5, + 2 => 6, + 3 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3(?:1[3-5]|2[245]|3[12]|4[24-7]|5[25]|72)|4(?:46|74|87))\\d{6}', + 'ExampleNumber' => '372123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + 1 => 5, + 2 => 6, + 3 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:4(?:1[18]|4[02-479])|81[1-9])\\d{6}|(?:0[0-57-9]|1[017]|2[02]|[34]0|5[05]|7[0178]|8[078]|9\\d)\\d{7}', + 'ExampleNumber' => '917123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TJ', + 'countryCode' => 992, + 'internationalPrefix' => '810', + 'preferredInternationalPrefix' => '8~10', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{6})(\\d)(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '331', + 1 => '3317', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '44[02-479]|[34]7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{4})(\\d)(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '3[1-5]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[0-57-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TK.php new file mode 100644 index 00000000000..5426045a042 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TK.php @@ -0,0 +1,103 @@ + + [ + 'NationalNumberPattern' => '[2-47]\\d{3,6}', + 'PossibleLength' => + [ + 0 => 4, + 1 => 5, + 2 => 6, + 3 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[2-4]|[34]\\d)\\d{2,5}', + 'ExampleNumber' => '3101', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[2-4]\\d{2,5}', + 'ExampleNumber' => '7290', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TK', + 'countryCode' => 690, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TL.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TL.php new file mode 100644 index 00000000000..2d03480e2a2 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TL.php @@ -0,0 +1,139 @@ + + [ + 'NationalNumberPattern' => '7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[1-5]|3[1-9]|4[1-4])\\d{5}', + 'ExampleNumber' => '2112345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[2-8]\\d{6}', + 'ExampleNumber' => '77212345', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{5}', + 'ExampleNumber' => '8012345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90\\d{5}', + 'ExampleNumber' => '9012345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '70\\d{5}', + 'ExampleNumber' => '7012345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TL', + 'countryCode' => 670, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-489]|70', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TM.php new file mode 100644 index 00000000000..2f594f51143 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TM.php @@ -0,0 +1,139 @@ + + [ + 'NationalNumberPattern' => '[1-6]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:2\\d|3[1-9])|2(?:22|4[0-35-8])|3(?:22|4[03-9])|4(?:22|3[128]|4\\d|6[15])|5(?:22|5[7-9]|6[014-689]))\\d{5}', + 'ExampleNumber' => '12345678', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '6\\d{7}', + 'ExampleNumber' => '66123456', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TM', + 'countryCode' => 993, + 'internationalPrefix' => '810', + 'preferredInternationalPrefix' => '8~10', + 'nationalPrefix' => '8', + 'nationalPrefixForParsing' => '8', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '12', + ], + 'nationalPrefixFormattingRule' => '(8 $1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d)(\\d{2})(\\d{2})', + 'format' => '$1 $2-$3-$4', + 'leadingDigitsPatterns' => + [ + 0 => '[1-5]', + ], + 'nationalPrefixFormattingRule' => '(8 $1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '8 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TN.php new file mode 100644 index 00000000000..e8e8c3ab2bc --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TN.php @@ -0,0 +1,106 @@ + + [ + 'NationalNumberPattern' => '[2-57-9]\\d{7}', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '81200\\d{3}|(?:3[0-2]|7\\d)\\d{6}', + 'ExampleNumber' => '30010123', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '3(?:001|[12]40)\\d{4}|(?:(?:[259]\\d|4[0-8])\\d|3(?:1[1-35]|6[0-4]|91))\\d{5}', + 'ExampleNumber' => '20123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8010\\d{4}', + 'ExampleNumber' => '80101234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '88\\d{6}', + 'ExampleNumber' => '88123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8[12]10\\d{4}', + 'ExampleNumber' => '81101234', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TN', + 'countryCode' => 216, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-57-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TO.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TO.php new file mode 100644 index 00000000000..7691e8ffb9f --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TO.php @@ -0,0 +1,149 @@ + + [ + 'NationalNumberPattern' => '(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2\\d|3[0-8]|4[0-4]|50|6[09]|7[0-24-69]|8[05])\\d{3}', + 'ExampleNumber' => '20123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5(?:4[0-5]|5[4-6])|6(?:[09]\\d|3[02]|8[15-9])|(?:7\\d|8[46-9])\\d|999)\\d{4}', + 'ExampleNumber' => '7715123', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '0800\\d{3}', + 'ExampleNumber' => '0800222', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '55[0-37-9]\\d{4}', + 'ExampleNumber' => '5510123', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TO', + 'countryCode' => 676, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[2-4]|50|6[09]|7[0-24-69]|8[05]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[5-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TR.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TR.php new file mode 100644 index 00000000000..bb4872f9d98 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TR.php @@ -0,0 +1,244 @@ + + [ + 'NationalNumberPattern' => '4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + 2 => 12, + 3 => 13, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:[13][26]|[28][2468]|[45][268]|[67][246])|3(?:[13][28]|[24-6][2468]|[78][02468]|92)|4(?:[16][246]|[23578][2468]|4[26]))\\d{7}', + 'ExampleNumber' => '2123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '561(?:011|61\\d)\\d{4}|5(?:0[15-7]|1[06]|24|[34]\\d|5[1-59]|9[46])\\d{7}', + 'ExampleNumber' => '5012345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00\\d{7}(?:\\d{2,3})?|11\\d{7})', + 'ExampleNumber' => '8001234567', + 'PossibleLength' => + [ + 0 => 10, + 1 => 12, + 2 => 13, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:8[89]8|900)\\d{7}', + 'ExampleNumber' => '9001234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '592(?:21[12]|461)\\d{4}', + 'ExampleNumber' => '5922121234', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '850\\d{7}', + 'ExampleNumber' => '8500123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'NationalNumberPattern' => '512\\d{7}', + 'ExampleNumber' => '5123456789', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '444\\d{4}', + 'ExampleNumber' => '4441444', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '(?:444|811\\d{3})\\d{4}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'id' => 'TR', + 'countryCode' => 90, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d)(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '444', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '512|8[01589]|90', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '5(?:[0-59]|61)', + 1 => '5(?:[0-59]|61[06])', + 2 => '5(?:[0-59]|61[06]1)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[24][1-8]|3[1-9]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{6,7})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '512|8[01589]|90', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '5(?:[0-59]|61)', + 1 => '5(?:[0-59]|61[06])', + 2 => '5(?:[0-59]|61[06]1)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[24][1-8]|3[1-9]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{6,7})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TT.php new file mode 100644 index 00000000000..ade32d613af --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TT.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '868(?:2(?:01|1[5-9]|[23]\\d|4[0-2])|6(?:0[7-9]|1[02-8]|2[1-9]|[3-69]\\d|7[0-79])|82[124])\\d{4}', + 'ExampleNumber' => '8682211234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '868(?:(?:2[5-9]|3\\d)\\d|4(?:3[0-6]|[6-9]\\d)|6(?:20|78|8\\d)|7(?:0[1-9]|1[02-9]|[2-9]\\d))\\d{4}', + 'ExampleNumber' => '8682911234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '868619\\d{4}', + 'ExampleNumber' => '8686191234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TT', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-46-8]\\d{6})$|1', + 'nationalPrefixTransformRule' => '868$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '868', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TV.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TV.php new file mode 100644 index 00000000000..b6725e436f5 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TV.php @@ -0,0 +1,147 @@ + + [ + 'NationalNumberPattern' => '(?:2|7\\d\\d|90)\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2[02-9]\\d{3}', + 'ExampleNumber' => '20123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:7[01]\\d|90)\\d{4}', + 'ExampleNumber' => '901234', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TV', + 'countryCode' => 688, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '90', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TW.php new file mode 100644 index 00000000000..6e0193da174 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TW.php @@ -0,0 +1,190 @@ + + [ + 'NationalNumberPattern' => '[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + 4 => 11, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[2-8]\\d|370|55[01]|7[1-9])\\d{6}|4(?:(?:0(?:0[1-9]|[2-48]\\d)|1[023]\\d)\\d{4,5}|(?:[239]\\d\\d|4(?:0[56]|12|49))\\d{5})|6(?:[01]\\d{7}|4(?:0[56]|12|24|4[09])\\d{4,5})|8(?:(?:2(?:3\\d|4[0-269]|[578]0|66)|36[24-9]|90\\d\\d)\\d{4}|4(?:0[56]|12|24|4[09])\\d{4,5})|(?:2(?:2(?:0\\d\\d|4(?:0[68]|[249]0|3[0-467]|5[0-25-9]|6[0235689]))|(?:3(?:[09]\\d|1[0-4])|(?:4\\d|5[0-49]|6[0-29]|7[0-5])\\d)\\d)|(?:(?:3[2-9]|5[2-8]|6[0-35-79]|8[7-9])\\d\\d|4(?:2(?:[089]\\d|7[1-9])|(?:3[0-4]|[78]\\d|9[01])\\d))\\d)\\d{3}', + 'ExampleNumber' => '221234567', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:40001[0-2]|9[0-8]\\d{4})\\d{3}', + 'ExampleNumber' => '912345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-79]\\d{6}|800\\d{5}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '20(?:[013-9]\\d\\d|2)\\d{4}', + 'ExampleNumber' => '203123456', + 'PossibleLength' => + [ + 0 => 7, + 1 => 9, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '99\\d{7}', + 'ExampleNumber' => '990123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '7010(?:[0-2679]\\d|3[0-7]|8[0-5])\\d{5}|70\\d{8}', + 'ExampleNumber' => '7012345678', + 'PossibleLength' => + [ + 0 => 10, + 1 => 11, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '50[0-46-9]\\d{6}', + 'ExampleNumber' => '500123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'TW', + 'countryCode' => 886, + 'internationalPrefix' => '0(?:0[25-79]|19)', + 'nationalPrefix' => '0', + 'preferredExtnPrefix' => '#', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d)(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '202', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[258]0', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d)(\\d{3,4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]', + 1 => '[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[49]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4,5})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TZ.php new file mode 100644 index 00000000000..7cd2218dc84 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_TZ.php @@ -0,0 +1,139 @@ + + [ + 'NationalNumberPattern' => '(?:[25-8]\\d|41|90)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2[2-8]\\d{7}', + 'ExampleNumber' => '222345678', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '77[2-9]\\d{6}|(?:6[125-9]|7[13-689])\\d{7}', + 'ExampleNumber' => '621234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[08]\\d{6}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90\\d{7}', + 'ExampleNumber' => '900123456', + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '8(?:40|6[01])\\d{6}', + 'ExampleNumber' => '840123456', + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '41\\d{7}', + 'ExampleNumber' => '412345678', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '(?:8(?:[04]0|6[01])|90\\d)\\d{6}', + ], + 'id' => 'TZ', + 'countryCode' => 255, + 'internationalPrefix' => '00[056]', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[24]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '5', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[67]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UA.php new file mode 100644 index 00000000000..06a7df6ceaa --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UA.php @@ -0,0 +1,172 @@ + + [ + 'NationalNumberPattern' => '[89]\\d{9}|[3-9]\\d{8}', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:3[1-8]|4[13-8]|5[1-7]|6[12459])\\d{7}', + 'ExampleNumber' => '311234567', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:39|50|6[36-8]|7[1-3]|9[1-9])\\d{7}', + 'ExampleNumber' => '501234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800[1-8]\\d{5,6}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[239]\\d{5,6}', + 'ExampleNumber' => '900212345', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '89[1-579]\\d{6}', + 'ExampleNumber' => '891234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'UA', + 'countryCode' => 380, + 'internationalPrefix' => '00', + 'preferredInternationalPrefix' => '0~0', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]', + 1 => '6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])', + 1 => '3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[3-7]|89|9[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UG.php new file mode 100644 index 00000000000..1be8568b87a --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UG.php @@ -0,0 +1,147 @@ + + [ + 'NationalNumberPattern' => '800\\d{6}|(?:[29]0|[347]\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '20(?:(?:240|30[67])\\d|6(?:00[0-2]|30[0-4]))\\d{3}|(?:20(?:[017]\\d|2[5-9]|3[1-4]|5[0-4]|6[15-9])|[34]\\d{3})\\d{5}', + 'ExampleNumber' => '312345678', + 'PossibleLengthLocalOnly' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '72(?:[48]0|6[01])\\d{5}|7(?:[015-8]\\d|20|36|4[0-4]|9[89])\\d{6}', + 'ExampleNumber' => '712345678', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800[1-3]\\d{5}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[1-3]\\d{6}', + 'ExampleNumber' => '901123456', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'UG', + 'countryCode' => 256, + 'internationalPrefix' => '00[057]', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{4})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '202', + 1 => '2024', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[27-9]|4(?:6[45]|[7-9])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[34]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_US.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_US.php new file mode 100644 index 00000000000..c4b84870f19 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_US.php @@ -0,0 +1,168 @@ + + [ + 'NationalNumberPattern' => '[2-9]\\d{9}|3\\d{6}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[237-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}', + 'ExampleNumber' => '2015550123', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5056(?:[0-35-9]\\d|4[468])|7302[0-3]\\d)\\d{4}|(?:472[24]|505[2-57-9]|7306|983[237-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[013569]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}', + 'ExampleNumber' => '2015550123', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'US', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '1', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '310', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[24-9]|3(?:[02-9]|1[1-9])', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '($1) $2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '310', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1-$2-$3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-9]', + ], + ], + ], + 'mainCountryForCode' => true, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UY.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UY.php new file mode 100644 index 00000000000..da4e4b21ee7 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UY.php @@ -0,0 +1,195 @@ + + [ + 'NationalNumberPattern' => '0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + 6 => 12, + 7 => 13, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:770|9(?:20|87))|(?:2\\d|4[2-7])\\d\\d)\\d{4}', + 'ExampleNumber' => '21231234', + 'PossibleLength' => + [ + 0 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '9[1-9]\\d{6}', + 'ExampleNumber' => '94231234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '0004\\d{2,9}|(?:405|80[05])\\d{4}', + 'ExampleNumber' => '8001234', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[0-8]\\d{4}', + 'ExampleNumber' => '9001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'UY', + 'countryCode' => 598, + 'internationalPrefix' => '0(?:0|1[3-9]\\d)', + 'preferredInternationalPrefix' => '00', + 'nationalPrefix' => '0', + 'preferredExtnPrefix' => ' int. ', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[49]0|8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '9', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[124]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{2,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '0', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UZ.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UZ.php new file mode 100644 index 00000000000..7a3141d9b72 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_UZ.php @@ -0,0 +1,115 @@ + + [ + 'NationalNumberPattern' => '(?:20|33|[5-79]\\d|88)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:55\\d\\d|6(?:1(?:22|3[124]|4[1-4]|5[1-3578]|64)|2(?:22|3[0-57-9]|41)|5(?:22|3[3-7]|5[024-8])|6\\d\\d|7(?:[23]\\d|7[69])|9(?:22|4[1-8]|6[135]))|7(?:0(?:5[4-9]|6[0146]|7[124-6]|9[135-8])|(?:1[12]|[68]\\d)\\d|2(?:22|3[13-57-9]|4[1-3579]|5[14])|3(?:2\\d|3[1578]|4[1-35-7]|5[1-57]|61)|4(?:2\\d|3[1-579]|7[1-79])|5(?:22|5[1-9]|6[1457])|9(?:22|5[1-9])))\\d{5}', + 'ExampleNumber' => '669050123', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:(?:[25]0|33|88|9[0-57-9])\\d{3}|6(?:1(?:2(?:2[01]|98)|35[0-4]|50\\d|61[23]|7(?:[01][017]|4\\d|55|9[5-9]))|2(?:(?:11|7\\d)\\d|2(?:[12]1|9[01379])|5(?:[126]\\d|3[0-4]))|5(?:19[01]|2(?:27|9[26])|(?:30|59|7\\d)\\d)|6(?:2(?:1[5-9]|2[0367]|38|41|52|60)|(?:3[79]|9[0-3])\\d|4(?:56|83)|7(?:[07]\\d|1[017]|3[07]|4[047]|5[057]|67|8[0178]|9[79]))|7(?:2(?:24|3[237]|4[5-9]|7[15-8])|5(?:7[12]|8[0589])|7(?:0\\d|[39][07])|9(?:0\\d|7[079]))|9(?:2(?:1[1267]|3[01]|5\\d|7[0-4])|(?:5[67]|7\\d)\\d|6(?:2[0-26]|8\\d)))|7(?:[07]\\d{3}|1(?:13[01]|6(?:0[47]|1[67]|66)|71[3-69]|98\\d)|2(?:2(?:2[79]|95)|3(?:2[5-9]|6[0-6])|57\\d|7(?:0\\d|1[17]|2[27]|3[37]|44|5[057]|66|88))|3(?:2(?:1[0-6]|21|3[469]|7[159])|(?:33|9[4-6])\\d|5(?:0[0-4]|5[579]|9\\d)|7(?:[0-3579]\\d|4[0467]|6[67]|8[078]))|4(?:2(?:29|5[0257]|6[0-7]|7[1-57])|5(?:1[0-4]|8\\d|9[5-9])|7(?:0\\d|1[024589]|2[0-27]|3[0137]|[46][07]|5[01]|7[5-9]|9[079])|9(?:7[015-9]|[89]\\d))|5(?:112|2(?:0\\d|2[29]|[49]4)|3[1568]\\d|52[6-9]|7(?:0[01578]|1[017]|[23]7|4[047]|[5-7]\\d|8[78]|9[079]))|9(?:22[128]|3(?:2[0-4]|7\\d)|57[02569]|7(?:2[05-9]|3[37]|4\\d|60|7[2579]|87|9[07]))))\\d{4}', + 'ExampleNumber' => '912345678', + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'UZ', + 'countryCode' => 998, + 'internationalPrefix' => '810', + 'preferredInternationalPrefix' => '8~10', + 'nationalPrefix' => '8', + 'nationalPrefixForParsing' => '8', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '[235-9]', + ], + 'nationalPrefixFormattingRule' => '8 $1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VA.php new file mode 100644 index 00000000000..6165b64d562 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VA.php @@ -0,0 +1,140 @@ + + [ + 'NationalNumberPattern' => '0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + 6 => 12, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '06698\\d{1,6}', + 'ExampleNumber' => '0669812345', + 'PossibleLength' => + [ + 0 => 6, + 1 => 7, + 2 => 8, + 3 => 9, + 4 => 10, + 5 => 11, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '3[1-9]\\d{8}|3[2-9]\\d{7}', + 'ExampleNumber' => '3123456789', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80(?:0\\d{3}|3)\\d{3}', + 'ExampleNumber' => '800123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}', + 'ExampleNumber' => '899123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '84(?:[08]\\d{3}|[17])\\d{3}', + 'ExampleNumber' => '848123456', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '1(?:78\\d|99)\\d{6}', + 'ExampleNumber' => '1781234567', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '55\\d{8}', + 'ExampleNumber' => '5512345678', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '3[2-8]\\d{9,10}', + 'ExampleNumber' => '33101234501', + 'PossibleLength' => + [ + 0 => 11, + 1 => 12, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'VA', + 'countryCode' => 39, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '06698', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VC.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VC.php new file mode 100644 index 00000000000..93056ef2f14 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VC.php @@ -0,0 +1,112 @@ + + [ + 'NationalNumberPattern' => '(?:[58]\\d\\d|784|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '784(?:266|3(?:6[6-9]|7\\d|8[0-6])|4(?:38|5[0-36-8]|8[0-8])|5(?:55|7[0-2]|93)|638|784)\\d{4}', + 'ExampleNumber' => '7842661234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '784(?:4(?:3[0-5]|5[45]|89|9[0-8])|5(?:2[6-9]|3[0-4])|720)\\d{4}', + 'ExampleNumber' => '7844301234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'NationalNumberPattern' => '78451[0-2]\\d{4}', + 'ExampleNumber' => '7845101234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'VC', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-7]\\d{6})$|1', + 'nationalPrefixTransformRule' => '784$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '784', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VE.php new file mode 100644 index 00000000000..5c58e29ec6e --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VE.php @@ -0,0 +1,120 @@ + + [ + 'NationalNumberPattern' => '[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:12|3[457-9]|[467]\\d|[58][1-9]|9[1-6])|[4-6]00)\\d{7}', + 'ExampleNumber' => '2121234567', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4(?:1[24-8]|2[46])\\d{7}', + 'ExampleNumber' => '4121234567', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{7}', + 'ExampleNumber' => '8001234567', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '90[01]\\d{7}', + 'ExampleNumber' => '9001234567', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '501\\d{7}', + 'ExampleNumber' => '5010123456', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'VE', + 'countryCode' => 58, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{7})', + 'format' => '$1-$2', + 'leadingDigitsPatterns' => + [ + 0 => '[24-689]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '$CC $1', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VG.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VG.php new file mode 100644 index 00000000000..59188f69e37 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VG.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '(?:284|[58]\\d\\d|900)\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '284(?:229|4(?:22|9[45])|774|8(?:52|6[459]))\\d{4}', + 'ExampleNumber' => '2842291234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '284(?:245|3(?:0[0-3]|4[0-7]|68|9[34])|4(?:4[0-6]|68|9[69])|5(?:4[0-7]|68|9[69]))\\d{4}', + 'ExampleNumber' => '2843001234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'VG', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-578]\\d{6})$|1', + 'nationalPrefixTransformRule' => '284$1', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '284', + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VI.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VI.php new file mode 100644 index 00000000000..aa5c9d130f4 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VI.php @@ -0,0 +1,110 @@ + + [ + 'NationalNumberPattern' => '[58]\\d{9}|(?:34|90)0\\d{7}', + 'PossibleLength' => + [ + 0 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '340(?:2(?:0[0-368]|2[06-8]|4[49]|77)|3(?:32|44)|4(?:2[23]|44|7[34]|89)|5(?:1[34]|55)|6(?:2[56]|4[23]|77|9[023])|7(?:1[2-57-9]|2[57]|7\\d)|884|998)\\d{4}', + 'ExampleNumber' => '3406421234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '340(?:2(?:0[0-368]|2[06-8]|4[49]|77)|3(?:32|44)|4(?:2[23]|44|7[34]|89)|5(?:1[34]|55)|6(?:2[56]|4[23]|77|9[023])|7(?:1[2-57-9]|2[57]|7\\d)|884|998)\\d{4}', + 'ExampleNumber' => '3406421234', + 'PossibleLengthLocalOnly' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '8(?:00|33|44|55|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '8002345678', + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900[2-9]\\d{6}', + 'ExampleNumber' => '9002345678', + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'NationalNumberPattern' => '52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}', + 'ExampleNumber' => '5002345678', + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'VI', + 'countryCode' => 1, + 'internationalPrefix' => '011', + 'nationalPrefix' => '1', + 'nationalPrefixForParsing' => '([2-9]\\d{6})$|1', + 'nationalPrefixTransformRule' => '340$1', + 'sameMobileAndFixedLinePattern' => true, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'leadingDigits' => '340', + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VN.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VN.php new file mode 100644 index 00000000000..fffeb663b38 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VN.php @@ -0,0 +1,299 @@ + + [ + 'NationalNumberPattern' => '[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + 3 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '2(?:0[3-9]|1[0-689]|2[0-25-9]|[38][2-9]|4[2-8]|5[124-9]|6[0-39]|7[0-7]|9[0-4679])\\d{7}', + 'ExampleNumber' => '2101234567', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:5(?:2[238]|59)|89[6-9]|99[013-9])\\d{6}|(?:3\\d|5[1689]|7[06-9]|8[1-8]|9[0-8])\\d{7}', + 'ExampleNumber' => '912345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '1800\\d{4,6}|12(?:0[13]|28)\\d{4}', + 'ExampleNumber' => '1800123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '1900\\d{4,6}', + 'ExampleNumber' => '1900123456', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + 2 => 10, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '672\\d{6}', + 'ExampleNumber' => '672012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:[17]99|80\\d)\\d{4}|69\\d{5,6}', + 'ExampleNumber' => '1992000', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'NationalNumberPattern' => '[17]99\\d{4}|69\\d{5,6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + ], + 'id' => 'VN', + 'countryCode' => 84, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[17]99', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '69', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{4})(\\d{4,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[357-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 6 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2[48]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 7 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 1 => + [ + 'pattern' => '(\\d{4})(\\d{4,6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '6', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 3 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[357-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{4})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2[48]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{4})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => true, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VU.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VU.php new file mode 100644 index 00000000000..6328d4fd87d --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_VU.php @@ -0,0 +1,123 @@ + + [ + 'NationalNumberPattern' => '[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 7, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:38[0-8]|48[4-9])\\d\\d|(?:2[02-9]|3[4-7]|88)\\d{3}', + 'ExampleNumber' => '22123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:[58]\\d|7[013-7])\\d{5}', + 'ExampleNumber' => '5912345', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '81[18]\\d\\d', + 'ExampleNumber' => '81123', + 'PossibleLength' => + [ + 0 => 5, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:0[1-9]|1[01])\\d{4}', + 'ExampleNumber' => '9010123', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '(?:3[03]|900\\d)\\d{3}', + 'ExampleNumber' => '30123', + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'VU', + 'countryCode' => 678, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[57-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WF.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WF.php new file mode 100644 index 00000000000..6a0ab7cc424 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WF.php @@ -0,0 +1,137 @@ + + [ + 'NationalNumberPattern' => '(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?', + 'PossibleLength' => + [ + 0 => 6, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '72\\d{4}', + 'ExampleNumber' => '721234', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:72|8[23])\\d{4}', + 'ExampleNumber' => '821234', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80[0-5]\\d{6}', + 'ExampleNumber' => '800012345', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'NationalNumberPattern' => '[48]0\\d{4}', + 'ExampleNumber' => '401234', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'WF', + 'countryCode' => 681, + 'internationalPrefix' => '00', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[478]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})', + 'format' => '$1 $2 $3 $4', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WS.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WS.php new file mode 100644 index 00000000000..231906a9bc9 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_WS.php @@ -0,0 +1,151 @@ + + [ + 'NationalNumberPattern' => '(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '6[1-9]\\d{3}|(?:[2-5]|60)\\d{4}', + 'ExampleNumber' => '22123', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:7[1-35-7]|8(?:[3-7]|9\\d{3}))\\d{5}', + 'ExampleNumber' => '7212345', + 'PossibleLength' => + [ + 0 => 7, + 1 => 10, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{3}', + 'ExampleNumber' => '800123', + 'PossibleLength' => + [ + 0 => 6, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'WS', + 'countryCode' => 685, + 'internationalPrefix' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{5})', + 'format' => '$1', + 'leadingDigitsPatterns' => + [ + 0 => '[2-5]|6[1-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3,7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[68]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_XK.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_XK.php new file mode 100644 index 00000000000..ea6b468df18 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_XK.php @@ -0,0 +1,147 @@ + + [ + 'NationalNumberPattern' => '[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}', + 'PossibleLength' => + [ + 0 => 8, + 1 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2[89]|39)0\\d{6}|[23][89]\\d{6}', + 'ExampleNumber' => '28012345', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '4[3-9]\\d{6}', + 'ExampleNumber' => '43201234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{5}', + 'ExampleNumber' => '80001234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '900\\d{5}', + 'ExampleNumber' => '90001234', + 'PossibleLength' => + [ + 0 => 8, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'XK', + 'countryCode' => 383, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[89]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[2-4]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[23]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YE.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YE.php new file mode 100644 index 00000000000..0e173296425 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YE.php @@ -0,0 +1,145 @@ + + [ + 'NationalNumberPattern' => '(?:1|7\\d)\\d{7}|[1-7]\\d{6}', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + 2 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '78[0-7]\\d{4}|17\\d{6}|(?:[12][2-68]|3[2358]|4[2-58]|5[2-6]|6[3-58]|7[24-6])\\d{5}', + 'ExampleNumber' => '1234567', + 'PossibleLength' => + [ + 0 => 7, + 1 => 8, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7[01378]\\d{7}', + 'ExampleNumber' => '712345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'YE', + 'countryCode' => 967, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-6]|7(?:[24-6]|8[0-7])', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YT.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YT.php new file mode 100644 index 00000000000..4013fdd5b55 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_YT.php @@ -0,0 +1,98 @@ + + [ + 'NationalNumberPattern' => '(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}', + 'ExampleNumber' => '269601234', + ], + 'mobile' => + [ + 'NationalNumberPattern' => '639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])\\d{4}', + 'ExampleNumber' => '639012345', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{7}', + 'ExampleNumber' => '801234567', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '9(?:(?:39|47)8[01]|769\\d)\\d{4}', + 'ExampleNumber' => '939801234', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'YT', + 'countryCode' => 262, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZA.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZA.php new file mode 100644 index 00000000000..6c3b281ee78 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZA.php @@ -0,0 +1,190 @@ + + [ + 'NationalNumberPattern' => '[1-79]\\d{8}|8\\d{4,9}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:2(?:0330|4302)|52087)0\\d{3}|(?:1[0-8]|2[1-378]|3[1-69]|4\\d|5[1346-8])\\d{7}', + 'ExampleNumber' => '101234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:1(?:3492[0-25]|4495[0235]|549(?:20|5[01]))|4[34]492[01])\\d{3}|8[1-4]\\d{3,7}|(?:2[27]|47|54)4950\\d{3}|(?:1(?:049[2-4]|9[12]\\d\\d)|(?:6\\d|7[0-46-9])\\d{3}|8(?:5\\d{3}|7(?:08[67]|158|28[5-9]|310)))\\d{4}|(?:1[6-8]|28|3[2-69]|4[025689]|5[36-8])4920\\d{3}|(?:12|[2-5]1)492\\d{4}', + 'ExampleNumber' => '711234567', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80\\d{7}', + 'ExampleNumber' => '801234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'premiumRate' => + [ + 'NationalNumberPattern' => '(?:86[2-9]|9[0-2]\\d)\\d{6}', + 'ExampleNumber' => '862345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'sharedCost' => + [ + 'NationalNumberPattern' => '860\\d{6}', + 'ExampleNumber' => '860123456', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '87(?:08[0-589]|15[0-79]|28[0-4]|31[1-9])\\d{4}|87(?:[02][0-79]|1[0-46-9]|3[02-9]|[4-9]\\d)\\d{5}', + 'ExampleNumber' => '871234567', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'NationalNumberPattern' => '861\\d{6,7}', + 'ExampleNumber' => '861123456', + 'PossibleLength' => + [ + 0 => 9, + 1 => 10, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ZA', + 'countryCode' => 27, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{2})(\\d{3,4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8[1-4]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{2,3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8[1-4]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '860', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => true, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZM.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZM.php new file mode 100644 index 00000000000..277ba67d557 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZM.php @@ -0,0 +1,169 @@ + + [ + 'NationalNumberPattern' => '800\\d{6}|(?:21|63|[79]\\d)\\d{7}', + 'PossibleLength' => + [ + 0 => 9, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '21[1-8]\\d{6}', + 'ExampleNumber' => '211234567', + 'PossibleLengthLocalOnly' => + [ + 0 => 6, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '(?:7[5-79]|9[5-8])\\d{7}', + 'ExampleNumber' => '955123456', + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '800\\d{6}', + 'ExampleNumber' => '800123456', + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '63\\d{7}', + 'ExampleNumber' => '630123456', + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ZM', + 'countryCode' => 260, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[1-9]', + ], + 'nationalPrefixFormattingRule' => '', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[28]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[79]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'intlNumberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[28]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '[79]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZW.php b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZW.php new file mode 100644 index 00000000000..283ffc7c906 --- /dev/null +++ b/lib/giggsey/libphonenumber-for-php-lite/src/data/PhoneNumberMetadata_ZW.php @@ -0,0 +1,248 @@ + + [ + 'NationalNumberPattern' => '2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}', + 'PossibleLength' => + [ + 0 => 5, + 1 => 6, + 2 => 7, + 3 => 8, + 4 => 9, + 5 => 10, + ], + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + 1 => 4, + ], + ], + 'fixedLine' => + [ + 'NationalNumberPattern' => '(?:1(?:(?:3\\d|9)\\d|[4-8])|2(?:(?:(?:0(?:2[014]|5)|(?:2[0157]|31|84|9)\\d\\d|[56](?:[14]\\d\\d|20)|7(?:[089]|2[03]|[35]\\d\\d))\\d|4(?:2\\d\\d|8))\\d|1(?:2|[39]\\d{4}))|3(?:(?:123|(?:29\\d|92)\\d)\\d\\d|7(?:[19]|[56]\\d))|5(?:0|1[2-478]|26|[37]2|4(?:2\\d{3}|83)|5(?:25\\d\\d|[78])|[689]\\d)|6(?:(?:[16-8]21|28|52[013])\\d\\d|[39])|8(?:[1349]28|523)\\d\\d)\\d{3}|(?:4\\d\\d|9[2-9])\\d{4,5}|(?:(?:2(?:(?:(?:0|8[146])\\d|7[1-7])\\d|2(?:[278]\\d|92)|58(?:2\\d|3))|3(?:[26]|9\\d{3})|5(?:4\\d|5)\\d\\d)\\d|6(?:(?:(?:[0-246]|[78]\\d)\\d|37)\\d|5[2-8]))\\d\\d|(?:2(?:[569]\\d|8[2-57-9])|3(?:[013-59]\\d|8[37])|6[89]8)\\d{3}', + 'ExampleNumber' => '1312345', + 'PossibleLengthLocalOnly' => + [ + 0 => 3, + 1 => 4, + ], + ], + 'mobile' => + [ + 'NationalNumberPattern' => '7(?:[178]\\d|3[1-9])\\d{6}', + 'ExampleNumber' => '712345678', + 'PossibleLength' => + [ + 0 => 9, + ], + ], + 'tollFree' => + [ + 'NationalNumberPattern' => '80(?:[01]\\d|20|8[0-8])\\d{3}', + 'ExampleNumber' => '8001234', + 'PossibleLength' => + [ + 0 => 7, + ], + ], + 'premiumRate' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'sharedCost' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'personalNumber' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voip' => + [ + 'NationalNumberPattern' => '86(?:1[12]|22|30|44|55|77|8[368])\\d{6}', + 'ExampleNumber' => '8686123456', + 'PossibleLength' => + [ + 0 => 10, + ], + ], + 'pager' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'uan' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'voicemail' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'noInternationalDialling' => + [ + 'PossibleLength' => + [ + 0 => -1, + ], + ], + 'id' => 'ZW', + 'countryCode' => 263, + 'internationalPrefix' => '00', + 'nationalPrefix' => '0', + 'nationalPrefixForParsing' => '0', + 'sameMobileAndFixedLinePattern' => false, + 'numberFormat' => + [ + 0 => + [ + 'pattern' => '(\\d{3})(\\d{3,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 1 => + [ + 'pattern' => '(\\d)(\\d{3})(\\d{2,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '[49]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 2 => + [ + 'pattern' => '(\\d{3})(\\d{4})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '80', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 3 => + [ + 'pattern' => '(\\d{2})(\\d{7})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2', + 1 => '2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]', + ], + 'nationalPrefixFormattingRule' => '(0$1)', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 4 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '7', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 5 => + [ + 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)', + 1 => '2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 6 => + [ + 'pattern' => '(\\d{4})(\\d{6})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '8', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 7 => + [ + 'pattern' => '(\\d{2})(\\d{3,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 8 => + [ + 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})', + 'format' => '$1 $2 $3', + 'leadingDigitsPatterns' => + [ + 0 => '29[013-9]|39|54', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + 9 => + [ + 'pattern' => '(\\d{4})(\\d{3,5})', + 'format' => '$1 $2', + 'leadingDigitsPatterns' => + [ + 0 => '(?:25|54)8', + 1 => '258|5483', + ], + 'nationalPrefixFormattingRule' => '0$1', + 'domesticCarrierCodeFormattingRule' => '', + 'nationalPrefixOptionalWhenFormatting' => false, + ], + ], + 'mainCountryForCode' => false, + 'mobileNumberPortableRegion' => false, +]; diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index 94fe3d6f50c..27b73d8c975 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -815,4 +815,11 @@ All rights reserved. MIT https://github.com/spatie/php-cloneable + + giggsey/libphonenumber-for-php-lite + libphonenumber for PHP (Lite) + 8.13.31 + Apache 2.0 + https://github.com/giggsey/libphonenumber-for-php-lite + From 10c3e4b7703d409f0e0e06c36bc054f256521a7f Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 1 Mar 2024 08:57:55 +0800 Subject: [PATCH 03/12] MDL-81924 core_sms: Add new subsystem and plugintype Originally implemented as MDL-80960. --- .upgradenotes/MDL-81924-2024071006131218.yml | 5 + lang/en/sms.php | 41 ++ lib/classes/plugininfo/smsgateway.php | 99 ++++ lib/components.json | 4 +- lib/db/install.xml | 32 +- lib/db/upgrade.php | 48 ++ lib/tests/attribute_helper_test.php | 2 +- lib/tests/component_test.php | 2 +- sms/classes/description.php | 28 ++ sms/classes/gateway.php | 125 +++++ sms/classes/manager.php | 318 +++++++++++++ sms/classes/message.php | 165 +++++++ sms/classes/message_status.php | 95 ++++ sms/classes/privacy/provider.php | 154 ++++++ sms/classes/status.php | 51 ++ sms/gateway/.placeholder | 1 + sms/tests/fixtures/dummy_gateway.php | 56 +++ sms/tests/gateway_test.php | 69 +++ sms/tests/manager_test.php | 458 ++++++++++++++++++ sms/tests/message_status_test.php | 57 +++ sms/tests/message_test.php | 146 ++++++ sms/tests/privacy/provider_test.php | 463 +++++++++++++++++++ version.php | 2 +- 23 files changed, 2416 insertions(+), 5 deletions(-) create mode 100644 .upgradenotes/MDL-81924-2024071006131218.yml create mode 100644 lang/en/sms.php create mode 100644 lib/classes/plugininfo/smsgateway.php create mode 100644 sms/classes/description.php create mode 100644 sms/classes/gateway.php create mode 100644 sms/classes/manager.php create mode 100644 sms/classes/message.php create mode 100644 sms/classes/message_status.php create mode 100644 sms/classes/privacy/provider.php create mode 100644 sms/classes/status.php create mode 100644 sms/gateway/.placeholder create mode 100644 sms/tests/fixtures/dummy_gateway.php create mode 100644 sms/tests/gateway_test.php create mode 100644 sms/tests/manager_test.php create mode 100644 sms/tests/message_status_test.php create mode 100644 sms/tests/message_test.php create mode 100644 sms/tests/privacy/provider_test.php diff --git a/.upgradenotes/MDL-81924-2024071006131218.yml b/.upgradenotes/MDL-81924-2024071006131218.yml new file mode 100644 index 00000000000..2ee899afd94 --- /dev/null +++ b/.upgradenotes/MDL-81924-2024071006131218.yml @@ -0,0 +1,5 @@ +issueNumber: MDL-81924 +notes: + core_sms: + - message: A new `\core_sms` subsystem has been created + type: improved diff --git a/lang/en/sms.php b/lang/en/sms.php new file mode 100644 index 00000000000..138a82a6d7d --- /dev/null +++ b/lang/en/sms.php @@ -0,0 +1,41 @@ +. + +/** + * Strings for component 'sms', language 'en' + * + * @package core + * @category string + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +$string['phonenumbernotvalid'] = 'Format of phone number not recognised: {$a->message}'; +$string['privacy:metadata:sms_messages'] = 'Stores messages sent via SMS'; +$string['privacy:metadata:sms_messages:content'] = 'The message text'; +$string['privacy:metadata:sms_messages:id'] = 'The ID of the message'; +$string['privacy:metadata:sms_messages:recipient'] = 'The phone number that the message was sent to'; +$string['privacy:metadata:sms_messages:recipientuserid'] = 'The user who the message was sent to, if known'; +$string['privacy:metadata:sms_messages:status'] = 'The status of the message'; +$string['privacy:metadata:sms_messages:timecreated'] = 'The time the message was created'; +$string['privacy:sms:sensitive_not_shown'] = 'The content of this message was not stored as it was marked as containing sensitive content.'; +$string['sms'] = 'SMS'; +$string['status:gateway_failed'] = 'The gateway has failed to send the message'; +$string['status:gateway_not_available'] = 'The gateway is not available to send the message'; +$string['status:gateway_queued'] = 'The message is queued to be sent by the gateway'; +$string['status:gateway_rejected'] = 'The gateway has rejected the message'; +$string['status:gateway_sent'] = 'The message has been sent by the gateway'; +$string['status:message_over_size'] = 'The message is too large to be sent by the gateway'; +$string['status:unknown'] = 'Unable to determine the status of the message'; diff --git a/lib/classes/plugininfo/smsgateway.php b/lib/classes/plugininfo/smsgateway.php new file mode 100644 index 00000000000..2a848a2c132 --- /dev/null +++ b/lib/classes/plugininfo/smsgateway.php @@ -0,0 +1,99 @@ +. + +namespace core\plugininfo; + +use core_plugin_manager; +use moodle_url; + +/** + * SMS gateway subplugin info class. + * + * @package core + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class smsgateway extends base { + #[\Override] + public function is_uninstall_allowed(): bool { + return true; + } + + #[\Override] + public function get_settings_section_name(): string { + return "smsgateway{$this->name}"; + } + + #[\Override] + public function load_settings( + \part_of_admin_tree $adminroot, + $parentnodename, + $hassiteconfig, + ): void { + global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them. + /** @var \admin_root $ADMIN */ + $ADMIN = $adminroot; // May be used in settings.php. + $plugininfo = $this; // Also can be used inside settings.php. + + if (!$this->is_installed_and_upgraded()) { + return; + } + + if (!$hassiteconfig) { + return; + } + + $section = $this->get_settings_section_name(); + + $settings = null; + if (file_exists($this->full_path('settings.php'))) { + $settings = new \admin_settingpage($section, $this->displayname, 'moodle/site:config', $this->is_enabled() === false); + include($this->full_path('settings.php')); // This may also set $settings to null. + } + if ($settings) { + $ADMIN->add($parentnodename, $settings); + } + } + + #[\Override] + public static function get_manage_url(): moodle_url { + return new \moodle_url('/admin/settings.php', [ + 'section' => 'smsgateway', + ]); + } + + #[\Override] + public static function get_enabled_plugins(): ?array { + $pluginmanager = core_plugin_manager::instance(); + $plugins = $pluginmanager->get_installed_plugins('smsgateway'); + + if (!$plugins) { + return []; + } + + $plugins = array_keys($plugins); + + // Filter to return only enabled plugins. + $enabled = []; + foreach ($plugins as $plugin) { + $disabled = get_config('smsgateway_' . $plugin, 'disabled'); + if (empty($disabled)) { + $enabled[$plugin] = $plugin; + } + } + return $enabled; + } +} diff --git a/lib/components.json b/lib/components.json index 4bf7c34b6bb..c11288c46f4 100644 --- a/lib/components.json +++ b/lib/components.json @@ -43,7 +43,8 @@ "theme": "theme", "local": "local", "h5plib": "h5p\/h5plib", - "paygw": "payment\/gateway" + "paygw": "payment\/gateway", + "smsgateway": "sms/gateway" }, "subsystems": { "ai": "ai", @@ -118,6 +119,7 @@ "rss": "rss", "role": "admin\/roles", "search": "search", + "sms": "sms", "table": "lib\/table", "tag": "tag", "timezones": null, diff --git a/lib/db/install.xml b/lib/db/install.xml index a0b60ca97c8..b7bd829f0ac 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -4939,5 +4939,35 @@ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 07c40d79c09..57ed56d25ac 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -1373,5 +1373,53 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2024091700.01); } + if ($oldversion < 2024092000.01) { + + // Define table sms_messages to be created. + $table = new xmldb_table('sms_messages'); + + // Adding fields to table sms_messages. + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); + $table->add_field('recipientnumber', XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null); + $table->add_field('content', XMLDB_TYPE_TEXT, null, null, null, null, null); + $table->add_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); + $table->add_field('messagetype', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null); + $table->add_field('recipientuserid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); + $table->add_field('issensitive', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0'); + $table->add_field('gatewayid', XMLDB_TYPE_INTEGER, '10', null, null, null, null); + $table->add_field('status', XMLDB_TYPE_CHAR, '100', null, null, null, null); + $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null); + + // Adding keys to table sms_messages. + $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); + $table->add_key('gateway', XMLDB_KEY_FOREIGN, ['gatewayid'], 'sms_gateways', ['id']); + + // Conditionally launch create table for sms_messages. + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } + + // Define table sms_gateways to be created. + $table = new xmldb_table('sms_gateways'); + + // Adding fields to table sms_gateways. + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null); + $table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); + $table->add_field('gateway', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null); + $table->add_field('enabled', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1'); + $table->add_field('config', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null); + + // Adding keys to table sms_gateways. + $table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']); + + // Conditionally launch create table for sms_gateways. + if (!$dbman->table_exists($table)) { + $dbman->create_table($table); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2024092000.01); + } + return true; } diff --git a/lib/tests/attribute_helper_test.php b/lib/tests/attribute_helper_test.php index 4a7a919de3b..8a2ab8e420d 100644 --- a/lib/tests/attribute_helper_test.php +++ b/lib/tests/attribute_helper_test.php @@ -136,7 +136,7 @@ final class attribute_helper_test extends \advanced_testcase { $this->assertInstanceOf(attribute_helper_attribute_b::class, $instance); } - public function test_get_attributes_invalid(): void { + public function test_get_attributes_not_valid(): void { $this->assertNull(attribute_helper::from(non_existent_class::class)); $this->assertNull(attribute_helper::from([non_existent_class::class])); $this->assertNull(attribute_helper::from([attribute_helper_example::class, 'non_existent'])); diff --git a/lib/tests/component_test.php b/lib/tests/component_test.php index 999b5c40a54..bc852f72201 100644 --- a/lib/tests/component_test.php +++ b/lib/tests/component_test.php @@ -43,7 +43,7 @@ final class component_test extends \advanced_testcase { * this is defined here to annoy devs that try to add more without any thinking, * always verify that it does not collide with any existing add-on modules and subplugins!!! */ - const SUBSYSTEMCOUNT = 79; + const SUBSYSTEMCOUNT = 80; public function test_get_core_subsystems(): void { global $CFG; diff --git a/sms/classes/description.php b/sms/classes/description.php new file mode 100644 index 00000000000..343cd5f96e5 --- /dev/null +++ b/sms/classes/description.php @@ -0,0 +1,28 @@ +. + +namespace core_sms; + +/** + * A language string attribute used for a description. + * + * @package core_sms + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +#[\Attribute] +class description extends \lang_string { +} diff --git a/sms/classes/gateway.php b/sms/classes/gateway.php new file mode 100644 index 00000000000..789db340aa1 --- /dev/null +++ b/sms/classes/gateway.php @@ -0,0 +1,125 @@ +. + +namespace core_sms; + +use coding_exception; +use Spatie\Cloneable\Cloneable; + +/** + * Class gateway + * + * @package core_sms + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @property-read int $id The id of the gateway in the database + * @property-read bool $enabled Whether the gateway is enabled + * @property-read \stdClass $config The configuration for this instance + */ +abstract class gateway { + use Cloneable; + + /** @var \stdClass The configuration for this instance */ + public readonly ?\stdClass $config; + + /** + * Create a new gateway. + * + * @param bool $enabled Whether the gateway is enabled + * @param string $config The configuration for this instance + * @param int|null $id The id of the gateway in the database + */ + public function __construct( + /** @var bool Whether the gateway is enabled */ + public readonly bool $enabled, + string $config, + /** @var null|int The ID of the gateway in the database, or null if it has not been persisted yet */ + public readonly ?int $id = null, + ) { + $this->config = json_decode($config); + } + + /** + * Convert this object to a stdClass. + * + * @return \stdClass + */ + public function to_record(): \stdClass { + return (object) [ + 'id' => $this->id, + 'gateway' => get_class($this), + 'enabled' => $this->enabled, + 'config' => json_encode($this->config), + ]; + } + + /** + * Send the given message. + * + * @param message $message + * @return message + */ + abstract public function send(message $message): message; + + /** + * Confirm whether this gateway can send the given message. + * + * @param message $message + * @return bool + */ + public function can_send(message $message): bool { + return $this->get_send_priority($message) > 0; + } + + /** + * Get the priority of this gateway for sending the given message. + * + * A priority of 0 means that the gateway cannot send the message. + * Higher values are higher priority. + * + * This method is called frequently, so should be fast. + * If calculation is expensive the value should be cached. + * + * @param message $message + * @return int + */ + abstract public function get_send_priority(message $message): int; + + /** + * Update the status of the given message from the gateway. + * + * @param message $message + * @return message + * @throws coding_exception + */ + public function update_message_status(message $message): message { + if ($message->gatewayid !== $this->id) { + throw new \coding_exception('This gateway cannot update the status of this message'); + } + + return $message; + } + + /** + * Update the statuses of the given messages from the gateway. + * + * @param message[] $messages + * @return message[] + */ + public function update_message_statuses(array $messages): array { + return array_map([$this, 'update_message_status'], $messages); + } +} diff --git a/sms/classes/manager.php b/sms/classes/manager.php new file mode 100644 index 00000000000..35eb4b39479 --- /dev/null +++ b/sms/classes/manager.php @@ -0,0 +1,318 @@ +. + +namespace core_sms; + +use Generator; + +/** + * SMS manager. + * + * @package core_sms + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class manager { + /** @var int The maximum length of a message */ + const MESSAGE_LENGTH_LIMIT = 160 * 3; + + /** + * Create a new SMS manager. + * + * @param \moodle_database $db + */ + public function __construct( + /** @var \moodle_database The database instance */ + protected readonly \moodle_database $db, + ) { + } + + /** + * Send an SMS to the given recipient. + * + * @param string $recipientnumber The phone number to send the SMS to + * @param string $content The SMS Content + * @param string $component The owning component + * @param string $messagetype The message type within the component + * @param null|int $recipientuserid The user id of the recipient if one exists + * @param bool $issensitive Whether this SMS contains sensitive information + * @param bool $async Whether this SMS should be sent asynchronously. Note: sensitive messages cannot be sent async + * @return message + * @throws \coding_exception If a sensitive message is sent asynchronously + */ + public function send( + string $recipientnumber, + string $content, + string $component, + string $messagetype, + ?int $recipientuserid, + bool $issensitive = false, + bool $async = true, + ): message { + $message = new message( + recipientnumber: $recipientnumber, + content: $content, + component: $component, + messagetype: $messagetype, + recipientuserid: $recipientuserid, + issensitive: $issensitive, + ); + + if ($issensitive && $async) { + throw new \coding_exception('Sensitive messages cannot be sent asynchronously'); + } + + if ($async) { + // TODO See MDL-81015 for further information. + throw new \coding_exception('Asynchronous sending is not yet implemented'); + } + + if (\core_text::strlen($content) > self::MESSAGE_LENGTH_LIMIT) { + $message = $message->with(status: message_status::MESSAGE_OVER_SIZE); + } else if ($gateway = $this->get_gateway_for_message($message)) { + $message = $message->with(gatewayid: $gateway->id); + $message = $gateway->send( + message: $message, + ); + } else { + $message = $message->with(status: message_status::GATEWAY_NOT_AVAILABLE); + } + + return $this->save_message($message); + } + + /** + * Get the gateways that can send the given message. + * + * @param message $message + * @return gateway[] + */ + public function get_possible_gateways_for_message( + message $message, + ): array { + $gateways = []; + foreach ($this->get_enabled_gateway_instances() as $gateway) { + if ($gateway->get_send_priority($message)) { + $gateways[] = $gateway; + } + } + + return $gateways; + } + + /** + * Get the gateway that can send the given message. + * + * @param message $message + * @return null|gateway + */ + public function get_gateway_for_message( + message $message, + ): ?gateway { + $gateways = $this->get_possible_gateways_for_message($message); + if (!count($gateways)) { + return null; + } + + // Sort the gateways by their send priority for this message. + usort($gateways, fn($a, $b) => $a->get_send_priority($message) <=> $b->get_send_priority($message)); + + return array_pop($gateways); + } + + /** + * Get a list of all gateway instances. + * + * @param null|array $filter The database filter to apply + * @return array + */ + public function get_gateway_instances(?array $filter = null): array { + return array_filter( + array_map( + function ($record): ?gateway { + if (!class_exists($record->gateway)) { + debugging( + "Unable to find a gateway class for {$record->gateway}", + DEBUG_DEVELOPER, + ); + return null; + } + + return new $record->gateway( + id: $record->id, + enabled: $record->enabled, + config: $record->config, + ); + }, + $this->get_gateway_records($filter), + ) + ); + } + + /** + * Get a list of all enabled gateway instances. + * + * @return array + */ + public function get_enabled_gateway_instances(): array { + return $this->get_gateway_instances(['enabled' => 1]); + } + + /** + * Save the message to the database. + * + * @param message $message + * @return message + */ + public function save_message( + message $message, + ): message { + if ($message->issensitive) { + // Sensitive messages should not store content. + $message = $message->with(content: null); + } + if ($message->id) { + $this->db->update_record('sms_messages', $message->to_record()); + return $message; + } + $id = $this->db->insert_record('sms_messages', $message->to_record()); + + return $message->with(id: $id); + } + + /** + * Enable a gateway. + * + * @param gateway $gateway + * @return gateway + */ + public function enable_gateway(gateway $gateway): gateway { + if (!$gateway->enabled) { + $gateway = $gateway->with(enabled: true); + $this->db->update_record('sms_gateways', $gateway->to_record()); + } + + return $gateway; + } + + /** + * Disable a gateway. + * + * @param gateway $gateway + * @return gateway + */ + public function disable_gateway(gateway $gateway): gateway { + if ($gateway->enabled) { + $gateway = $gateway->with(enabled: false); + $this->db->update_record('sms_gateways', $gateway->to_record()); + } + + return $gateway; + } + + /** + * Create a new gateway instance. + * + * @param string $classname + * @param bool $enabled + * @param ?\stdClass $config + * @return gateway + */ + public function create_gateway_instance( + string $classname, + bool $enabled = false, + ?\stdClass $config = null, + ): gateway { + if (!class_exists($classname) || !is_a($classname, gateway::class, true)) { + throw new \coding_exception("Gateway class not valid: {$classname}"); + } + $gateway = new $classname( + enabled: $enabled, + config: $config ? json_encode($config) : '', + ); + + $id = $this->db->insert_record('sms_gateways', $gateway->to_record()); + + return $gateway->with(id: $id); + } + + /** + * Get all messages. + * + * @param string $sort + * @param null|array $filter + * @param int $pagesize + * @param int $page + * @return Generator + */ + public function get_messages( + string $sort = 'timecreated ASC', + ?array $filter = null, + int $pagesize = 0, + int $page = 0, + ): Generator { + $rows = $this->db->get_records( + table: 'sms_messages', + conditions: $filter, + limitfrom: $pagesize * $page, + limitnum: $pagesize, + sort: $sort, + ); + + foreach ($rows as $record) { + yield new message( + id: $record->id, + recipientnumber: $record->recipientnumber, + content: $record->content, + component: $record->component, + messagetype: $record->messagetype, + recipientuserid: $record->recipientuserid, + issensitive: $record->issensitive, + status: message_status::from($record->status), + gatewayid: $record->gatewayid, + timecreated: $record->timecreated, + ); + } + } + + /** + * Get a message + * + * @param array $filter + * @return message + */ + public function get_message( + array $filter, + ): message { + $record = $this->db->get_record( + table: 'sms_messages', + conditions: $filter, + ); + + return new message( + id: $record->id, + recipientnumber: $record->recipientnumber, + content: $record->content, + component: $record->component, + messagetype: $record->messagetype, + recipientuserid: $record->recipientuserid, + issensitive: $record->issensitive, + status: message_status::from($record->status), + gatewayid: $record->gatewayid, + timecreated: $record->timecreated, + ); + } +} diff --git a/sms/classes/message.php b/sms/classes/message.php new file mode 100644 index 00000000000..42092f3dc0a --- /dev/null +++ b/sms/classes/message.php @@ -0,0 +1,165 @@ +. + +namespace core_sms; + +use libphonenumber\NumberParseException; +use Spatie\Cloneable\Cloneable; +use ValueError; + +/** + * A Message used in an SMS. + * + * Note: This class is immutable. All properties are readonly. + * The class itself will likely become readonly when PHP 8.2 is the minimum requirement. + * + * @package core_sms + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @property-read int $timecreated The time that the message was created + * @property-read string $recipientnumber The recipient of the message + * @property-read null|string $content The content of the message + * @property-read string $component The component that owns the message + * @property-read string $messagetype The type of message within the component + * @property-read int|null $recipientuserid The user id of the recipient if one exists + * @property-read bool $issensitive Whether this message contains sensitive information + * @property-read int|null $id The id of the message in the database + * @property-read message_status $status The status of the message + * @property-read int|null $gatewayid The id of the gateway that sent the message + */ +class message { + use Cloneable { + with as private _with; + } + + /** @var int The time that the message was created */ + public readonly int $timecreated; + + /** + * Create a new message. + * + * @param string $recipientnumber The phone number of the message recipient + * @param null|string $content The content of the message + * @param string $component The component that owns the message + * @param string $messagetype The type of message within the component + * @param int|null $recipientuserid The user id of the recipient if one exists + * @param bool $issensitive Whether this message contains sensitive information + * @param int|null $id The id of the message in the database + * @param message_status $status The status of the message + * @param int|null $gatewayid The id of the gateway that sent the message + * @param int|null $timecreated The time that the message was created + */ + public function __construct( + /** @var string The phone number of the message recipient */ + public readonly string $recipientnumber, + /** @var null|string The content of the message */ + public readonly ?string $content, + /** @var string The component that owns the message */ + public readonly string $component, + /** @var string The type of message within the component */ + public readonly string $messagetype, + /** @var int|null The user id of the recipient if one exists */ + public readonly ?int $recipientuserid, + /** @var bool Whether this message contains sensitive information */ + public readonly bool $issensitive, + /** @var null|int The id of the message in the database */ + public readonly ?int $id = null, + /** @var message_status The status of the message */ + public readonly message_status $status = message_status::UNKNOWN, + /** @var null|int The id of the gateway that sent the message */ + public readonly ?int $gatewayid = null, + ?int $timecreated = null, + ) { + if ($timecreated === null) { + $this->timecreated = \core\di::get(\core\clock::class)->now()->getTimestamp(); + } else { + $this->timecreated = $timecreated; + } + } + + /** + * Convert the message to a record. + * + * @return \stdClass + */ + public function to_record(): \stdClass { + $record = (object) [ + 'recipientnumber' => $this->recipientnumber, + 'content' => $this->content, + 'component' => $this->component, + 'messagetype' => $this->messagetype, + 'recipientuserid' => $this->recipientuserid, + 'issensitive' => $this->issensitive, + 'status' => $this->status->value, + 'gatewayid' => $this->gatewayid, + 'timecreated' => $this->timecreated, + ]; + + if ($this->id !== null) { + $record->id = $this->id; + } + + return $record; + } + + /** + * Update the message properties. + * + * Note: The message is immutable. + * When setting the status a new object will be returned. + * + * @param mixed ...$args + * @return message + */ + public function with(...$args): self { + if (isset($this->id) && array_key_exists('id', $args)) { + throw new \coding_exception('Message already has an id'); + } + + return $this->_with(...$args); + } + + /** + * Get the region code for this messages. + * + * @return null|string + */ + public function get_region(): ?string { + $pnu = \core\di::get(\libphonenumber\PhoneNumberUtil::class); + try { + $recipient = $pnu->parse($this->recipientnumber); + } catch (NumberParseException $e) { + // Note: Throw errors which are not specific to libphonenumber here. + // This is to avoid hard-trying use of this library. + throw new ValueError( + new \lang_string('phonenumbernotvalid', 'sms', ['message' => $e->getMessage()]), + $e->getCode(), + $e, + ); + } + + return $pnu->getRegionCodeForNumber($recipient); + } + + /** + * Check if the message has been sent. + * + * @return bool + */ + public function is_sent(): bool { + return $this->status->is_sent(); + } +} diff --git a/sms/classes/message_status.php b/sms/classes/message_status.php new file mode 100644 index 00000000000..5e014994081 --- /dev/null +++ b/sms/classes/message_status.php @@ -0,0 +1,95 @@ +. + +namespace core_sms; + +use core\attribute_helper; + +/** + * The general status of a message. Gateways are able to provide more specific statuses to supplement these. + * + * @package core + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +enum message_status: string { + #[description('status:unknown', 'core_sms')] + #[status()] + case UNKNOWN = 'unknown'; + + #[description('status:message_over_size', 'core_sms')] + #[status(failed: true)] + case MESSAGE_OVER_SIZE = 'message_over_size'; + + #[description('status:gateway_not_available', 'core_sms')] + #[status(failed: true)] + case GATEWAY_NOT_AVAILABLE = 'gateway_not_available'; + + #[description('status:gateway_queued', 'core_sms')] + #[status(inprogress: true)] + case GATEWAY_QUEUED = 'gateway_queued'; + + #[description('status:gateway_sent', 'core_sms')] + #[status(sent: true)] + case GATEWAY_SENT = 'gateway_sent'; + + #[description('status:gateway_rejected', 'core_sms')] + #[status(failed: true)] + case GATEWAY_REJECTED = 'gateway_rejected'; + + #[description('status:gateway_failed', 'core_sms')] + #[status(failed: true)] + case GATEWAY_FAILED = 'gateway_failed'; + + /** + * Whether the message is in a state marked as sent. + * + * @return bool + */ + public function is_sent(): bool { + $status = attribute_helper::instance($this, status::class); + return $status?->sent ?? false; + } + + /** + * Whether the message is in a state marked as failed. + * + * @return bool + */ + public function is_failed(): bool { + $status = attribute_helper::instance($this, status::class); + return $status?->failed ?? false; + } + + /** + * Whether the message is in an in-progress state. + * + * @return bool + */ + public function is_in_progress(): bool { + $status = attribute_helper::instance($this, status::class); + return $status?->inprogress ?? false; + } + + /** + * Get the human-readable status of the message. + * + * @return null|\lang_string + */ + public function description(): ?\lang_string { + return attribute_helper::instance($this, description::class); + } +} diff --git a/sms/classes/privacy/provider.php b/sms/classes/privacy/provider.php new file mode 100644 index 00000000000..c9093c9f653 --- /dev/null +++ b/sms/classes/privacy/provider.php @@ -0,0 +1,154 @@ +. + +namespace core_sms\privacy; + +use core_privacy\local\metadata\collection; +use core_privacy\local\request\approved_userlist; +use core_privacy\local\request\userlist; + +/** + * Class provider + * + * @package core_sms + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class provider implements + \core_privacy\local\request\core_userlist_provider, + \core_privacy\local\metadata\provider, + \core_privacy\local\request\subsystem\provider { + #[\Override] + public static function get_metadata( + collection $collection, + ): collection { + $collection->add_database_table( + 'sms_messages', + [ + 'id' => 'privacy:metadata:sms_messages:id', + 'recipient' => 'privacy:metadata:sms_messages:recipient', + 'recipientuserid' => 'privacy:metadata:sms_messages:recipientuserid', + 'content' => 'privacy:metadata:sms_messages:content', + 'status' => 'privacy:metadata:sms_messages:status', + 'timecreated' => 'privacy:metadata:sms_messages:timecreated', + + ], + 'privacy:metadata:sms_messages' + ); + return $collection; + } + + #[\Override] + public static function get_contexts_for_userid( + int $userid, + ): \core_privacy\local\request\contextlist { + $contextlist = new \core_privacy\local\request\contextlist(); + $contextlist->add_from_sql( + << $userid, + 'contextlevel' => CONTEXT_USER, + ] + ); + + return $contextlist; + } + + #[\Override] + public static function export_user_data( + \core_privacy\local\request\approved_contextlist $contextlist, + ) { + global $DB; + + foreach ($contextlist as $context) { + // All data is against the recipientuserid and stored in a user context. + if (!$context instanceof \core\context\user) { + return; + } + $messages = array_map( + function ($data) { + return [ + 'recipient' => $data->recipientnumber, + 'content' => $data->issensitive ? + get_string('privacy:sms:sensitive_not_shown', 'core_sms') : $data->content, + 'messagetype' => $data->messagetype, + 'status' => $data->status, + 'timecreated' => $data->timecreated, + ]; + }, + $DB->get_records( + table: 'sms_messages', + conditions: [ + 'recipientuserid' => $context->instanceid, + ], + ), + ); + + if (!empty($messages)) { + \core_privacy\local\request\writer::with_context($context)->export_data( + [ + get_string('sms', 'core_sms'), + ], + (object) [ + 'messages' => $messages, + ], + ); + } + } + } + + #[\Override] + public static function delete_data_for_all_users_in_context(\context $context) { + global $DB; + + if (!$context instanceof \core\context\user) { + return; + } + $DB->delete_records('sms_messages', ['recipientuserid' => $context->instanceid]); + } + + #[\Override] + public static function delete_data_for_user(\core_privacy\local\request\approved_contextlist $contextlist) { + foreach ($contextlist as $context) { + self::delete_data_for_all_users_in_context($context); + } + } + + #[\Override] + public static function get_users_in_context(userlist $userlist) { + $context = $userlist->get_context(); + if ($context instanceof \core\context\user) { + $userlist->add_user($context->instanceid); + } + } + + #[\Override] + public static function delete_data_for_users(approved_userlist $userlist) { + $context = $userlist->get_context(); + + if (!$context instanceof \core\context\user) { + return; + } + + self::delete_data_for_all_users_in_context($context); + } +} diff --git a/sms/classes/status.php b/sms/classes/status.php new file mode 100644 index 00000000000..abc41519ea1 --- /dev/null +++ b/sms/classes/status.php @@ -0,0 +1,51 @@ +. + +namespace core_sms; + +/** + * Message status categorisation. + * + * Statuses in the message_status class provide a human-readable machine description of the status. + * + * Each message status can further be categorised with attributes such as: + * - sent + * - failed + * - inprogress + * + * @package core_sms + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +#[\Attribute] +class status { + /** + * Message status categorisation. + * + * @param bool $sent + * @param bool $failed + * @param bool $inprogress + */ + public function __construct( + /** @var bool Whether the message was sent successfully */ + public readonly bool $sent = false, + /** @var bool Whether the message is in a failed state */ + public readonly bool $failed = false, + /** @var bool Whether the message is in-progress */ + public readonly bool $inprogress = false, + ) { + } +} diff --git a/sms/gateway/.placeholder b/sms/gateway/.placeholder new file mode 100644 index 00000000000..ac40f078387 --- /dev/null +++ b/sms/gateway/.placeholder @@ -0,0 +1 @@ +This file should be removed when a gateway is added to core. diff --git a/sms/tests/fixtures/dummy_gateway.php b/sms/tests/fixtures/dummy_gateway.php new file mode 100644 index 00000000000..8cd43971595 --- /dev/null +++ b/sms/tests/fixtures/dummy_gateway.php @@ -0,0 +1,56 @@ +. + +namespace smsgateway_dummy; + +use core_sms\message; + +/** + * Dummy SMS gateway. + * + * @package core_sms + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class gateway extends \core_sms\gateway { + #[\Override] + public function send(message $message): message { + return $message->with( + status: \core_sms\message_status::GATEWAY_SENT, + ); + } + + #[\Override] + public function get_send_priority(message $message): int { + if (!$this->config) { + return 50; + } + + // Check if the recipient number starts with a specific prefix. + if (property_exists($this->config, 'startswith')) { + $startswith = substr($message->recipientnumber, 0, 3); + if (property_exists($this->config->startswith, $startswith)) { + return (int) $this->config->startswith->$startswith; + } + } + + if (property_exists($this->config, 'priority')) { + return (int) $this->config->priority; + } + + return 0; + } +} diff --git a/sms/tests/gateway_test.php b/sms/tests/gateway_test.php new file mode 100644 index 00000000000..a22665b9937 --- /dev/null +++ b/sms/tests/gateway_test.php @@ -0,0 +1,69 @@ +. + +namespace core_sms; + +/** + * Tests for sms gateway. + * + * @package core_sms + * @category test + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_sms\gateway + */ +final class gateway_test extends \advanced_testcase { + public static function setUpBeforeClass(): void { + require_once(__DIR__ . "/fixtures/dummy_gateway.php"); + parent::setUpBeforeClass(); + } + + public function test_update_message_status(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + $gw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); + $othergw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); + + $message = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + gatewayid: $gw->id, + ); + $message2 = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + gatewayid: $gw->id, + ); + + $updatedmessage = $gw->update_message_status($message); + $this->assertEquals($message, $updatedmessage); + + $updatedmessages = $gw->update_message_statuses([$message, $message2]); + $this->assertEquals([$message, $message2], $updatedmessages); + + $this->expectException(\coding_exception::class); + $othergw->update_message_status($message); + } +} diff --git a/sms/tests/manager_test.php b/sms/tests/manager_test.php new file mode 100644 index 00000000000..87aa87ca452 --- /dev/null +++ b/sms/tests/manager_test.php @@ -0,0 +1,458 @@ +. + +namespace core_sms; + +/** + * Tests for sms manager + * + * @package core_sms + * @category test + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_sms\manager + * @covers \core_sms\message + * @covers \core_sms\gateway + */ +final class manager_test extends \advanced_testcase { + public static function setUpBeforeClass(): void { + require_once(__DIR__ . "/fixtures/dummy_gateway.php"); + parent::setUpBeforeClass(); + } + + public function test_gateway_manipulation(): void { + $this->resetAfterTest(); + + $dummy = $this->getMockBuilder(\core_sms\gateway::class) + ->setConstructorArgs([ + 'enabled' => true, + 'config' => '', + ]) + ->onlyMethods(['get_send_priority', 'send']) + ->getMock(); + $dummygw = get_class($dummy); + + $manager = \core\di::get(\core_sms\manager::class); + $gateway = $manager->create_gateway_instance( + classname: $dummygw, + config: (object) [ + 'data' => 'goeshere', + ], + enabled: true, + ); + + $this->assertIsInt($gateway->id); + $this->assertTrue($gateway->enabled); + $this->assertEquals('goeshere', $gateway->config->data); + + // Disable the gateway. + $disabled = $manager->disable_gateway($gateway); + $this->assertFalse($disabled->enabled); + $this->assertEquals($gateway->id, $disabled->id); + $this->assertEquals($gateway->config, $disabled->config); + $this->assertTrue($gateway->enabled); + + // Enable the gateway. + $enabled = $manager->enable_gateway($disabled); + $this->assertTrue($enabled->enabled); + $this->assertEquals($disabled->id, $enabled->id); + $this->assertEquals($gateway->config, $enabled->config); + $this->assertFalse($disabled->enabled); + + // Enabling an enabled gateway should return an identical object. + // Note: Whether the object is identical is not guaranteed, and is internal logic we should not be concerned with. + $reenabled = $manager->enable_gateway($enabled); + $this->assertEquals($enabled, $reenabled); + } + + public function test_create_gateway_instance_unknown_class(): void { + $manager = \core\di::get(\core_sms\manager::class); + + $this->expectException(\coding_exception::class); + $manager->create_gateway_instance( + classname: \no\class\name\here::class, + config: (object) [ + 'data' => 'goeshere', + ], + enabled: true, + ); + } + + public function test_create_gateway_instance_valid_but_wrong_class(): void { + $manager = \core\di::get(\core_sms\manager::class); + + $this->expectException(\coding_exception::class); + $manager->create_gateway_instance( + classname: self::class, + config: (object) [ + 'data' => 'goeshere', + ], + enabled: true, + ); + } + + /** + * Test that uninstalled gateways do not cause failures in the workflow. + */ + public function test_uninstalled_gateway(): void { + // We should prevent removal of gateways which hold any data, but if one has been removed, we should not fail. + $this->resetAfterTest(); + + $dummy = $this->getMockBuilder(\core_sms\gateway::class) + ->setConstructorArgs([ + 'enabled' => true, + 'config' => '', + ]) + ->onlyMethods(['get_send_priority', 'send']) + ->getMock(); + $dummygw = get_class($dummy); + + $manager = \core\di::get(\core_sms\manager::class); + $gateway = $manager->create_gateway_instance( + classname: $dummygw, + config: (object) [ + 'data' => 'goeshere', + ], + enabled: true, + ); + $uninstalledgateway = $manager->create_gateway_instance( + classname: $dummygw, + config: (object) [ + 'data' => 'goeshere', + ], + enabled: true, + ); + + $db = \core\di::get(\moodle_database::class); + $db->set_field('sms_gateways', 'gateway', 'uninstalled', ['id' => $uninstalledgateway->id]); + + $instances = $manager->get_gateway_instances(); + $this->assertDebuggingCalled(); + $this->assertCount(1, $instances); + $this->assertArrayHasKey($gateway->id, $instances); + $this->assertArrayNotHasKey($uninstalledgateway->id, $instances); + } + + /** + * Test that multiple instances of the same gateway can be created. + */ + public function test_multiple_gateway_instances(): void { + $this->resetAfterTest(); + + $dummy = $this->getMockBuilder(\core_sms\gateway::class) + ->setConstructorArgs([ + 'enabled' => true, + 'config' => '', + ]) + ->onlyMethods(['get_send_priority', 'send']) + ->setMockClassName('dummygateway') + ->getMock(); + $dummygw = get_class($dummy); + $otherdummy = $this->getMockBuilder(\core_sms\gateway::class) + ->setConstructorArgs([ + 'enabled' => true, + 'config' => '', + ]) + ->onlyMethods(['get_send_priority', 'send']) + ->setMockClassName('otherdummygw') + ->getMock(); + $otherdummygw = get_class($otherdummy); + + $manager = \core\di::get(\core_sms\manager::class); + $gatewaya = $manager->create_gateway_instance( + classname: $dummygw, + enabled: true, + ); + $gatewayb = $manager->create_gateway_instance( + classname: $otherdummygw, + enabled: true, + ); + $gatewayc = $manager->create_gateway_instance( + classname: $dummygw, + enabled: false, + ); + + $this->assertNotEquals($gatewaya->id, $gatewayb->id); + $this->assertNotEquals($gatewaya->id, $gatewayc->id); + $this->assertNotEquals($gatewayb->id, $gatewayc->id); + + $instances = $manager->get_gateway_instances(); + $this->assertCount(3, $instances); + $this->assertArrayHasKey($gatewaya->id, $instances); + $this->assertArrayHasKey($gatewayb->id, $instances); + $this->assertArrayHasKey($gatewayc->id, $instances); + + $enabled = $manager->get_enabled_gateway_instances(); + $this->assertCount(2, $enabled); + $this->assertArrayHasKey($gatewaya->id, $enabled); + $this->assertArrayHasKey($gatewayb->id, $enabled); + $this->assertArrayNotHasKey($gatewayc->id, $enabled); + + $dummygwinstances = $manager->get_gateway_instances(['gateway' => $dummygw]); + $this->assertCount(2, $dummygwinstances); + $this->assertArrayHasKey($gatewaya->id, $dummygwinstances); + $this->assertArrayNotHasKey($gatewayb->id, $dummygwinstances); + $this->assertArrayHasKey($gatewayc->id, $dummygwinstances); + } + + /** + * Test that the manager can get gateways for a message. + * + * @dataProvider gateway_priority_provider + * @param string $recipientnumber + * @param int $matchcount + * @param ?string $gw + */ + public function test_get_gateways_for_message( + string $recipientnumber, + int $matchcount, + ?string $gw, + ): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + $ukgw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true, (object) [ + 'startswith' => (object) [ + '+44' => 100, + '+61' => 1, + ], + 'priority' => 0, + ]); + $augw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true, (object) [ + 'startswith' => (object) [ + '+44' => 1, + '+61' => 100, + ], + 'priority' => 0, + ]); + + $message = new message( + recipientnumber: $recipientnumber, + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + ); + + $gateways = $manager->get_possible_gateways_for_message($message); + $this->assertCount($matchcount, $gateways); + + $preferredgw = $manager->get_gateway_for_message($message); + if ($gw === null) { + $this->assertNull($preferredgw); + $this->assertFalse($ukgw->can_send($message)); + $this->assertFalse($augw->can_send($message)); + } else { + $this->assertEquals(${$gw}->id, $preferredgw->id); + $this->assertTrue(${$gw}->can_send($message)); + } + } + + /** + * Data provider for test_get_gateways_for_message tests. + * + * @return array + */ + public static function gateway_priority_provider(): array { + return [ + 'uk' => [ + '+447123456789', + 2, + 'ukgw', + ], + 'au' => [ + '+61987654321', + 2, + 'augw', + ], + 'us' => [ + '+1987654321', + 0, + null, + ], + ]; + } + + public function test_save_message(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + $message = new message( + recipientnumber: '+447123456789', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + ); + + $saved = $manager->save_message($message); + + $this->assertFalse(isset($message->id)); + $this->assertTrue(isset($saved->id)); + + $storedmessage = $manager->get_message(['id' => $saved->id]); + $this->assertEquals($saved, $storedmessage); + + $updatedmessage = $manager->save_message($saved->with(status: message_status::GATEWAY_SENT)); + $this->assertEquals($saved->id, $updatedmessage->id); + $this->assertEquals(message_status::GATEWAY_SENT, $updatedmessage->status); + $this->assertEquals($saved->recipientnumber, $updatedmessage->recipientnumber); + $this->assertEquals($saved->content, $updatedmessage->content); + $this->assertEquals($saved->component, $updatedmessage->component); + $this->assertEquals($saved->messagetype, $updatedmessage->messagetype); + $this->assertEquals($saved->recipientuserid, $updatedmessage->recipientuserid); + $this->assertEquals($saved->issensitive, $updatedmessage->issensitive); + } + + public function test_send(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + $gw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); + + $message = $manager->send( + recipientnumber: '+447123456789', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + async: false, + ); + + $this->assertInstanceOf(message::class, $message); + + $this->assertIsInt($message->id); + $this->assertEquals(message_status::GATEWAY_SENT, $message->status); + $this->assertEquals($gw->id, $message->gatewayid); + + $this->assertEquals('Hello, world!', $message->content); + + $storedmessage = $manager->get_message(['id' => $message->id]); + $this->assertEquals($message, $storedmessage); + } + + public function test_send_issensitive(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + $gw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); + + $message = $manager->send( + recipientnumber: '+447123456789', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: true, + async: false, + ); + + $this->assertInstanceOf(message::class, $message); + + $this->assertIsInt($message->id); + $this->assertEquals(message_status::GATEWAY_SENT, $message->status); + $this->assertEquals($gw->id, $message->gatewayid); + $this->assertNull($message->content); + + $storedmessage = $manager->get_message(['id' => $message->id]); + $this->assertEquals($message, $storedmessage); + } + + public function test_send_issensitive_async(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + + $this->expectException(\coding_exception::class); + $this->getExpectedExceptionMessage('Sensitive messages cannot be sent asynchronously'); + $manager->send( + recipientnumber: '+447123456789', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: true, + async: true, + ); + } + + public function test_async_not_supported_yet(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + + $this->expectException(\coding_exception::class); + $this->getExpectedExceptionMessage('Asynchronous sending is not yet implemented'); + $manager->send( + recipientnumber: '+447123456789', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + async: true, + ); + } + + public function test_send_no_gateway(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + + $message = $manager->send( + recipientnumber: '+447123456789', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + async: false, + ); + + $this->assertInstanceOf(message::class, $message); + + $this->assertIsInt($message->id); + $this->assertEquals(message_status::GATEWAY_NOT_AVAILABLE, $message->status); + $this->assertEmpty($message->gatewayid); + } + + public function test_get_messages(): void { + $db = $this->createStub(\moodle_database::class); + $db->method('get_records')->willReturn([ + (object) [ + 'id' => 1, + 'recipientnumber' => '+447123456789', + 'content' => 'Hello, world!', + 'component' => 'core', + 'messagetype' => 'test', + 'recipientuserid' => null, + 'issensitive' => false, + 'status' => message_status::GATEWAY_SENT->value, + 'gatewayid' => 1, + 'timecreated' => time(), + ], + ]); + \core\di::set(\moodle_database::class, $db); + + $manager = \core\di::get(\core_sms\manager::class); + $result = $manager->get_messages(); + $this->assertInstanceOf(\Generator::class, $result); + + $messages = iterator_to_array($result); + $this->assertCount(1, $messages); + array_walk($messages, fn ($message) => $this->assertInstanceOf(message::class, $message)); + } +} diff --git a/sms/tests/message_status_test.php b/sms/tests/message_status_test.php new file mode 100644 index 00000000000..d9641be2080 --- /dev/null +++ b/sms/tests/message_status_test.php @@ -0,0 +1,57 @@ +. + +namespace core_sms; + + +/** + * Tests for sms + * + * @package core_sms + * @category test + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_sms\message_status + * @covers \core_sms\status + */ +final class message_status_test extends \advanced_testcase { + public function test_meta_status(): void { + $sent = [ + message_status::GATEWAY_SENT, + ]; + $failed = [ + message_status::MESSAGE_OVER_SIZE, + message_status::GATEWAY_FAILED, + message_status::GATEWAY_NOT_AVAILABLE, + message_status::GATEWAY_REJECTED, + ]; + $inprogress = [ + message_status::GATEWAY_QUEUED, + ]; + + foreach (message_status::cases() as $case) { + $this->assertEquals(in_array($case, $sent), $case->is_sent()); + $this->assertEquals(in_array($case, $failed), $case->is_failed()); + $this->assertEquals(in_array($case, $inprogress), $case->is_in_progress()); + } + } + + public function test_description(): void { + foreach (message_status::cases() as $case) { + $this->assertInstanceOf(\lang_string::class, $case->description()); + } + } +} diff --git a/sms/tests/message_test.php b/sms/tests/message_test.php new file mode 100644 index 00000000000..4fe7bf9014b --- /dev/null +++ b/sms/tests/message_test.php @@ -0,0 +1,146 @@ +. + +namespace core_sms; + +use ValueError; + +/** + * Tests for SMS Messages. + * + * @package core_sms + * @category test + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_sms\message + */ +final class message_test extends \advanced_testcase { + public function test_create(): void { + $message = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + ); + + $this->assertInstanceOf(message::class, $message); + $this->assertFalse($message->is_sent()); + } + + public function test_timecreated(): void { + $clock = $this->mock_clock_with_incrementing(55555); + + $timecreated = 12345; + $message = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + timecreated: $timecreated, + ); + + $this->assertEquals($timecreated, $message->timecreated); + + $starttime = $clock->now(); + $message = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + ); + + $this->assertGreaterThan($starttime->getTimestamp(), $message->timecreated); + $this->assertLessThan($clock->now()->getTimestamp(), $message->timecreated); + } + + public function test_id_not_updatable(): void { + $message = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + ); + + $this->assertFalse(isset($message->id)); + + $message = $message->with(id: 123); + $this->assertEquals(123, $message->id); + + $this->expectException(\coding_exception::class); + $message->with(id: 987); + } + + public function test_get_region_invalid(): void { + $message = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + ); + + $this->expectException(ValueError::class); + $message->get_region(); + } + + /** + * Test that get_region returns regions with valid numbers. + * + * @dataProvider get_region_provider + * @param string $recipientnumber + * @param string $expectedregion + */ + public function test_get_region_valid( + string $recipientnumber, + string $expectedregion, + ): void { + $message = new message( + recipientnumber: $recipientnumber, + content: 'Hello, world!', + component: 'core', + messagetype: 'test', + recipientuserid: null, + issensitive: false, + ); + + $this->assertEquals($expectedregion, $message->get_region()); + } + + /** + * Data provider for test_get_region_valid. + * + * @return array + */ + public static function get_region_provider(): array { + return [ + // Authorised fictional numbers only. + // Australia: https://www.acma.gov.au/phone-numbers-use-tv-shows-films-and-creative-works. + ['+61491570006', 'AU'], + + // UK: https://www.ofcom.org.uk/phones-telecoms-and-internet/information-for-industry/numbering/numbers-for-drama. + ['+447400123456', 'GB'], + ]; + } +} diff --git a/sms/tests/privacy/provider_test.php b/sms/tests/privacy/provider_test.php new file mode 100644 index 00000000000..c8c1f446453 --- /dev/null +++ b/sms/tests/privacy/provider_test.php @@ -0,0 +1,463 @@ +. + +namespace core_sms\privacy; + +use core_privacy\local\metadata\collection; +use core_privacy\local\request\approved_contextlist; +use core_privacy\local\request\approved_userlist; +use core_privacy\local\request\contextlist; +use core_privacy\local\request\userlist; +use core_privacy\local\request\writer; +use core_sms\manager; + +/** + * Tests for sms + * + * @package core_sms + * @category test + * @copyright 2024 Andrew Lyons + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_sms\privacy\provider + */ +final class provider_test extends \core_privacy\tests\provider_testcase { + public function test_get_metadata(): void { + $collection = new collection('core_sms'); + $newcollection = provider::get_metadata($collection); + + $this->assertCount(1, $newcollection->get_collection()); + $types = $newcollection->get_collection(); + $type = reset($types); + $this->assertEquals('sms_messages', $type->get_name()); + } + + public function test_get_contexts_for_userid_no_messagse(): void { + $user = get_admin(); + $contextlist = provider::get_contexts_for_userid($user->id); + $this->assertInstanceOf(contextlist::class, $contextlist); + + $this->assertCount(0, $contextlist); + } + + public function test_get_contexts_for_userid_with_messages(): void { + $this->resetAfterTest(true); + + $user = get_admin(); + $manager = \core\di::get(manager::class); + $message = $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + + $contextlist = provider::get_contexts_for_userid($user->id); + $this->assertInstanceOf(contextlist::class, $contextlist); + + $this->assertCount(1, $contextlist); + $context = $contextlist->current(); + $this->assertInstanceOf(\core\context\user::class, $context); + $this->assertEquals($user->id, $context->instanceid); + } + + public function test_export_user_data(): void { + global $DB; + + $this->resetAfterTest(true); + $clock = $this->mock_clock_with_frozen(99999); + + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + + $clock->set_to(10000000); + + // Get the data for the User. + $usercontext = \core\context\user::instance($user->id); + /** @var \core_privacy\tests\request\content_writer */ + $writer = writer::with_context($usercontext); + $this->assertFalse($writer->has_any_data_in_any_context()); + + // Export data for the user. + $this->export_all_data_for_user($user->id, 'core_sms'); + $this->assertTrue($writer->has_any_data_in_any_context()); + $data = $writer->get_data([get_string('sms', 'core_sms')]); + $this->assertObjectHasProperty('messages', $data); + $this->assertCount(2, $data->messages); + + $message = reset($data->messages); + $this->assertArrayHasKey('content', $message); + $this->assertEquals('Hello world', $message['content']); + + $this->assertArrayHasKey('messagetype', $message); + $this->assertEquals('example', $message['messagetype']); + + $this->assertArrayHasKey('status', $message); + + $this->assertArrayHasKey('timecreated', $message); + $this->assertEquals(99999, $message['timecreated']); + } + + public function test_export_course_data(): void { + $this->resetAfterTest(true); + $clock = $this->mock_clock_with_frozen(99999); + + $course = $this->getDataGenerator()->create_course(); + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + + $clock->set_to(10000000); + + // Get the data for the User Context. + $usercontext = \core\context\user::instance($user->id); + /** @var \core_privacy\tests\request\content_writer */ + $writer = writer::with_context($usercontext); + $this->assertFalse($writer->has_any_data_in_any_context()); + + // Export data for the Course - there should be none. + $this->export_context_data_for_user($user->id, \core\context\course::instance($course->id), 'core_sms'); + $this->assertFalse($writer->has_any_data_in_any_context()); + } + + public function test_delete_data_for_all_users_in_context(): void { + global $DB; + + $this->resetAfterTest(true); + + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + $this->assertCount(2, $DB->get_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(3, $DB->count_records('sms_messages')); + + // No data is store under the system context. Nothing should be deleted. + provider::delete_data_for_all_users_in_context(\core\context\system::instance()); + $this->assertEquals(3, $DB->count_records('sms_messages')); + + $usercontext = \core\context\user::instance($user->id); + provider::delete_data_for_all_users_in_context($usercontext); + $this->assertEmpty($DB->get_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages')); + } + + public function test_delete_data_for_user(): void { + global $DB; + + $this->resetAfterTest(true); + + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + $this->assertCount(2, $DB->get_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(3, $DB->count_records('sms_messages')); + + $usercontext = \core\context\user::instance($user->id); + provider::delete_data_for_user(new approved_contextlist($user, 'core_sms', [$usercontext->id])); + $this->assertEmpty($DB->get_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages')); + } + + public function test_delete_data_for_users_incorrect_userid(): void { + global $DB; + + $this->resetAfterTest(true); + + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + $this->assertEquals(2, $DB->count_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages', ['recipientuserid' => $otheruser->id])); + $this->assertEquals(3, $DB->count_records('sms_messages')); + + $usercontext = \core\context\user::instance($user->id); + + // Data is all stored under the users own context. + provider::delete_data_for_users(new approved_userlist( + $usercontext, + 'core_sms', + [$otheruser->id] + )); + $this->assertEquals(0, $DB->count_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages', ['recipientuserid' => $otheruser->id])); + $this->assertEquals(1, $DB->count_records('sms_messages')); + } + + public function test_delete_data_for_users_correct_user(): void { + global $DB; + + $this->resetAfterTest(true); + + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + $this->assertEquals(2, $DB->count_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages', ['recipientuserid' => $otheruser->id])); + $this->assertEquals(3, $DB->count_records('sms_messages')); + + $usercontext = \core\context\user::instance($user->id); + + // Deleting data for both users only deletes that user's content. + provider::delete_data_for_users(new approved_userlist( + $usercontext, + 'core_sms', + [$user->id, $otheruser->id], + )); + $this->assertEquals(0, $DB->count_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages', ['recipientuserid' => $otheruser->id])); + $this->assertEquals(1, $DB->count_records('sms_messages')); + } + + public function test_delete_data_for_users_wrong_context(): void { + global $DB; + + $this->resetAfterTest(true); + + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + $this->assertEquals(2, $DB->count_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages', ['recipientuserid' => $otheruser->id])); + $this->assertEquals(3, $DB->count_records('sms_messages')); + + // Incorrect contexts are ignored. + provider::delete_data_for_users(new approved_userlist( + \core\context\system::instance(), + 'core_sms', + [$user->id, $otheruser->id], + )); + + $this->assertEquals(2, $DB->count_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(1, $DB->count_records('sms_messages', ['recipientuserid' => $otheruser->id])); + $this->assertEquals(3, $DB->count_records('sms_messages')); + } + + public function test_get_users_in_context(): void { + global $DB; + + $this->resetAfterTest(true); + + $user = get_admin(); + $otheruser = $this->getDataGenerator()->create_user(); + $manager = \core\di::get(manager::class); + $manager->send( + recipientnumber: '12345', + content: 'Hello world', + component: 'core_sms', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $user->id, + async: false, + ); + $manager->send( + recipientnumber: '12345', + content: 'Hello, world!', + component: 'core_course', + messagetype: 'example', + recipientuserid: $otheruser->id, + async: false, + ); + $this->assertCount(2, $DB->get_records('sms_messages', ['recipientuserid' => $user->id])); + $this->assertEquals(3, $DB->count_records('sms_messages')); + + // Get the users in the user context - should just be the user of that user context. + $userlist = new userlist(\core\context\user::instance($user->id), 'core_sms'); + provider::get_users_in_context($userlist); + $this->assertEquals([$user->id], $userlist->get_userids()); + + // No users in the system context. + $userlist = new userlist(\core\context\system::instance(), 'core_sms'); + provider::get_users_in_context($userlist); + $this->assertEquals([], $userlist->get_userids()); + } +} diff --git a/version.php b/version.php index d55c113ada2..356e531fdc8 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2024092000.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2024092000.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '4.5dev+ (Build: 20240920)'; // Human-friendly version name From a5f100e6dda49bc3c3beba14ff4dc88b3db3a80d Mon Sep 17 00:00:00 2001 From: Safat Date: Wed, 17 Apr 2024 12:50:24 +1000 Subject: [PATCH 04/12] MDL-81924 smsgateway_aws: Add AWS sms gateway plugin Originally implemented as MDL-80961. --- sms/classes/manager.php | 29 ++++++ sms/gateway/.placeholder | 1 - sms/gateway/aws/classes/gateway.php | 71 +++++++++++++++ sms/gateway/aws/classes/helper.php | 28 ++++++ .../local/aws_sms_service_provider.php | 43 +++++++++ .../aws/classes/local/service/aws_sns.php | 90 +++++++++++++++++++ sms/gateway/aws/classes/privacy/provider.php | 35 ++++++++ sms/gateway/aws/lang/en/smsgateway_aws.php | 42 +++++++++ sms/gateway/aws/tests/gateway_test.php | 64 +++++++++++++ sms/gateway/aws/tests/helper_test.php | 79 ++++++++++++++++ sms/gateway/aws/version.php | 30 +++++++ 11 files changed, 511 insertions(+), 1 deletion(-) delete mode 100644 sms/gateway/.placeholder create mode 100644 sms/gateway/aws/classes/gateway.php create mode 100644 sms/gateway/aws/classes/helper.php create mode 100644 sms/gateway/aws/classes/local/aws_sms_service_provider.php create mode 100644 sms/gateway/aws/classes/local/service/aws_sns.php create mode 100644 sms/gateway/aws/classes/privacy/provider.php create mode 100644 sms/gateway/aws/lang/en/smsgateway_aws.php create mode 100644 sms/gateway/aws/tests/gateway_test.php create mode 100644 sms/gateway/aws/tests/helper_test.php create mode 100644 sms/gateway/aws/version.php diff --git a/sms/classes/manager.php b/sms/classes/manager.php index 35eb4b39479..8fae2544d44 100644 --- a/sms/classes/manager.php +++ b/sms/classes/manager.php @@ -315,4 +315,33 @@ class manager { timecreated: $record->timecreated, ); } + + /** + * This function internationalises a number to E.164 standard. + * https://46elks.com/kb/e164 + * + * @param string $phonenumber the phone number to format. + * @param ?string $countrycode The country code of the phone number. + * @return string the formatted phone number. + */ + public static function format_number( + string $phonenumber, + ?string $countrycode = null, + ): string { + // Remove all whitespace, dashes, and brackets in one step. + $phonenumber = preg_replace('/[ ()-]/', '', $phonenumber); + + // Check if the number is already in international format or if it starts with a 0. + if (!str_starts_with($phonenumber, '+')) { + // Strip leading 0. + if (str_starts_with($phonenumber, '0')) { + $phonenumber = substr($phonenumber, 1); + } + + // Prepend country code if not already in international format. + $phonenumber = !empty($countrycode) ? '+' . $countrycode . $phonenumber : $phonenumber; + } + + return $phonenumber; + } } diff --git a/sms/gateway/.placeholder b/sms/gateway/.placeholder deleted file mode 100644 index ac40f078387..00000000000 --- a/sms/gateway/.placeholder +++ /dev/null @@ -1 +0,0 @@ -This file should be removed when a gateway is added to core. diff --git a/sms/gateway/aws/classes/gateway.php b/sms/gateway/aws/classes/gateway.php new file mode 100644 index 00000000000..9bfdbfec077 --- /dev/null +++ b/sms/gateway/aws/classes/gateway.php @@ -0,0 +1,71 @@ +. + +namespace smsgateway_aws; + +use core_sms\manager; +use core_sms\message; +use MoodleQuickForm; + +/** + * AWS SMS gateway. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class gateway extends \core_sms\gateway { + + #[\Override] + public function send( + message $message, + ): message { + global $DB; + // Get the config from the message record. + $awsconfig = $DB->get_field( + table: 'sms_gateways', + return: 'config', + conditions: ['id' => $message->gatewayid, 'enabled' => 1, 'gateway' => 'smsgateway_aws\gateway',], + ); + $status = \core_sms\message_status::GATEWAY_NOT_AVAILABLE; + if ($awsconfig) { + $config = (object)json_decode($awsconfig, true, 512, JSON_THROW_ON_ERROR); + $class = '\smsgateway_aws\local\service\\' . $config->gateway; + $recipientnumber = manager::format_number( + phonenumber: $message->recipientnumber, + countrycode: isset($config->countrycode) ?? null, + ); + + if (class_exists($class)) { + $status = call_user_func( + $class . '::send_sms_message', + $message->content, + $recipientnumber, + $config, + ); + } + } + + return $message->with( + status: $status, + ); + } + + #[\Override] + public function get_send_priority(message $message): int { + return 50; + } +} diff --git a/sms/gateway/aws/classes/helper.php b/sms/gateway/aws/classes/helper.php new file mode 100644 index 00000000000..c90e171c6fc --- /dev/null +++ b/sms/gateway/aws/classes/helper.php @@ -0,0 +1,28 @@ +. + +namespace smsgateway_aws; + +/** + * AWS SMS gateway helpers. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class helper { + +} diff --git a/sms/gateway/aws/classes/local/aws_sms_service_provider.php b/sms/gateway/aws/classes/local/aws_sms_service_provider.php new file mode 100644 index 00000000000..39e4fec3a15 --- /dev/null +++ b/sms/gateway/aws/classes/local/aws_sms_service_provider.php @@ -0,0 +1,43 @@ +. + +namespace smsgateway_aws\local; + +use core_sms\message_status; +use stdClass; + +/** + * AWS SMS service provider interface to provide a standard interface for different aws service providers like sns, sqs etc. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +interface aws_sms_service_provider { + + /** + * Sends an SMS message using the selected aws service provider. + * + * @param string $messagecontent the content to send in the SMS message. + * @param string $phonenumber the destination for the message. + * @return message_status Status of the message. + */ + public static function send_sms_message( + string $messagecontent, + string $phonenumber, + stdclass $config, + ): message_status; +} diff --git a/sms/gateway/aws/classes/local/service/aws_sns.php b/sms/gateway/aws/classes/local/service/aws_sns.php new file mode 100644 index 00000000000..c4767f5b595 --- /dev/null +++ b/sms/gateway/aws/classes/local/service/aws_sns.php @@ -0,0 +1,90 @@ +. + +namespace smsgateway_aws\local\service; + +use core\aws\aws_helper; +use core_sms\message_status; +use smsgateway_aws\local\aws_sms_service_provider; +use stdClass; + +/** + * AWS SNS service provider. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class aws_sns implements aws_sms_service_provider { + + /** + * Include the required calls. + */ + private static function require(): void { + global $CFG; + require_once($CFG->libdir . '/aws-sdk/src/functions.php'); + } + + #[\Override] + public static function send_sms_message( + string $messagecontent, + string $phonenumber, + stdclass $config, + ): message_status { + global $SITE; + self::require(); + + // Setup client params and instantiate client. + $params = [ + 'version' => 'latest', + 'region' => $config->api_region, + 'http' => ['proxy' => aws_helper::get_proxy_string()], + ]; + if (!property_exists($config, 'usecredchain') || !$config->usecredchain) { + $params['credentials'] = [ + 'key' => $config->api_key, + 'secret' => $config->api_secret, + ]; + } + $client = new \Aws\Sns\SnsClient($params); + + // Set up the sender information. + $senderid = $SITE->shortname; + // Remove spaces and non-alphanumeric characters from ID. + $senderid = preg_replace("/[^A-Za-z0-9]/", '', trim($senderid)); + // We have to truncate the senderID to 11 chars. + $senderid = substr($senderid, 0, 11); + + try { + // These messages need to be transactional. + $client->SetSMSAttributes([ + 'attributes' => [ + 'DefaultSMSType' => 'Transactional', + 'DefaultSenderID' => $senderid, + ], + ]); + + // Actually send the message. + $client->publish([ + 'Message' => $messagecontent, + 'PhoneNumber' => $phonenumber, + ]); + return \core_sms\message_status::GATEWAY_SENT; + } catch (\Aws\Exception\AwsException $e) { + return \core_sms\message_status::GATEWAY_NOT_AVAILABLE; + } + } +} diff --git a/sms/gateway/aws/classes/privacy/provider.php b/sms/gateway/aws/classes/privacy/provider.php new file mode 100644 index 00000000000..531a3713495 --- /dev/null +++ b/sms/gateway/aws/classes/privacy/provider.php @@ -0,0 +1,35 @@ +. + +namespace smsgateway_aws\privacy; + +use core_privacy\local\metadata\null_provider; + +/** + * Privacy Subsystem for smsgateway_aws implementing null_provider. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @codeCoverageIgnore + */ +class provider implements null_provider { + + #[\Override] + public static function get_reason(): string { + return 'privacy:metadata'; + } +} diff --git a/sms/gateway/aws/lang/en/smsgateway_aws.php b/sms/gateway/aws/lang/en/smsgateway_aws.php new file mode 100644 index 00000000000..f0dcce3eaab --- /dev/null +++ b/sms/gateway/aws/lang/en/smsgateway_aws.php @@ -0,0 +1,42 @@ +. + +/** + * Strings for component smsgateway_aws, language 'en'. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$string['api_key'] = 'Key'; +$string['api_key_help'] = 'Amazon API key credential.'; +$string['api_region'] = 'Region'; +$string['api_region_help'] = 'Amazon API gateway region.'; +$string['api_secret'] = 'Secret'; +$string['api_secret_help'] = 'Amazon API secret credential.'; +$string['aws_sns'] = 'AWS SNS'; +$string['countrycode'] = 'Country number code'; +$string['countrycode_help'] = 'The calling code without the leading + as a default if users do not enter an international number with a + prefix. + +See this link for a list of calling codes: {$a}'; +$string['gateway'] = 'SMS Gateway'; +$string['gateway_help'] = 'The SMS provider you wish to send messages via'; +$string['pluginname'] = 'AWS'; +$string['privacy:metadata'] = 'The AWS SMS gateway plugin does not store any personal data.'; +$string['usecredchain'] = 'Find AWS credentials using the default credential provider chain'; + + diff --git a/sms/gateway/aws/tests/gateway_test.php b/sms/gateway/aws/tests/gateway_test.php new file mode 100644 index 00000000000..c9936193539 --- /dev/null +++ b/sms/gateway/aws/tests/gateway_test.php @@ -0,0 +1,64 @@ +. + +namespace smsgateway_aws; + +use core_sms\message; + +/** + * AWS SMS gateway tests. + * + * @package smsgateway_aws + * @category test + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \smsgateway_aws\gateway + */ +class gateway_test extends \advanced_testcase { + + public function test_update_message_status(): void { + $this->resetAfterTest(); + + $manager = \core\di::get(\core_sms\manager::class); + $gw = $manager->create_gateway_instance(gateway::class, true); + $othergw = $manager->create_gateway_instance(gateway::class, true); + + $message = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'smsgateway_aws', + messagetype: 'test', + recipientuserid: null, + sensitive: false, + gatewayid: $gw->id, + ); + $message2 = new message( + recipientnumber: '1234567890', + content: 'Hello, world!', + component: 'smsgateway_aws', + messagetype: 'test', + recipientuserid: null, + sensitive: false, + gatewayid: $gw->id, + ); + + $updatedmessages = $gw->update_message_statuses([$message, $message2]); + $this->assertEquals([$message, $message2], $updatedmessages); + + $this->expectException(\coding_exception::class); + $othergw->update_message_status($message); + } +} diff --git a/sms/gateway/aws/tests/helper_test.php b/sms/gateway/aws/tests/helper_test.php new file mode 100644 index 00000000000..07a3dc361a0 --- /dev/null +++ b/sms/gateway/aws/tests/helper_test.php @@ -0,0 +1,79 @@ +. + +namespace smsgateway_aws; + +/** + * AWS SMS gateway helper tests. + * + * @package smsgateway_aws + * @category test + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \smsgateway_aws\helper + */ +class helper_test extends \advanced_testcase { + + /** + * Data provider for test_format_number(). + * + * @return array of different country codes and phone numbers. + */ + public function format_number_provider(): array { + + return [ + 'Phone number with local format' => [ + 'phonenumber' => '0123456789', + 'expected' => '+34123456789', + 'countrycode' => '34', + ], + 'Phone number with international format' => [ + 'phonenumber' => '+39123456789', + 'expected' => '+39123456789', + ], + 'Phone number with spaces using international format' => [ + 'phonenumber' => '+34 123 456 789', + 'expected' => '+34123456789', + ], + 'Phone number with spaces using local format with country code' => [ + 'phonenumber' => '0 123 456 789', + 'expected' => '+34123456789', + 'countrycode' => '34', + ], + 'Phone number with spaces using local format without country code' => [ + 'phonenumber' => '0 123 456 789', + 'expected' => '123456789', + ], + ]; + } + + /** + * Test format number with different phones and different country codes. + * + * @dataProvider format_number_provider + * @param string $phonenumber Phone number. + * @param string $expected Expected value. + * @param string|null $countrycode Country code. + */ + public function test_format_number( + string $phonenumber, + string $expected, + ?string $countrycode = null, + ): void { + $this->resetAfterTest(); + $this->assertEquals($expected, \core_sms\manager::format_number($phonenumber, $countrycode)); + } +} diff --git a/sms/gateway/aws/version.php b/sms/gateway/aws/version.php new file mode 100644 index 00000000000..1f2f7ead273 --- /dev/null +++ b/sms/gateway/aws/version.php @@ -0,0 +1,30 @@ +. + +/** + * Version information for smsgateway_aws. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'smsgateway_aws'; +$plugin->version = 2024042200; +$plugin->requires = 2024041600; +$plugin->maturity = MATURITY_STABLE; From cf75a3aad10cdafd42f259858d805182a8541c59 Mon Sep 17 00:00:00 2001 From: Safat Date: Thu, 2 May 2024 16:08:04 +1000 Subject: [PATCH 05/12] MDL-81924 factor_sms: Implement sms subsystem Originally implemented as MDL-80961. --- admin/tool/mfa/factor/sms/classes/factor.php | 21 ++++---- admin/tool/mfa/factor/sms/db/upgrade.php | 57 ++++++++++++++++++++ admin/tool/mfa/factor/sms/version.php | 2 +- 3 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 admin/tool/mfa/factor/sms/db/upgrade.php diff --git a/admin/tool/mfa/factor/sms/classes/factor.php b/admin/tool/mfa/factor/sms/classes/factor.php index cc773d7969d..e267de24e00 100644 --- a/admin/tool/mfa/factor/sms/classes/factor.php +++ b/admin/tool/mfa/factor/sms/classes/factor.php @@ -323,14 +323,6 @@ class factor extends object_factor_base { * @return bool */ public function is_enabled(): bool { - if (empty(get_config('factor_sms', 'gateway'))) { - return false; - } - - $class = '\factor_sms\local\smsgateway\\' . get_config('factor_sms', 'gateway'); - if (!call_user_func($class . '::is_gateway_enabled')) { - return false; - } return parent::is_enabled(); } @@ -412,9 +404,16 @@ class factor extends object_factor_base { ]; $message = get_string('smsstring', 'factor_sms', $content); - $class = '\factor_sms\local\smsgateway\\' . get_config('factor_sms', 'gateway'); - $gateway = new $class(); - $gateway->send_sms_message($message, $phonenumber); + $manager = \core\di::get(\core_sms\manager::class); + $manager->send( + recipientnumber: $phonenumber, + content: $message, + component: 'factor_sms', + messagetype: 'factor', + recipientuserid: null, + sensitive: true, + async: false, + ); } /** diff --git a/admin/tool/mfa/factor/sms/db/upgrade.php b/admin/tool/mfa/factor/sms/db/upgrade.php new file mode 100644 index 00000000000..249649c74de --- /dev/null +++ b/admin/tool/mfa/factor/sms/db/upgrade.php @@ -0,0 +1,57 @@ +. + +/** + * factor_sms upgrade library. + * + * @package factor_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Factor sms upgrade helper. + * + * @param int $oldversion Previous version of the plugin. + * @return bool + */ +function xmldb_factor_sms_upgrade(int $oldversion): bool { + if ($oldversion < 2024050300) { + $config = get_config('factor_sms'); + // If the sms factor is enabled, then do the migration to the sms subsystem. + if ((int)$config->enabled === 1) { + // SMS gateway configs. + $smsconfig = new stdClass(); + $smsconfig->countrycode = $config->countrycode; + $smsconfig->gateway = $config->gateway; + $smsconfig->usecredchain = $config->usecredchain; + $smsconfig->api_key = $config->api_key; + $smsconfig->api_secret = $config->api_secret; + $smsconfig->api_region = $config->api_region; + // Now insert the record. + $manager = \core\di::get(\core_sms\manager::class); + $manager->create_gateway_instance( + classname: \smsgateway_aws\gateway::class, + enabled: $config->enabled, + config: $smsconfig, + ); + } + // MFA savepoint reached. + upgrade_plugin_savepoint(true, 2024050300, 'factor', 'sms'); + } + + return true; +} diff --git a/admin/tool/mfa/factor/sms/version.php b/admin/tool/mfa/factor/sms/version.php index e516f839033..34e3f476e81 100644 --- a/admin/tool/mfa/factor/sms/version.php +++ b/admin/tool/mfa/factor/sms/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024042200; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2024050300; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2024041600; // Requires this Moodle version. $plugin->component = 'factor_sms'; // Full name of the plugin (used for diagnostics). $plugin->maturity = MATURITY_STABLE; From a1209ab882959a134a4530062f0e6c37467cd49a Mon Sep 17 00:00:00 2001 From: Safat Date: Sat, 29 Jun 2024 16:30:26 +1000 Subject: [PATCH 06/12] MDL-81924 factor_sms: Add support for SMS gateway selection Includes migrating AWS settings from the SMS MFA factor to a new gateway in the SMS subsystem and notifying admins of the update. Originally implemented as MDL-81732 and MDL-82660. Co-authored by: Michael Hawkins --- admin/tool/mfa/factor/sms/classes/factor.php | 5 +- .../mfa/factor/sms/classes/hook_listener.php | 50 ++++++++ .../sms_gateway_migration_notification.php | 57 +++++++++ admin/tool/mfa/factor/sms/db/hooks.php | 36 ++++++ admin/tool/mfa/factor/sms/db/upgrade.php | 13 ++- .../mfa/factor/sms/lang/en/factor_sms.php | 8 ++ admin/tool/mfa/factor/sms/settings.php | 110 +++++++++++++++--- admin/tool/mfa/factor/sms/version.php | 2 +- 8 files changed, 260 insertions(+), 21 deletions(-) create mode 100644 admin/tool/mfa/factor/sms/classes/hook_listener.php create mode 100644 admin/tool/mfa/factor/sms/classes/task/sms_gateway_migration_notification.php create mode 100644 admin/tool/mfa/factor/sms/db/hooks.php diff --git a/admin/tool/mfa/factor/sms/classes/factor.php b/admin/tool/mfa/factor/sms/classes/factor.php index e267de24e00..ef4329ee5b5 100644 --- a/admin/tool/mfa/factor/sms/classes/factor.php +++ b/admin/tool/mfa/factor/sms/classes/factor.php @@ -409,10 +409,11 @@ class factor extends object_factor_base { recipientnumber: $phonenumber, content: $message, component: 'factor_sms', - messagetype: 'factor', + messagetype: 'mfa', recipientuserid: null, - sensitive: true, + issensitive: true, async: false, + gatewayid: get_config('factor_sms', 'smsgateway'), ); } diff --git a/admin/tool/mfa/factor/sms/classes/hook_listener.php b/admin/tool/mfa/factor/sms/classes/hook_listener.php new file mode 100644 index 00000000000..0feea00ac32 --- /dev/null +++ b/admin/tool/mfa/factor/sms/classes/hook_listener.php @@ -0,0 +1,50 @@ +. + +namespace factor_sms; + +use core_sms\hook\before_gateway_deleted; +use core_sms\hook\before_gateway_disabled; + +/** + * Hook listener for SMS factor. + * + * @package factor_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class hook_listener { + + /** + * Hook listener before a gateway is deleted or disabled. + * + * This listener will check if the SMS gateway is currently in use before disabling or deleting the gateway. + * + * @param before_gateway_deleted|before_gateway_disabled $hook Hook instance before the gateway is deleted + */ + public static function check_gateway_usage_in_mfa( + before_gateway_deleted|before_gateway_disabled $hook, + ): void { + try { + $smsgatewayid = (int)get_config('factor_sms', 'smsgateway'); + if ($smsgatewayid && $smsgatewayid === (int)$hook->gateway->id) { + $hook->stop_propagation(); + } + } catch (\dml_exception $exception) { + $hook->stop_propagation(); + } + } +} diff --git a/admin/tool/mfa/factor/sms/classes/task/sms_gateway_migration_notification.php b/admin/tool/mfa/factor/sms/classes/task/sms_gateway_migration_notification.php new file mode 100644 index 00000000000..de26a387ee3 --- /dev/null +++ b/admin/tool/mfa/factor/sms/classes/task/sms_gateway_migration_notification.php @@ -0,0 +1,57 @@ +. + +namespace factor_sms\task; + +use core\task\adhoc_task; +use moodle_url; + +/** + * Notification for admins to notify about the migration of SMS setup from MFA to SMS gateway plugins. + * + * @package factor_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class sms_gateway_migration_notification extends adhoc_task { + + public function execute(): void { + + $siteadmins = get_admins(); + foreach ($siteadmins as $siteadmin) { + $smsconfigureurl = new moodle_url('/sms/sms_gateways.php'); + $messagebody = get_string('notification:smsgatewaymigrationinfo', 'factor_sms', $smsconfigureurl); + $messagesubject = get_string('notification:smsgatewaymigration', 'factor_sms'); + + $message = new \core\message\message(); + $message->component = 'moodle'; + $message->name = 'notices'; + $message->userfrom = \core_user::get_noreply_user(); + $message->subject = $messagesubject; + $message->fullmessageformat = FORMAT_HTML; + $message->notification = 1; + $message->userto = $siteadmin; + $message->smallmessage = $messagesubject; + $message->fullmessagehtml = $messagebody; + $message->fullmessage = html_to_text($messagebody); + $message->contexturl = $smsconfigureurl; + $message->contexturlname = $messagesubject; + + // Send message. + message_send($message); + } + } +} diff --git a/admin/tool/mfa/factor/sms/db/hooks.php b/admin/tool/mfa/factor/sms/db/hooks.php new file mode 100644 index 00000000000..30152b7b017 --- /dev/null +++ b/admin/tool/mfa/factor/sms/db/hooks.php @@ -0,0 +1,36 @@ +. + +/** + * Hooks register for SMS factor. + * + * @package factor_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$callbacks = [ + [ + 'hook' => \core_sms\hook\before_gateway_deleted::class, + 'callback' => \factor_sms\hook_listener::class . '::check_gateway_usage_in_mfa', + ], + [ + 'hook' => \core_sms\hook\before_gateway_disabled::class, + 'callback' => \factor_sms\hook_listener::class . '::check_gateway_usage_in_mfa', + ], +]; diff --git a/admin/tool/mfa/factor/sms/db/upgrade.php b/admin/tool/mfa/factor/sms/db/upgrade.php index 249649c74de..1b5794e7738 100644 --- a/admin/tool/mfa/factor/sms/db/upgrade.php +++ b/admin/tool/mfa/factor/sms/db/upgrade.php @@ -29,7 +29,7 @@ * @return bool */ function xmldb_factor_sms_upgrade(int $oldversion): bool { - if ($oldversion < 2024050300) { + if ($oldversion < 2024082200) { $config = get_config('factor_sms'); // If the sms factor is enabled, then do the migration to the sms subsystem. if ((int)$config->enabled === 1) { @@ -43,14 +43,21 @@ function xmldb_factor_sms_upgrade(int $oldversion): bool { $smsconfig->api_region = $config->api_region; // Now insert the record. $manager = \core\di::get(\core_sms\manager::class); - $manager->create_gateway_instance( + $gateway = $manager->create_gateway_instance( classname: \smsgateway_aws\gateway::class, + name: 'MFA AWS', enabled: $config->enabled, config: $smsconfig, ); + // Set the mfa config for the sms gateway. + set_config('smsgateway', $gateway->id, 'factor_sms'); + + // Now add the task to send notification to admins about this migration. + $task = new \factor_sms\task\sms_gateway_migration_notification(); + \core\task\manager::queue_adhoc_task($task, true); } // MFA savepoint reached. - upgrade_plugin_savepoint(true, 2024050300, 'factor', 'sms'); + upgrade_plugin_savepoint(true, 2024082200, 'factor', 'sms'); } return true; diff --git a/admin/tool/mfa/factor/sms/lang/en/factor_sms.php b/admin/tool/mfa/factor/sms/lang/en/factor_sms.php index d428352ca9b..6ef13e700e7 100644 --- a/admin/tool/mfa/factor/sms/lang/en/factor_sms.php +++ b/admin/tool/mfa/factor/sms/lang/en/factor_sms.php @@ -44,6 +44,8 @@ $string['loginsubmit'] = 'Continue'; $string['managefactor'] = 'Manage SMS'; $string['managefactorbutton'] = 'Manage'; $string['manageinfo'] = 'You are using \'{$a}\' to authenticate.'; +$string['notification:smsgatewaymigration'] = 'SMS settings have moved'; +$string['notification:smsgatewaymigrationinfo'] = 'A new SMS subsystem is now available for managing and configuring all SMS-related functions. Your existing SMS configurations have been seamlessly migrated. You can find and manage them on the new SMS Gateways page.'; $string['logintitle'] = 'Enter the verification code sent to your mobile'; $string['phonehelp'] = 'Enter your mobile number (including country code) to receive a verification code.'; $string['pluginname'] = 'SMS mobile phone'; @@ -65,6 +67,12 @@ $string['settings:duration'] = 'Validity duration'; $string['settings:duration_help'] = 'The period of time that the code is valid.'; $string['settings:gateway'] = 'SMS gateway'; $string['settings:gateway_help'] = 'The SMS provider you wish to send messages via'; +$string['settings:heading'] = 'Users will receive an SMS with 6-digit code during login, which they must enter to complete the login process. + +Users will need to register their mobile phone number first.'; +$string['settings:setupdesc'] = '

To use SMS as an authentication factor, you first need to set up an SMS gateway.'; +$string['settings:smsgateway'] = 'SMS gateway'; +$string['settings:smsgateway_help'] = 'Select a gateway from the list, or create a new gateway.'; $string['setupfactor'] = 'Set up SMS'; $string['setupfactorbutton'] = 'Set up'; $string['setupsubmitcode'] = 'Save'; diff --git a/admin/tool/mfa/factor/sms/settings.php b/admin/tool/mfa/factor/sms/settings.php index 2bd2c89eb4a..99c4df91156 100644 --- a/admin/tool/mfa/factor/sms/settings.php +++ b/admin/tool/mfa/factor/sms/settings.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * Settings + * Settings for SMS MFA factor. * * @package factor_sms * @author Peter Burnett @@ -24,24 +24,103 @@ */ defined('MOODLE_INTERNAL') || die(); -global $CFG, $OUTPUT; -$enabled = new admin_setting_configcheckbox('factor_sms/enabled', - new lang_string('settings:enablefactor', 'tool_mfa'), - new lang_string('settings:enablefactor_help', 'tool_mfa'), 0); -$enabled->set_updatedcallback(function () { - \tool_mfa\manager::do_factor_action('sms', get_config('factor_sms', 'enabled') ? 'enable' : 'disable'); -}); -$settings->add($enabled); +global $CFG; +// Get the gateway records. +$manager = \core\di::get(\core_sms\manager::class); +$gatewayrecords = $manager->get_gateway_records(['enabled' => 1]); +$smsconfigureurl = new moodle_url( + '/sms/configure.php', + [ + 'returnurl' => new moodle_url( + '/admin/settings.php', + ['section' => 'factor_sms'], + ), + ], +); +$smsconfigureurl = $smsconfigureurl->out(); -$settings->add(new admin_setting_configtext('factor_sms/weight', - new lang_string('settings:weight', 'tool_mfa'), - new lang_string('settings:weight_help', 'tool_mfa'), 100, PARAM_INT)); +$settings->add( + new admin_setting_heading( + 'factor_sms/heading', + '', + new lang_string( + 'settings:heading', + 'factor_sms', + ), + ), +); -$settings->add(new admin_setting_configduration('factor_sms/duration', - get_string('settings:duration', 'tool_mfa'), - get_string('settings:duration_help', 'tool_mfa'), 30 * MINSECS, MINSECS)); +if (count($gatewayrecords) > 0) { + $gateways = [0 => new lang_string('none')]; + foreach ($gatewayrecords as $record) { + $values = explode('\\', $record->gateway); + $gatewayname = new lang_string('pluginname', $values[0]); + $gateways[$record->id] = $record->name . ' (' . $gatewayname . ')'; + } + $settings->add( + new admin_setting_configselect( + 'factor_sms/smsgateway', + new lang_string('settings:smsgateway', 'factor_sms'), + new lang_string('settings:smsgateway_help', 'factor_sms', $smsconfigureurl), + 0, + $gateways, + ), + ); + + $enabled = new admin_setting_configcheckbox( + 'factor_sms/enabled', + new lang_string('settings:enablefactor', 'tool_mfa'), + new lang_string('settings:enablefactor_help', 'tool_mfa'), + 0, + ); + $enabled->set_updatedcallback(function () { + \tool_mfa\manager::do_factor_action( + 'sms', + get_config('factor_sms', 'enabled') ? 'enable' : 'disable', + ); + }); + $settings->add($enabled); + + $settings->add( + new admin_setting_configtext( + 'factor_sms/weight', + new lang_string('settings:weight', 'tool_mfa'), + new lang_string('settings:weight_help', 'tool_mfa'), + 100, + PARAM_INT, + ), + ); + $settings->hide_if('factor_sms/weight', 'factor_sms/enabled'); + + $settings->add( + new admin_setting_configduration( + 'factor_sms/duration', + new lang_string('settings:duration', 'tool_mfa'), + new lang_string('settings:duration_help', 'tool_mfa'), + 30 * MINSECS, + MINSECS, + ), + ); + $settings->hide_if('factor_sms/duration', 'factor_sms/enabled'); +} else { + $settings->add( + new admin_setting_description( + 'factor_sms/setupdesc', + '', + new lang_string( + 'settings:setupdesc', + 'factor_sms', + $smsconfigureurl, + ), + ), + ); +} + + +// TODO MDL-80962 Remove these settings, strings and associated codes (if any). +/* $codeslink = 'https://en.wikipedia.org/wiki/List_of_country_calling_codes'; $link = \html_writer::link($codeslink, $codeslink); @@ -64,3 +143,4 @@ if (empty(get_config('factor_sms', 'gateway'))) { $class = '\factor_sms\local\smsgateway\\' . get_config('factor_sms', 'gateway'); call_user_func($class . '::add_settings', $settings); +*/ diff --git a/admin/tool/mfa/factor/sms/version.php b/admin/tool/mfa/factor/sms/version.php index 34e3f476e81..5640b982039 100644 --- a/admin/tool/mfa/factor/sms/version.php +++ b/admin/tool/mfa/factor/sms/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024050300; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2024082200; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2024041600; // Requires this Moodle version. $plugin->component = 'factor_sms'; // Full name of the plugin (used for diagnostics). $plugin->maturity = MATURITY_STABLE; From 3348832b78a456ab12d5b83a2954af27b7487fe0 Mon Sep 17 00:00:00 2001 From: Safat Date: Sat, 29 Jun 2024 16:33:21 +1000 Subject: [PATCH 07/12] MDL-81924 smsgateway_aws: Add hooks for SMS gateway management Originally implemented as MDL-81732. Co-authored by: Michael Hawkins --- sms/gateway/aws/classes/hook_listener.php | 110 +++++++++++++++++++++ sms/gateway/aws/db/hooks.php | 32 ++++++ sms/gateway/aws/lang/en/smsgateway_aws.php | 22 ++--- sms/gateway/aws/tests/gateway_test.php | 21 +++- sms/gateway/aws/version.php | 2 +- 5 files changed, 167 insertions(+), 20 deletions(-) create mode 100644 sms/gateway/aws/classes/hook_listener.php create mode 100644 sms/gateway/aws/db/hooks.php diff --git a/sms/gateway/aws/classes/hook_listener.php b/sms/gateway/aws/classes/hook_listener.php new file mode 100644 index 00000000000..8da4ff9db2c --- /dev/null +++ b/sms/gateway/aws/classes/hook_listener.php @@ -0,0 +1,110 @@ +. + +namespace smsgateway_aws; + +use core_sms\hook\after_sms_gateway_form_hook; + +/** + * Hook listener for aws sms gateway. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class hook_listener { + + /** + * Hook listener for the sms gateway setup form. + * + * @param after_sms_gateway_form_hook $hook The hook to add to sms gateway setup. + */ + public static function set_form_definition_for_aws_sms_gateway(after_sms_gateway_form_hook $hook): void { + if ($hook->plugin !== 'smsgateway_aws') { + return; + } + + $mform = $hook->mform; + + $mform->addElement('static', 'information', get_string('aws_information', 'smsgateway_aws')); + + $gateways = [ + 'aws_sns' => get_string('aws_sns', 'smsgateway_aws'), + ]; + $mform->addElement( + 'select', + 'gateway', + get_string('gateway', 'smsgateway_aws'), + $gateways, + ); + $mform->setDefault( + elementName: 'gateway', + defaultValue: 'aws_sns', + ); + // Remove this if more aws gateway implemented, eg sqs. + $mform->hardFreeze('gateway'); + + $mform->addElement( + 'checkbox', + 'usecredchain', + get_string('usecredchain', 'smsgateway_aws'), + ' ', + ); + $mform->setDefault( + elementName: 'usecredchain', + defaultValue: 0, + ); + + $mform->addElement( + 'text', + 'api_key', + get_string('api_key', 'smsgateway_aws'), + 'maxlength="255" size="20"', + ); + $mform->setType('api_key', PARAM_TEXT); + $mform->addRule('api_key', get_string('maximumchars', '', 255), 'maxlength', 255); + $mform->setDefault( + elementName: 'api_key', + defaultValue: '', + ); + $mform->addElement( + 'passwordunmask', + 'api_secret', + get_string('api_secret', 'smsgateway_aws'), + 'maxlength="255" size="20"', + ); + $mform->setType('api_secret', PARAM_TEXT); + $mform->addRule('api_secret', get_string('maximumchars', '', 255), 'maxlength', 255); + $mform->setDefault( + elementName: 'api_secret', + defaultValue: '', + ); + + $mform->addElement( + 'text', + 'api_region', + get_string('api_region', 'smsgateway_aws'), + 'maxlength="255" size="20"', + ); + $mform->setType('api_region', PARAM_TEXT); + $mform->addRule('api_region', get_string('maximumchars', '', 255), 'maxlength', 255); + $mform->setDefault( + elementName: 'api_region', + defaultValue: 'ap-southeast-2', + ); + } + +} diff --git a/sms/gateway/aws/db/hooks.php b/sms/gateway/aws/db/hooks.php new file mode 100644 index 00000000000..efcc88187ae --- /dev/null +++ b/sms/gateway/aws/db/hooks.php @@ -0,0 +1,32 @@ +. + +/** + * Hook listener callbacks for aws sms gateway. + * + * @package smsgateway_aws + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$callbacks = [ + [ + 'hook' => \core_sms\hook\after_sms_gateway_form_hook::class, + 'callback' => \smsgateway_aws\hook_listener::class . '::set_form_definition_for_aws_sms_gateway', + ], +]; diff --git a/sms/gateway/aws/lang/en/smsgateway_aws.php b/sms/gateway/aws/lang/en/smsgateway_aws.php index f0dcce3eaab..e19e079ef9c 100644 --- a/sms/gateway/aws/lang/en/smsgateway_aws.php +++ b/sms/gateway/aws/lang/en/smsgateway_aws.php @@ -22,21 +22,13 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['api_key'] = 'Key'; -$string['api_key_help'] = 'Amazon API key credential.'; -$string['api_region'] = 'Region'; -$string['api_region_help'] = 'Amazon API gateway region.'; -$string['api_secret'] = 'Secret'; -$string['api_secret_help'] = 'Amazon API secret credential.'; +$string['api_key'] = 'Access key'; +$string['api_region'] = 'Amazon API gateway region'; +$string['api_secret'] = 'Secret access key'; +$string['aws_information'] = 'Complete the following fields using the information provided by AWS'; $string['aws_sns'] = 'AWS SNS'; -$string['countrycode'] = 'Country number code'; -$string['countrycode_help'] = 'The calling code without the leading + as a default if users do not enter an international number with a + prefix. - -See this link for a list of calling codes: {$a}'; -$string['gateway'] = 'SMS Gateway'; -$string['gateway_help'] = 'The SMS provider you wish to send messages via'; +$string['gateway'] = 'AWS service'; +$string['aws_information'] = 'Complete the following fields using the information provided by AWS'; $string['pluginname'] = 'AWS'; $string['privacy:metadata'] = 'The AWS SMS gateway plugin does not store any personal data.'; -$string['usecredchain'] = 'Find AWS credentials using the default credential provider chain'; - - +$string['usecredchain'] = 'Find AWS credentials using the default provider chain'; diff --git a/sms/gateway/aws/tests/gateway_test.php b/sms/gateway/aws/tests/gateway_test.php index c9936193539..70281a75a55 100644 --- a/sms/gateway/aws/tests/gateway_test.php +++ b/sms/gateway/aws/tests/gateway_test.php @@ -32,9 +32,22 @@ class gateway_test extends \advanced_testcase { public function test_update_message_status(): void { $this->resetAfterTest(); + $config = new \stdClass(); + $config->api_key = 'test_api_key'; + $manager = \core\di::get(\core_sms\manager::class); - $gw = $manager->create_gateway_instance(gateway::class, true); - $othergw = $manager->create_gateway_instance(gateway::class, true); + $gw = $manager->create_gateway_instance( + classname: gateway::class, + name: 'aws', + enabled: true, + config: $config, + ); + $othergw = $manager->create_gateway_instance( + classname: gateway::class, + name: 'aws', + enabled: true, + config: $config, + ); $message = new message( recipientnumber: '1234567890', @@ -42,7 +55,7 @@ class gateway_test extends \advanced_testcase { component: 'smsgateway_aws', messagetype: 'test', recipientuserid: null, - sensitive: false, + issensitive: false, gatewayid: $gw->id, ); $message2 = new message( @@ -51,7 +64,7 @@ class gateway_test extends \advanced_testcase { component: 'smsgateway_aws', messagetype: 'test', recipientuserid: null, - sensitive: false, + issensitive: false, gatewayid: $gw->id, ); diff --git a/sms/gateway/aws/version.php b/sms/gateway/aws/version.php index 1f2f7ead273..1e5f473b2c9 100644 --- a/sms/gateway/aws/version.php +++ b/sms/gateway/aws/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'smsgateway_aws'; -$plugin->version = 2024042200; +$plugin->version = 2024082200; $plugin->requires = 2024041600; $plugin->maturity = MATURITY_STABLE; From b5ac3257b51061c4c43d568c0e97768586381467 Mon Sep 17 00:00:00 2001 From: Safat Date: Sat, 29 Jun 2024 16:33:54 +1000 Subject: [PATCH 08/12] MDL-81924 core_sms: Add SMS gateway management UI Originally implemented as MDL-81732. Co-authored by: Michael Hawkins --- admin/settings/plugins.php | 31 ++ .../sms/tests/behat/factor_sms_login.feature | 12 +- .../sms/tests/behat/factor_sms_setup.feature | 18 +- .../behat/factor_sms_setup_gateway.feature | 44 +++ lang/en/sms.php | 16 + lib/db/services.php | 6 + phpunit.xml.dist | 3 + sms/amd/build/smsgatewaychooser.min.js | 11 + sms/amd/build/smsgatewaychooser.min.js.map | 1 + sms/amd/src/smsgatewaychooser.js | 43 +++ sms/classes/external/sms_gateway_status.php | 108 +++++++ sms/classes/form/sms_gateway_form.php | 121 ++++++++ sms/classes/gateway.php | 18 +- .../hook/after_sms_gateway_form_hook.php | 45 +++ sms/classes/hook/before_gateway_deleted.php | 46 +++ sms/classes/hook/before_gateway_disabled.php | 46 +++ sms/classes/manager.php | 94 +++++- sms/classes/table/sms_gateway_table.php | 274 ++++++++++++++++++ .../table/sms_gateway_table_filterset.php | 27 ++ sms/configure.php | 118 ++++++++ sms/sms_gateways.php | 94 ++++++ sms/templates/sms_action_icons.mustache | 43 +++ sms/templates/sms_gateways.mustache | 37 +++ sms/tests/behat/list_sms_gateways.feature | 32 ++ .../external/sms_gateway_status_test.php | 83 ++++++ sms/tests/gateway_test.php | 17 +- .../generator/behat_core_sms_generator.php | 45 +++ sms/tests/generator/lib.php | 45 +++ sms/tests/manager_test.php | 70 +++-- 29 files changed, 1510 insertions(+), 38 deletions(-) create mode 100644 admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup_gateway.feature create mode 100644 sms/amd/build/smsgatewaychooser.min.js create mode 100644 sms/amd/build/smsgatewaychooser.min.js.map create mode 100644 sms/amd/src/smsgatewaychooser.js create mode 100644 sms/classes/external/sms_gateway_status.php create mode 100644 sms/classes/form/sms_gateway_form.php create mode 100644 sms/classes/hook/after_sms_gateway_form_hook.php create mode 100644 sms/classes/hook/before_gateway_deleted.php create mode 100644 sms/classes/hook/before_gateway_disabled.php create mode 100644 sms/classes/table/sms_gateway_table.php create mode 100644 sms/classes/table/sms_gateway_table_filterset.php create mode 100644 sms/configure.php create mode 100644 sms/sms_gateways.php create mode 100644 sms/templates/sms_action_icons.mustache create mode 100644 sms/templates/sms_gateways.mustache create mode 100644 sms/tests/behat/list_sms_gateways.feature create mode 100644 sms/tests/external/sms_gateway_status_test.php create mode 100644 sms/tests/generator/behat_core_sms_generator.php create mode 100644 sms/tests/generator/lib.php diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index dd64452876a..3cb39bcd0ed 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -836,6 +836,37 @@ if ($hassiteconfig && core_communication\api::is_available()) { } } +// SMS plugins. +if ($hassiteconfig) { + $ADMIN->add( + 'modules', + new admin_category( + 'sms', + new lang_string('sms', 'core_sms'), + ), + ); + $ADMIN->add( + 'sms', + new admin_externalpage( + 'smsgateway', + new lang_string('manage_sms_gateways', 'core_sms'), + $CFG->wwwroot . '/sms/sms_gateways.php', + ), + ); + foreach (core_component::get_plugin_list('smsgateway') as $plugin => $path) { + $settingspath = $path . '/settings.php'; + if (file_exists($settingspath)) { + $settings = new admin_settingpage( + 'smsgateway_' . $plugin . '_settings', + new lang_string('pluginname', 'smsgateway_' . $plugin), + 'moodle/site:config', + ); + include($settingspath); + $ADMIN->add('smsgateway', $settings); + } + } +} + // Content bank content types. if ($hassiteconfig) { $ADMIN->add('modules', new admin_category('contentbanksettings', new lang_string('contentbank'))); diff --git a/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature b/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature index 5e516849efa..7ba2c00c059 100644 --- a/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature +++ b/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature @@ -6,11 +6,21 @@ Feature: Login user with sms authentication factor Background: Given I log in as "admin" + And the following "core_sms > sms_gateways" exist: + | name | classname | enabled | config | + | Dummy gateway | smsgateway_aws\gateway | 1 | {"countrycode":"+61", "gateway":"aws_sns", "api_region":"ap-southeast-2", "api_key":"abc", "api_secret":"123"} | And the following config values are set as admin: | enabled | 1 | tool_mfa | | lockout | 3 | tool_mfa | And the following config values are set as admin: - | enabled | 1 | factor_sms | + | enabled | 1 | factor_sms | + | weight | 100 | factor_sms | + | duration | 1800 | factor_sms | + And I navigate to "Plugins > Admin tools > Multi-factor authentication" in site administration + And I follow "Edit settings for the SMS mobile phone factor" + And I set the field "SMS gateway" to "Dummy gateway (AWS)" + And I press "Save changes" + And I should see "Changes saved" # Set up user SMS factor in user preferences. When I follow "Preferences" in the user menu And I click on "Multi-factor authentication preferences" "link" diff --git a/admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup.feature b/admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup.feature index 3a7f6ad080b..8b75e1ad6ff 100644 --- a/admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup.feature +++ b/admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup.feature @@ -6,10 +6,26 @@ Feature: Set up SMS factor in user preferences Background: Given I log in as "admin" + And I navigate to "Plugins > SMS > Manage SMS gateways" in site administration + And I follow "Create a new SMS gateway" + And I set the following fields to these values: + | SMS gateway provider | AWS | + | Gateway name | Dummy gateway | + | Access key | key123 | + | Secret access key | secret456 | + And I press "Save changes" And the following config values are set as admin: | enabled | 1 | tool_mfa | + | lockout | 3 | tool_mfa | And the following config values are set as admin: - | enabled | 1 | factor_sms | + | enabled | 1 | factor_sms | + | weight | 100 | factor_sms | + | duration | 1800 | factor_sms | + And I navigate to "Plugins > Admin tools > Multi-factor authentication" in site administration + And I follow "Edit settings for the SMS mobile phone factor" + And I set the field "SMS gateway" to "Dummy gateway (AWS)" + And I press "Save changes" + And I should see "Changes saved" When I follow "Preferences" in the user menu And I click on "Multi-factor authentication preferences" "link" And I click on "Set up" "button" diff --git a/admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup_gateway.feature b/admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup_gateway.feature new file mode 100644 index 00000000000..909f77409a9 --- /dev/null +++ b/admin/tool/mfa/factor/sms/tests/behat/factor_sms_setup_gateway.feature @@ -0,0 +1,44 @@ +@tool @tool_mfa @factor_sms +Feature: Set up SMS factor when relevant gateway is not configured + In order configure the SMS factor + As an admin + I want to be directed to the SMS gateway setup when necessary + + Scenario: Configuring gateways from the SMS factor settings + Given I log in as "admin" + And the following config values are set as admin: + | enabled | 1 | tool_mfa | + | lockout | 3 | tool_mfa | + And the following config values are set as admin: + | enabled | 1 | factor_sms | + | weight | 100 | factor_sms | + | duration | 1800 | factor_sms | + When I navigate to "Plugins > Admin tools > Multi-factor authentication" in site administration + And I follow "Edit settings for the SMS mobile phone factor" + Then I should see "To use SMS as an authentication factor, you first need to set up an SMS gateway." + And I should see "set up an SMS gateway" + And I follow "set up an SMS gateway" + And I should see "Configure SMS gateway" + And I set the following fields to these values: + | SMS gateway provider | AWS | + | Gateway name | First AWS gateway | + | Country code | 61 | + | Access key | key123 | + | Secret access key | secret456 | + | Amazon API gateway region | ap-southeast-2 | + And I press "Save changes" + And I should see "SMS mobile phone" + And the "SMS gateway" select box should contain "First AWS gateway (AWS)" + And I follow "create a new gateway" + And I should see "Configure SMS gateway" + And I set the following fields to these values: + | SMS gateway provider | AWS | + | Gateway name | Second one | + | Country code | 1 | + | Access key | key1234 | + | Secret access key | secret4567 | + | Amazon API gateway region | ap-southeast-2 | + And I press "Save changes" + And I should see "SMS mobile phone" + And the "SMS gateway" select box should contain "First AWS gateway (AWS)" + And the "SMS gateway" select box should contain "Second one (AWS)" diff --git a/lang/en/sms.php b/lang/en/sms.php index 138a82a6d7d..3a11332facf 100644 --- a/lang/en/sms.php +++ b/lang/en/sms.php @@ -22,6 +22,16 @@ * @copyright 2024 Andrew Lyons * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +$string['actions'] = 'Actions'; +$string['configure_sms_gateway'] = 'Configure SMS gateway'; +$string['countrycode'] = 'Country code'; +$string['countrycode_help'] = 'Set the default phone number format to exclude the "+" symbol if user does not enter an international number with it.'; +$string['createnewgateway'] = 'Create a new SMS gateway'; +$string['delete_sms_gateway'] = 'Delete SMS gateway'; +$string['delete_sms_gateway_confirmation'] = 'Are you sure you want to delete the {$a->gateway} SMS gateway?'; +$string['gateway'] = 'Gateway'; +$string['gateway_name'] = 'Gateway name'; +$string['manage_sms_gateways'] = 'Manage SMS gateways'; $string['phonenumbernotvalid'] = 'Format of phone number not recognised: {$a->message}'; $string['privacy:metadata:sms_messages'] = 'Stores messages sent via SMS'; $string['privacy:metadata:sms_messages:content'] = 'The message text'; @@ -32,6 +42,7 @@ $string['privacy:metadata:sms_messages:status'] = 'The status of the message'; $string['privacy:metadata:sms_messages:timecreated'] = 'The time the message was created'; $string['privacy:sms:sensitive_not_shown'] = 'The content of this message was not stored as it was marked as containing sensitive content.'; $string['sms'] = 'SMS'; +$string['sms_form_information'] = 'This page allow you to set up and manage your SMS gateway for sending text messages.'; $string['status:gateway_failed'] = 'The gateway has failed to send the message'; $string['status:gateway_not_available'] = 'The gateway is not available to send the message'; $string['status:gateway_queued'] = 'The message is queued to be sent by the gateway'; @@ -39,3 +50,8 @@ $string['status:gateway_rejected'] = 'The gateway has rejected the message'; $string['status:gateway_sent'] = 'The message has been sent by the gateway'; $string['status:message_over_size'] = 'The message is too large to be sent by the gateway'; $string['status:unknown'] = 'Unable to determine the status of the message'; +$string['sms_gateways'] = 'SMS gateways'; +$string['sms_gateway_deleted'] = '{$a->gateway} SMS gateway has been deleted'; +$string['sms_gateway_delete_failed'] = 'Cannot delete the {$a->gateway} SMS gateway. The gateway is either in use or there\'s a database issue. Check if the gateway is active or contact your database administrator for help.'; +$string['sms_gateway_disable_failed'] = 'Cannot disable the SMS gateway. The gateway is either in use or there\'s a database issue. Check if the gateway is active or contact your database administrator for help.'; +$string['select_sms_gateways'] = 'SMS gateway provider'; diff --git a/lib/db/services.php b/lib/db/services.php index 24983529f5c..6c71ca24d76 100644 --- a/lib/db/services.php +++ b/lib/db/services.php @@ -3264,6 +3264,12 @@ $functions = array( 'type' => 'write', 'ajax' => true, ], + 'core_sms_set_gateway_status' => [ + 'classname' => 'core_sms\external\sms_gateway_status', + 'description' => 'Set the sms gateway status', + 'type' => 'write', + 'ajax' => true, + ], ); $services = array( diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e0534c8978f..15fdf7e73ff 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -294,6 +294,9 @@ ai/tests ai/tests/classes + + sms/tests + diff --git a/sms/amd/build/smsgatewaychooser.min.js b/sms/amd/build/smsgatewaychooser.min.js new file mode 100644 index 00000000000..38c9f679af4 --- /dev/null +++ b/sms/amd/build/smsgatewaychooser.min.js @@ -0,0 +1,11 @@ +define("core_sms/smsgatewaychooser",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0; +/** + * SMS gateway selection handler. + * + * @module core_sms/smsgatewaychooser + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +const Selectors_fields={selector:'[data-smsgatewaychooser-field="selector"]',updateButton:'[data-smsgatewaychooser-field="updateButton"]'};_exports.init=()=>{var _document$querySelect;null===(_document$querySelect=document.querySelector(Selectors_fields.selector))||void 0===_document$querySelect||_document$querySelect.addEventListener("change",(e=>{const form=e.target.closest("form"),updateButton=form.querySelector(Selectors_fields.updateButton),url=new URL(form.action);form.action=url.toString(),updateButton.click()}))}})); + +//# sourceMappingURL=smsgatewaychooser.min.js.map \ No newline at end of file diff --git a/sms/amd/build/smsgatewaychooser.min.js.map b/sms/amd/build/smsgatewaychooser.min.js.map new file mode 100644 index 00000000000..4761ccee7d7 --- /dev/null +++ b/sms/amd/build/smsgatewaychooser.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"smsgatewaychooser.min.js","sources":["../src/smsgatewaychooser.js"],"sourcesContent":["\n// This file is part of Moodle - http://moodle.org/ //\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * SMS gateway selection handler.\n *\n * @module core_sms/smsgatewaychooser\n * @copyright 2024 Safat Shahin \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nconst Selectors = {\n fields: {\n selector: '[data-smsgatewaychooser-field=\"selector\"]',\n updateButton: '[data-smsgatewaychooser-field=\"updateButton\"]',\n },\n};\n\n/**\n * Initialise the sms gateway chooser.\n */\nexport const init = () => {\n document.querySelector(Selectors.fields.selector)?.addEventListener('change', e => {\n const form = e.target.closest('form');\n const updateButton = form.querySelector(Selectors.fields.updateButton);\n const url = new URL(form.action);\n\n form.action = url.toString();\n updateButton.click();\n });\n};\n"],"names":["Selectors","selector","updateButton","document","querySelector","addEventListener","e","form","target","closest","url","URL","action","toString","click"],"mappings":";;;;;;;;MAuBMA,iBACM,CACJC,SAAU,4CACVC,aAAc,+DAOF,6DAChBC,SAASC,cAAcJ,iBAAiBC,kEAAWI,iBAAiB,UAAUC,UACpEC,KAAOD,EAAEE,OAAOC,QAAQ,QACxBP,aAAeK,KAAKH,cAAcJ,iBAAiBE,cACnDQ,IAAM,IAAIC,IAAIJ,KAAKK,QAEzBL,KAAKK,OAASF,IAAIG,WAClBX,aAAaY"} \ No newline at end of file diff --git a/sms/amd/src/smsgatewaychooser.js b/sms/amd/src/smsgatewaychooser.js new file mode 100644 index 00000000000..a0be29a8ebe --- /dev/null +++ b/sms/amd/src/smsgatewaychooser.js @@ -0,0 +1,43 @@ + +// This file is part of Moodle - http://moodle.org/ // +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . + +/** + * SMS gateway selection handler. + * + * @module core_sms/smsgatewaychooser + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +const Selectors = { + fields: { + selector: '[data-smsgatewaychooser-field="selector"]', + updateButton: '[data-smsgatewaychooser-field="updateButton"]', + }, +}; + +/** + * Initialise the sms gateway chooser. + */ +export const init = () => { + document.querySelector(Selectors.fields.selector)?.addEventListener('change', e => { + const form = e.target.closest('form'); + const updateButton = form.querySelector(Selectors.fields.updateButton); + const url = new URL(form.action); + + form.action = url.toString(); + updateButton.click(); + }); +}; diff --git a/sms/classes/external/sms_gateway_status.php b/sms/classes/external/sms_gateway_status.php new file mode 100644 index 00000000000..5272eae2143 --- /dev/null +++ b/sms/classes/external/sms_gateway_status.php @@ -0,0 +1,108 @@ +. + +namespace core_sms\external; + +use context_system; +use core_external\external_api; +use core_external\external_function_parameters; +use core_external\external_single_structure; +use core_external\external_value; + +/** + * Webservice to enable or disable sms gateway. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class sms_gateway_status extends external_api { + + public static function execute_parameters(): external_function_parameters { + return new external_function_parameters([ + 'plugin' => new external_value(PARAM_INT, 'Gateway ID', VALUE_REQUIRED), + 'state' => new external_value(PARAM_INT, 'Enabled or disabled', VALUE_REQUIRED), + ]); + } + + public static function execute(int $plugin, int $state): array { + // Parameter validation. + [ + 'plugin' => $gatewayid, + 'state' => $state, + ] = self::validate_parameters(self::execute_parameters(), [ + 'plugin' => $plugin, + 'state' => $state, + ]); + + $context = context_system::instance(); + self::validate_context($context); + require_capability('moodle/site:config', $context); + + $result = [ + 'result' => true, + 'message' => '', + 'messagetype' => '', + ]; + $manager = \core\di::get(\core_sms\manager::class); + $gatewaymanagers = $manager->get_gateway_instances(['id' => $gatewayid]); + $gatewaymanager = reset($gatewaymanagers); + + if (!$gatewaymanager) { + $result = [ + 'result' => false, + 'message' => 'sms_gateway_not_found', + 'messagetype' => 'error' + ]; + return $result; + } + + if (!empty($state)) { + $manager->enable_gateway(gateway: $gatewaymanager); + $message = get_string('plugin_enabled', 'core_admin', $gatewaymanager->name); + $messagetype = \core\notification::SUCCESS; + } else { + $gatewayresult = $manager->disable_gateway(gateway: $gatewaymanager); + if ($gatewayresult->enabled) { + $result = [ + 'result' => false, + 'message' => 'sms_gateway_disable_failed', + 'messagetype' => 'error' + ]; + $message = get_string('sms_gateway_disable_failed', 'core_sms'); + $messagetype = \core\notification::ERROR; + } else { + $message = get_string('plugin_disabled', 'core_admin', $gatewaymanager->name); + $messagetype = \core\notification::SUCCESS; + } + } + + \core\notification::add($message, $messagetype); + + return $result; + } + + public static function execute_returns(): external_single_structure { + return new external_single_structure( + [ + 'result' => new external_value(PARAM_BOOL, 'Whether the status was changed, true or false'), + 'message' => new external_value(PARAM_TEXT, 'Messages'), + 'messagetype' => new external_value(PARAM_TEXT, 'Message type'), + ] + ); + } + +} diff --git a/sms/classes/form/sms_gateway_form.php b/sms/classes/form/sms_gateway_form.php new file mode 100644 index 00000000000..9f9265cda02 --- /dev/null +++ b/sms/classes/form/sms_gateway_form.php @@ -0,0 +1,121 @@ +. + +namespace core_sms\form; + +use moodleform; + +defined('MOODLE_INTERNAL') || die(); + +require_once($CFG->libdir . '/formslib.php'); + +/** + * SMS gateway instance form. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class sms_gateway_form extends moodleform { + + protected function definition() { + global $PAGE; + $PAGE->requires->js_call_amd('core_sms/smsgatewaychooser', 'init'); + + $mform = $this->_form; + $gatewayconfigs = $this->_customdata['gatewayconfigs'] ?? []; + $returnurl = $this->_customdata['returnurl'] ?? null; + + $smsplugins = []; + $smsgatewayplugins = \core\plugininfo\smsgateway::get_enabled_plugins(); + foreach ($smsgatewayplugins as $pluginname => $notusing) { + $plugin = 'smsgateway_' . $pluginname; + $smsplugins[$plugin] = get_string('pluginname', $plugin); + } + + $mform->addElement('static', 'information', get_string('sms_form_information', 'sms')); + + $mform->addElement( + 'select', + 'smsgateway', + get_string('select_sms_gateways', 'sms'), + $smsplugins, + ['data-smsgatewaychooser-field' => 'selector'], + ); + $mform->setDefault('smsgateway', 'smsgateway_aws'); + if (isset($gatewayconfigs->id)) { + $mform->hardFreeze('smsgateway'); + } + + $mform->addElement( + 'text', + 'name', + get_string('gateway_name', 'sms'), + 'maxlength="255" size="20"', + ); + $mform->setType('name', PARAM_TEXT); + $mform->addRule('name', get_string('required'), 'required', null, 'client'); + $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255); + + $mform->addElement( + 'text', + 'countrycode', + get_string('countrycode', 'sms'), + 'maxlength="255" size="20"', + ); + $mform->setType('countrycode', PARAM_TEXT); + $mform->setDefault( + elementName: 'countrycode', + defaultValue: 0, + ); + + $mform->addElement('static', 'information', ' ', get_string('countrycode_help', 'core_sms')); + + $mform->registerNoSubmitButton('updatesmsgateway'); + $mform->addElement( + 'submit', + 'updatesmsgateway', + 'update sms gateway', + ['data-smsgatewaychooser-field' => 'updateButton', 'class' => 'd-none'] + ); + + // Dispatch a hook for plugins to add their fields. + $hook = new \core_sms\hook\after_sms_gateway_form_hook( + mform: $mform, + plugin: $gatewayconfigs->smsgateway ?? 'smsgateway_aws', + ); + \core\di::get(\core\hook\manager::class)->dispatch($hook); + + // Form buttons. + $buttonarray = []; + $buttonarray[] = $mform->createElement('submit', 'saveandreturn', get_string('savechanges')); + $buttonarray[] = $mform->createElement('cancel'); + $mform->addGroup($buttonarray, 'buttonar', '', [' '], false); + $mform->closeHeaderBefore('buttonar'); + + if ($returnurl) { + $mform->addElement('hidden', 'returnurl', $returnurl); + $mform->setType('returnurl', PARAM_LOCALURL); + } + + if (isset($gatewayconfigs->id)) { + $mform->addElement('hidden', 'id', $gatewayconfigs->id); + $mform->setType('id', PARAM_INT); + } + + $this->set_data($gatewayconfigs); + } +} diff --git a/sms/classes/gateway.php b/sms/classes/gateway.php index 789db340aa1..22067dad9d9 100644 --- a/sms/classes/gateway.php +++ b/sms/classes/gateway.php @@ -18,33 +18,38 @@ namespace core_sms; use coding_exception; use Spatie\Cloneable\Cloneable; +use stdClass; /** - * Class gateway + * Class gateway. * * @package core_sms * @copyright 2024 Andrew Lyons * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @property-read int $id The id of the gateway in the database * @property-read bool $enabled Whether the gateway is enabled - * @property-read \stdClass $config The configuration for this instance + * @property-read stdClass $config The configuration for this instance + * @property string $name The name of the gateway config */ abstract class gateway { use Cloneable; - /** @var \stdClass The configuration for this instance */ - public readonly ?\stdClass $config; + /** @var stdClass The configuration for this instance */ + public readonly stdClass $config; /** * Create a new gateway. * * @param bool $enabled Whether the gateway is enabled + * @param string $name The name of the gateway config * @param string $config The configuration for this instance * @param int|null $id The id of the gateway in the database */ public function __construct( /** @var bool Whether the gateway is enabled */ public readonly bool $enabled, + /** @var string The name of the gateway config */ + public string $name, string $config, /** @var null|int The ID of the gateway in the database, or null if it has not been persisted yet */ public readonly ?int $id = null, @@ -55,11 +60,12 @@ abstract class gateway { /** * Convert this object to a stdClass. * - * @return \stdClass + * @return stdClass */ - public function to_record(): \stdClass { + public function to_record(): stdClass { return (object) [ 'id' => $this->id, + 'name' => $this->name, 'gateway' => get_class($this), 'enabled' => $this->enabled, 'config' => json_encode($this->config), diff --git a/sms/classes/hook/after_sms_gateway_form_hook.php b/sms/classes/hook/after_sms_gateway_form_hook.php new file mode 100644 index 00000000000..588b880faea --- /dev/null +++ b/sms/classes/hook/after_sms_gateway_form_hook.php @@ -0,0 +1,45 @@ +. + +namespace core_sms\hook; + +use MoodleQuickForm; + +/** + * Hook after sms gateway setup form is initiated. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @property-read MoodleQuickForm $mform The form element + * @property-read ?string $plugin Name of the plugin + */ +#[\core\attribute\label('Allows plugins or features to add form elements for sms gateway setup.')] +#[\core\attribute\tags('sms')] +class after_sms_gateway_form_hook { + + /** + * Constructor for the hook. + * + * @param MoodleQuickForm $mform The moodle form instance. + * @param ?string $plugin The name of the plugin + */ + public function __construct( + public readonly MoodleQuickForm $mform, + public readonly ?string $plugin, + ) { + } +} diff --git a/sms/classes/hook/before_gateway_deleted.php b/sms/classes/hook/before_gateway_deleted.php new file mode 100644 index 00000000000..d142bd0a329 --- /dev/null +++ b/sms/classes/hook/before_gateway_deleted.php @@ -0,0 +1,46 @@ +. + +namespace core_sms\hook; + +use core_sms\gateway; +use core\hook\stoppable_trait; + +/** + * Hook before sms gateway is deleted. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @property-read gateway $gateway The gateway instance + */ +#[\core\attribute\label('Allows plugins or features to check the usage of an SMS gateway before deleting the record.')] +#[\core\attribute\tags('sms')] +class before_gateway_deleted implements + \Psr\EventDispatcher\StoppableEventInterface { + + use stoppable_trait; + + /** + * Constructor for the hook. + * + * @param gateway $gateway The gateway instance. + */ + public function __construct( + public readonly gateway $gateway, + ) { + } +} diff --git a/sms/classes/hook/before_gateway_disabled.php b/sms/classes/hook/before_gateway_disabled.php new file mode 100644 index 00000000000..9288e20b1dd --- /dev/null +++ b/sms/classes/hook/before_gateway_disabled.php @@ -0,0 +1,46 @@ +. + +namespace core_sms\hook; + +use core_sms\gateway; +use core\hook\stoppable_trait; + +/** + * Hook before sms gateway is disabled. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @property-read gateway $gateway The gateway instance + */ +#[\core\attribute\label('Allows plugins or features to check the usage of an SMS gateway before disabling the gateway.')] +#[\core\attribute\tags('sms')] +class before_gateway_disabled implements + \Psr\EventDispatcher\StoppableEventInterface { + + use stoppable_trait; + + /** + * Constructor for the hook. + * + * @param gateway $gateway The gateway instance. + */ + public function __construct( + public readonly gateway $gateway, + ) { + } +} diff --git a/sms/classes/manager.php b/sms/classes/manager.php index 8fae2544d44..708b16bfd76 100644 --- a/sms/classes/manager.php +++ b/sms/classes/manager.php @@ -17,6 +17,7 @@ namespace core_sms; use Generator; +use stdClass; /** * SMS manager. @@ -50,6 +51,7 @@ class manager { * @param null|int $recipientuserid The user id of the recipient if one exists * @param bool $issensitive Whether this SMS contains sensitive information * @param bool $async Whether this SMS should be sent asynchronously. Note: sensitive messages cannot be sent async + * @param ?int $gatewayid the gateway instance id to send the sms in a specific gateway config * @return message * @throws \coding_exception If a sensitive message is sent asynchronously */ @@ -61,6 +63,7 @@ class manager { ?int $recipientuserid, bool $issensitive = false, bool $async = true, + ?int $gatewayid = null, ): message { $message = new message( recipientnumber: $recipientnumber, @@ -82,7 +85,7 @@ class manager { if (\core_text::strlen($content) > self::MESSAGE_LENGTH_LIMIT) { $message = $message->with(status: message_status::MESSAGE_OVER_SIZE); - } else if ($gateway = $this->get_gateway_for_message($message)) { + } else if ($gateway = $this->get_gateway_for_message($message, $gatewayid)) { $message = $message->with(gatewayid: $gateway->id); $message = $gateway->send( message: $message, @@ -116,12 +119,21 @@ class manager { /** * Get the gateway that can send the given message. * - * @param message $message + * @param message $message The message instance + * @param ?int $gatewayid the gateway instance id to send the sms in a specific gateway config * @return null|gateway */ public function get_gateway_for_message( message $message, + ?int $gatewayid = null, ): ?gateway { + if ($gatewayid) { + // Check if the gateway id is valid. + $gateway = $this->get_gateway_instances(['id' => $gatewayid]); + $gateway = $gateway ? reset($gateway) : null; + return $gateway; + } + $gateways = $this->get_possible_gateways_for_message($message); if (!count($gateways)) { return null; @@ -153,6 +165,7 @@ class manager { return new $record->gateway( id: $record->id, + name: $record->name, enabled: $record->enabled, config: $record->config, ); @@ -162,6 +175,19 @@ class manager { ); } + /** + * Get the gateway records according to the filter. + * + * @param array|null $filter The filterable elements to get the records from + * @return array + */ + public function get_gateway_records(?array $filter = null): array { + return $this->db->get_records( + table: 'sms_gateways', + conditions: $filter, + ); + } + /** * Get a list of all enabled gateway instances. * @@ -216,31 +242,67 @@ class manager { */ public function disable_gateway(gateway $gateway): gateway { if ($gateway->enabled) { - $gateway = $gateway->with(enabled: false); - $this->db->update_record('sms_gateways', $gateway->to_record()); + try { + $hook = new \core_sms\hook\before_gateway_disabled( + gateway: $gateway, + ); + $hookmanager = \core\di::get(\core\hook\manager::class)->dispatch($hook); + if (!$hookmanager->isPropagationStopped()) { + $gateway = $gateway->with(enabled: false); + $this->db->update_record('sms_gateways', $gateway->to_record()); + } + } catch (\dml_exception $e) { + } } return $gateway; } + /** + * Delete the gateway instance. + * + * @param gateway $gateway The gateway instance + * @return bool + */ + public function delete_gateway(gateway $gateway): bool { + try { + // Dispatch the hook before deleting the record. + $hook = new \core_sms\hook\before_gateway_deleted( + gateway: $gateway, + ); + $hookmanager = \core\di::get(\core\hook\manager::class)->dispatch($hook); + if ($hookmanager->isPropagationStopped()) { + $deleted = false; + } else { + $deleted = $this->db->delete_records('sms_gateways', ['id' => $gateway->id]); + } + } catch (\dml_exception $exception) { + $deleted = false; + } + return $deleted; + } + /** * Create a new gateway instance. * - * @param string $classname - * @param bool $enabled - * @param ?\stdClass $config + * @param string $classname Classname of the gateway + * @param string $name The name of the gateway config + * @param bool $enabled If the gateway is enabled or not + * @param stdClass|null $config The config json * @return gateway */ public function create_gateway_instance( string $classname, + string $name, bool $enabled = false, - ?\stdClass $config = null, + ?stdClass $config = null, ): gateway { if (!class_exists($classname) || !is_a($classname, gateway::class, true)) { throw new \coding_exception("Gateway class not valid: {$classname}"); } $gateway = new $classname( enabled: $enabled, + name: $name, config: $config ? json_encode($config) : '', ); @@ -249,6 +311,22 @@ class manager { return $gateway->with(id: $id); } + /** + * Update gateway instance. + * + * @param gateway $gateway The gateway instance + * @param stdClass|null $config the configuration of the gateway instance to be updated + * @return gateway + */ + public function update_gateway_instance( + gateway $gateway, + ?stdClass $config = null, + ): gateway { + $gateway = $gateway->with(config: $config, name: $gateway->name); + $this->db->update_record('sms_gateways', $gateway->to_record()); + return $gateway; + } + /** * Get all messages. * diff --git a/sms/classes/table/sms_gateway_table.php b/sms/classes/table/sms_gateway_table.php new file mode 100644 index 00000000000..d3f94340cca --- /dev/null +++ b/sms/classes/table/sms_gateway_table.php @@ -0,0 +1,274 @@ +. + +namespace core_sms\table; + +use context_system; +use core_table\dynamic as dynamic_table; +use flexible_table; +use moodle_url; +use stdClass; + +defined('MOODLE_INTERNAL') || die(); +require_once("{$CFG->libdir}/tablelib.php"); + +/** + * List sms gateway instances in a table. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class sms_gateway_table extends flexible_table implements dynamic_table { + + /** + * @var array $smsgateways List of gateway instances from the db. + */ + protected array $smsgateways = []; + + /** + * Constructor for the sms gateway table. + */ + public function __construct() { + parent::__construct($this->get_table_id()); + + $this->smsgateways = $this->get_sms_gateways(); + $this->setup_column_configuration(); + $this->set_filterset(new sms_gateway_table_filterset()); + $this->setup(); + } + + #[\Override] + public function get_context(): context_system { + return context_system::instance(); + } + + /** + * Get the js module needed for the table. + * + * This module can include table specific ajax calls etc. + * + * @return string + */ + protected function get_table_js_module(): string { + return 'core_admin/plugin_management_table'; + } + + #[\Override] + protected function get_dynamic_table_html_end(): string { + global $PAGE; + + $PAGE->requires->js_call_amd($this->get_table_js_module(), 'init'); + return parent::get_dynamic_table_html_end(); + } + + /** + * Setup the column configs for the table. + */ + protected function setup_column_configuration(): void { + $columnlist = $this->get_column_list(); + $this->define_columns(array_keys($columnlist)); + $this->define_headers(array_values($columnlist)); + } + + /** + * Get the columns for the table. + * + * @return array + */ + protected function get_column_list(): array { + return [ + 'name' => get_string('name'), + 'gateway' => get_string('gateway', 'sms'), + 'enabled' => get_string('status'), + 'actions' => get_string('actions', 'sms'), + ]; + } + + /** + * Get the table id for the table. + * + * @return string + */ + protected function get_table_id(): string { + return 'sms_gateways_table'; + } + + #[\Override] + public function guess_base_url(): void { + $this->define_baseurl(new moodle_url('/sms/sms_gateways.php')); + } + + /** + * Get the content of the table. + * + * @return string + */ + public function get_content(): string { + ob_start(); + $this->out(); + $content = ob_get_contents(); + ob_end_clean(); + return $content; + } + + /** + * Get the sms gateways from the manager. + * + * @return array + */ + protected function get_sms_gateways(): array { + $gateways = \core\di::get(\core_sms\manager::class)->get_gateway_records(); + if (!empty($gateways)) { + \core_collator::asort_objects_by_property($gateways, 'id'); + } + return $gateways; + } + + /** + * Add the row data for the table. + */ + public function out(): void { + foreach ($this->smsgateways as $gateway) { + $rowdata = (object) [ + 'id' => $gateway->id, + 'name' => $gateway->name, + 'gateway' => $gateway->gateway, + 'enabled' => (int)$gateway->enabled, + ]; + $this->add_data_keyed( + $this->format_row($rowdata), + $this->get_row_class($rowdata) + ); + } + + $this->finish_output(false); + } + + /** + * Get the class for row whether is dimmed or not according to enabled or disabled. + * + * @param stdClass $row The row object + * @return string + */ + protected function get_row_class(stdClass $row): string { + if ($row->enabled) { + return ''; + } + return 'dimmed_text'; + } + + /** + * The column for the gateway instance Name. + * + * @param stdClass $row The row object + * @return string + */ + public function col_name(stdClass $row): string { + return $row->name; + } + + /** + * The column for the Gateway plugin name. + * + * @param stdClass $row The row object + * @return string + */ + public function col_gateway(stdClass $row): string { + return $this->get_gateway_name($row->gateway); + } + + /** + * Get the gateway name according to the gateway class from db. + * + * @param string $gateway The name of the gateway + * @return string + */ + public function get_gateway_name(string $gateway): string { + $values = explode('\\', $gateway); + $gateway = $values[0]; + return get_string('pluginname', $gateway); + } + + /** + * Webservice for toggle. + * + * @return string + */ + protected function get_toggle_service(): string { + return 'core_sms_set_gateway_status'; + } + + /** + * The column for enabled or disabled status of the gateway instance. + * + * @param stdClass $row The row object + * @return string + */ + public function col_enabled(stdClass $row): string { + global $OUTPUT; + + $enabled = $row->enabled; + if ($enabled) { + $labelstr = get_string('disableplugin', 'core_admin', $row->name); + } else { + $labelstr = get_string('enableplugin', 'core_admin', $row->name); + } + + $params = [ + 'id' => 'sms-gateway-toggle-' . $row->id, + 'checked' => $enabled, + 'dataattributes' => [ + 'name' => 'id', + 'value' => $this->get_gateway_name($row->gateway), + 'toggle-method' => $this->get_toggle_service(), + 'action' => 'togglestate', + 'plugin' => $row->id, // Set plugin attribute to gateway ID. + 'state' => $enabled ? 1 : 0, + ], + 'title' => $labelstr, + 'label' => $labelstr, + 'labelclasses' => 'sr-only', + ]; + + return $OUTPUT->render_from_template('core_admin/setting_configtoggle', $params); + } + + /** + * The column to show the actions of the gateway instance. + * + * @param stdClass $row The row object. + * @return string + */ + public function col_actions(stdClass $row): string { + global $OUTPUT; + + $editurl = new moodle_url('/sms/configure.php', ['id' => $row->id]); + $deleteurl = new moodle_url('/sms/sms_gateways.php', ['id' => $row->id, 'action' => 'delete']); + + $templatecontext = [ + 'editurl' => $editurl->out(false), + 'deleteurl' => $deleteurl->out(false), + ]; + + return $OUTPUT->render_from_template('core_sms/sms_action_icons', $templatecontext); + } + + #[\Override] + public function has_capability(): bool { + return has_capability('moodle/site:config', $this->get_context()); + } +} diff --git a/sms/classes/table/sms_gateway_table_filterset.php b/sms/classes/table/sms_gateway_table_filterset.php new file mode 100644 index 00000000000..7478825b74d --- /dev/null +++ b/sms/classes/table/sms_gateway_table_filterset.php @@ -0,0 +1,27 @@ +. + +namespace core_sms\table; + +/** + * SMS gateway table filter set. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class sms_gateway_table_filterset extends \core_table\local\filter\filterset { +} diff --git a/sms/configure.php b/sms/configure.php new file mode 100644 index 00000000000..e2169323912 --- /dev/null +++ b/sms/configure.php @@ -0,0 +1,118 @@ +. + +/** + * Configure sms gateway for a given instance. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +require_once('../config.php'); + +require_login(); +$context = context_system::instance(); +require_capability('moodle/site:config', $context); + +$id = optional_param('id', null, PARAM_INT); +$gateway = optional_param('smsgateway', null, PARAM_PLUGIN); +$returnurl = optional_param('returnurl', null, PARAM_LOCALURL); + +$urlparams = []; +if ($id) { + $urlparams['id'] = $id; +} +if ($gateway) { + $urlparams['gateway'] = $gateway; +} + +$title = get_string('configure_sms_gateway', 'sms'); +$PAGE->set_context($context); +$PAGE->set_url('/sms/configure.php', $urlparams); +$PAGE->set_title($title); +$PAGE->set_heading($title); + +if (empty($returnurl)) { + $returnurl = new moodle_url('/sms/sms_gateways.php'); +} else { + $returnurl = new moodle_url($returnurl); +} +$data = [ + 'returnurl' => $returnurl, +]; + +if (!empty($gateway)) { + $configs = new stdClass(); + $configs->smsgateway = $gateway; + $data = [ + 'gatewayconfigs' => $configs, + ]; +} + +if (!empty($id)) { + $manager = \core\di::get(\core_sms\manager::class); + $gatewayrecord = $manager->get_gateway_records(['id' => $id]); + $gatewayrecord = reset($gatewayrecord); + $plugin = explode('\\', $gatewayrecord->gateway); + $plugin = $plugin[0]; + $configs = json_decode($gatewayrecord->config, true, 512, JSON_THROW_ON_ERROR); + $configs = (object) $configs; + $configs->smsgateway = $plugin; + $configs->id = $gatewayrecord->id; + $configs->name = $gatewayrecord->name; + $data = [ + 'gatewayconfigs' => $configs, + ]; +} + +$mform = new \core_sms\form\sms_gateway_form(customdata: $data); + +if ($mform->is_cancelled()) { + $data = $mform->get_data(); + if (isset($data->returnurl)) { + redirect($data->returnurl); + } else { + redirect($returnurl); + } +} + +if ($data = $mform->get_data()) { + $manager = \core\di::get(\core_sms\manager::class); + $smsgateway = $data->smsgateway; + $gatewayname = $data->name; + unset($data->smsgateway, $data->name, $data->id); + if (!empty($id)) { + $gatewayinstance = $manager->get_gateway_instances(['id' => $id]); + $gatewayinstance = reset($gatewayinstance); + $gatewayinstance->name = $gatewayname; + + $manager->update_gateway_instance($gatewayinstance, $data); + } else { + $classname = $smsgateway . '\\' . 'gateway'; + $manager->create_gateway_instance( + classname: $classname, + name: $gatewayname, + enabled: true, + config: $data, + ); + } + redirect($returnurl); +} + +echo $OUTPUT->header(); +$mform->display(); +echo $OUTPUT->footer(); diff --git a/sms/sms_gateways.php b/sms/sms_gateways.php new file mode 100644 index 00000000000..881d72d6296 --- /dev/null +++ b/sms/sms_gateways.php @@ -0,0 +1,94 @@ +. + +/** + * List sms gateway instances. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +use core\output\notification; + +require_once('../config.php'); +require_once($CFG->dirroot . '/lib/adminlib.php'); + +require_login(); +$context = context_system::instance(); +require_capability('moodle/site:config', $context); + +$id = optional_param('id', null, PARAM_INT); +$action = optional_param('action', '', PARAM_TEXT); +$confirm = optional_param('confirm', 0, PARAM_BOOL); + +// Set up the page. +$title = get_string('sms_gateways', 'sms'); +$returnurl = new moodle_url('/sms/sms_gateways.php'); +$PAGE->set_context($context); +$PAGE->set_url($returnurl); +$PAGE->set_title($title); +$PAGE->set_heading($title); + +admin_externalpage_setup('smsgateway'); +$PAGE->set_primary_active_tab('siteadminnode'); +$PAGE->navbar->add($title, $returnurl); + +if (!empty($id) && !empty($action)) { + $manager = \core\di::get(\core_sms\manager::class); + $gatewayrecord = $manager->get_gateway_records(['id' => $id]); + $gatewayrecord = reset($gatewayrecord); + $pluginname = explode('\\', $gatewayrecord->gateway); + $pluginname = $pluginname[0]; + $a = new stdClass(); + $a->gateway = get_string('pluginname', $pluginname); + $gateway = $manager->get_gateway_instances(['id' => $id]); + $gateway = reset($gateway); +} + +if ($action === 'delete') { + $PAGE->url->param('action', 'delete'); + if ($confirm && confirm_sesskey()) { + if ($manager->delete_gateway($gateway)) { + $message = get_string('sms_gateway_deleted', 'sms', $a); + $messagestyle = notification::NOTIFY_SUCCESS; + } else { + $message = get_string('sms_gateway_delete_failed', 'sms', $a); + $messagestyle = notification::NOTIFY_ERROR; + } + redirect($returnurl, $message, null, $messagestyle); + } + $strheading = get_string('delete_sms_gateway', 'sms'); + $PAGE->navbar->add($strheading); + $PAGE->set_title($strheading); + $PAGE->set_heading($strheading); + + echo $OUTPUT->header(); + $yesurl = new moodle_url($returnurl, ['id' => $id, 'action' => 'delete', 'confirm' => 1]); + $message = get_string('delete_sms_gateway_confirmation', 'sms', $a); + echo $OUTPUT->confirm($message, $yesurl, $returnurl); + echo $OUTPUT->footer(); + die; +} + +$table = new \core_sms\table\sms_gateway_table(); +$templatecontext = new stdClass(); +$templatecontext->tablehtml = $table->get_content(); +$templatecontext->createurl = new moodle_url('/sms/configure.php'); + +echo $OUTPUT->header(); +echo $OUTPUT->render_from_template('core_sms/sms_gateways', $templatecontext); +echo $OUTPUT->footer(); diff --git a/sms/templates/sms_action_icons.mustache b/sms/templates/sms_action_icons.mustache new file mode 100644 index 00000000000..5a2b90d6291 --- /dev/null +++ b/sms/templates/sms_action_icons.mustache @@ -0,0 +1,43 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template core_sms/sms_action_icons + Template for sms gateway actions icons. + Context variables required for this template: + * editurl - URL for the edit button + * deleteurl - URL for the delete button + Example context (json): + { + "editurl": "http://example.com/edit", + "deleteurl": "http://example.com/delete" + } +}} + + diff --git a/sms/templates/sms_gateways.mustache b/sms/templates/sms_gateways.mustache new file mode 100644 index 00000000000..d0081046fa5 --- /dev/null +++ b/sms/templates/sms_gateways.mustache @@ -0,0 +1,37 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template core_sms/sms_gateways + Template for sms gateways table. + Context variables required for this template: + * createurl - URL of the create button + * tablehtml - HTML of the table of sms gateway + Example context (json): + { + "createurl": "www.example.com", + "tablehtml": "
GatewayStatusActions
" + } +}} + + +
+ {{{tablehtml}}} +
diff --git a/sms/tests/behat/list_sms_gateways.feature b/sms/tests/behat/list_sms_gateways.feature new file mode 100644 index 00000000000..3bdf14ef77f --- /dev/null +++ b/sms/tests/behat/list_sms_gateways.feature @@ -0,0 +1,32 @@ +@sms +Feature: Access the SMS gateways page + In order to maintain SMS functionality + As an admin + I need to be able to view and manage SMS gateways + + Background: Manage the SMS gateways + Given the following "core_sms > sms_gateways" exist: + | name | classname | enabled | config | + | Default | smsgateway_aws\gateway | 1 | {"countrycode":"8802","gateway":"aws_sns"} | + | Europe | smsgateway_aws\gateway | 1 | {"countrycode":"+61","gateway":"aws_sns"} | + + @javascript + Scenario: An admin can manage the SMS gateways in the gateway management page + Given I log in as "admin" + And I navigate to "Plugins > SMS > Manage SMS gateways" in site administration + And I should see "SMS gateways" + And I should see "Create a new SMS gateway" + And I should see "Default" + And I should see "Europe" + And I should see "Disable Default" in the "Default" "table_row" + And I should see "Disable Europe" in the "Europe" "table_row" + When I toggle the "Disable Default" admin switch "off" + Then I should see "Default disabled" + And I should see "Enable Default" in the "Default" "table_row" + And I should see "Edit" in the "Default" "table_row" + And I should see "Delete" in the "Default" "table_row" + And I click on "Delete" "link" in the "Default" "table_row" + And I should see "Are you sure you want to delete the AWS SMS gateway?" + And I click on "Continue" "button" + And I should see "AWS SMS gateway has been deleted" + And I should not see "Default" diff --git a/sms/tests/external/sms_gateway_status_test.php b/sms/tests/external/sms_gateway_status_test.php new file mode 100644 index 00000000000..ff4f2384122 --- /dev/null +++ b/sms/tests/external/sms_gateway_status_test.php @@ -0,0 +1,83 @@ +. + +declare(strict_types=1); + +namespace core_sms\external; + +defined('MOODLE_INTERNAL') || die(); + +global $CFG; +require_once($CFG->dirroot . '/webservice/tests/helpers.php'); + +/** + * Test the webservice to change the status of a gateway. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @covers \core_sms\external\sms_gateway_status::execute + */ +class sms_gateway_status_test extends \externallib_advanced_testcase { + + public function test_execute(): void { + $this->resetAfterTest(); + $this->setAdminUser(); + + $config = (object) [ + 'data' => 'goeshere', + ]; + $dummy = $this->getMockBuilder(\core_sms\gateway::class) + ->setConstructorArgs([ + 'enabled' => true, + 'name' => 'dummy', + 'config' => json_encode($config), + ]) + ->onlyMethods(['get_send_priority', 'send']) + ->getMock(); + $dummygw = get_class($dummy); + + $manager = \core\di::get(\core_sms\manager::class); + $gateway = $manager->create_gateway_instance( + classname: $dummygw, + name: 'dummy', + enabled: true, + config: $config, + ); + + // Now let's disable the gateway. + sms_gateway_status::execute( + plugin: $gateway->id, + state: 0, + ); + $gatewaymanagers = $manager->get_gateway_instances( + filter: ['id' => $gateway->id], + ); + $gatewaymanager = reset($gatewaymanagers); + $this->assertFalse($gatewaymanager->enabled); + + // Let's enable again. + sms_gateway_status::execute( + plugin: $gateway->id, + state: 1, + ); + $gatewaymanagers = $manager->get_gateway_instances( + filter: ['id' => $gateway->id], + ); + $gatewaymanager = reset($gatewaymanagers); + $this->assertTrue($gatewaymanager->enabled); + } +} diff --git a/sms/tests/gateway_test.php b/sms/tests/gateway_test.php index a22665b9937..b66226d81ea 100644 --- a/sms/tests/gateway_test.php +++ b/sms/tests/gateway_test.php @@ -35,8 +35,21 @@ final class gateway_test extends \advanced_testcase { $this->resetAfterTest(); $manager = \core\di::get(\core_sms\manager::class); - $gw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); - $othergw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); + $config = new \stdClass(); + $config->api_key = 'test_api_key'; + + $gw = $manager->create_gateway_instance( + classname: \smsgateway_dummy\gateway::class, + name: 'dummy', + enabled: true, + config: $config, + ); + $othergw = $manager->create_gateway_instance( + classname: \smsgateway_dummy\gateway::class, + name: 'dummy', + enabled: true, + config: $config, + ); $message = new message( recipientnumber: '1234567890', diff --git a/sms/tests/generator/behat_core_sms_generator.php b/sms/tests/generator/behat_core_sms_generator.php new file mode 100644 index 00000000000..9c354ceb589 --- /dev/null +++ b/sms/tests/generator/behat_core_sms_generator.php @@ -0,0 +1,45 @@ +. + +/** + * Behat generator for SMS. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class behat_core_sms_generator extends behat_generator_base { + + /** + * Get the list of creatable entities for a core_sms. + * + * @return array + */ + protected function get_creatable_entities(): array { + return [ + 'sms_gateways' => [ + 'singular' => 'sms_gateway', + 'datagenerator' => 'sms_gateways', + 'required' => [ + 'classname', + 'name', + 'enabled', + 'config', + ], + ], + ]; + } +} diff --git a/sms/tests/generator/lib.php b/sms/tests/generator/lib.php new file mode 100644 index 00000000000..e22991746d9 --- /dev/null +++ b/sms/tests/generator/lib.php @@ -0,0 +1,45 @@ +. + +use core_sms\gateway; + +/** + * SMS data generator for tests. + * + * @package core_sms + * @copyright 2024 Safat Shahin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class core_sms_generator extends component_generator_base { + + /** + * Create sms gateway record. + * + * @param array $record The gateway record to be created. + * @return gateway + */ + public function create_sms_gateways(array $record): gateway { + $config = json_decode($record['config'], false, 512, JSON_THROW_ON_ERROR); + $manager = \core\di::get(\core_sms\manager::class); + $gateway = $manager->create_gateway_instance( + classname: $record['classname'], + name: $record['name'], + enabled: $record['enabled'], + config: $config, + ); + return $gateway; + } +} diff --git a/sms/tests/manager_test.php b/sms/tests/manager_test.php index 87aa87ca452..7737a8b6748 100644 --- a/sms/tests/manager_test.php +++ b/sms/tests/manager_test.php @@ -35,11 +35,15 @@ final class manager_test extends \advanced_testcase { public function test_gateway_manipulation(): void { $this->resetAfterTest(); + $config = (object) [ + 'data' => 'goeshere', + ]; $dummy = $this->getMockBuilder(\core_sms\gateway::class) ->setConstructorArgs([ 'enabled' => true, - 'config' => '', + 'name' => 'dummy', + 'config' => json_encode($config), ]) ->onlyMethods(['get_send_priority', 'send']) ->getMock(); @@ -48,10 +52,9 @@ final class manager_test extends \advanced_testcase { $manager = \core\di::get(\core_sms\manager::class); $gateway = $manager->create_gateway_instance( classname: $dummygw, - config: (object) [ - 'data' => 'goeshere', - ], + name: 'dummy', enabled: true, + config: $config, ); $this->assertIsInt($gateway->id); @@ -84,10 +87,11 @@ final class manager_test extends \advanced_testcase { $this->expectException(\coding_exception::class); $manager->create_gateway_instance( classname: \no\class\name\here::class, + name: 'dummy', + enabled: true, config: (object) [ 'data' => 'goeshere', ], - enabled: true, ); } @@ -97,10 +101,11 @@ final class manager_test extends \advanced_testcase { $this->expectException(\coding_exception::class); $manager->create_gateway_instance( classname: self::class, + name: 'dummy', + enabled: true, config: (object) [ 'data' => 'goeshere', ], - enabled: true, ); } @@ -111,10 +116,15 @@ final class manager_test extends \advanced_testcase { // We should prevent removal of gateways which hold any data, but if one has been removed, we should not fail. $this->resetAfterTest(); + $config = (object) [ + 'data' => 'goeshere', + ]; + $dummy = $this->getMockBuilder(\core_sms\gateway::class) ->setConstructorArgs([ 'enabled' => true, - 'config' => '', + 'name' => 'dummy', + 'config' => json_encode($config), ]) ->onlyMethods(['get_send_priority', 'send']) ->getMock(); @@ -123,17 +133,15 @@ final class manager_test extends \advanced_testcase { $manager = \core\di::get(\core_sms\manager::class); $gateway = $manager->create_gateway_instance( classname: $dummygw, - config: (object) [ - 'data' => 'goeshere', - ], + name: 'dummy', enabled: true, + config: $config, ); $uninstalledgateway = $manager->create_gateway_instance( classname: $dummygw, - config: (object) [ - 'data' => 'goeshere', - ], + name: 'dummy', enabled: true, + config: $config, ); $db = \core\di::get(\moodle_database::class); @@ -152,10 +160,15 @@ final class manager_test extends \advanced_testcase { public function test_multiple_gateway_instances(): void { $this->resetAfterTest(); + $config = (object) [ + 'data' => 'goeshere', + ]; + $dummy = $this->getMockBuilder(\core_sms\gateway::class) ->setConstructorArgs([ 'enabled' => true, - 'config' => '', + 'name' => 'dummy', + 'config' => json_encode($config), ]) ->onlyMethods(['get_send_priority', 'send']) ->setMockClassName('dummygateway') @@ -164,7 +177,8 @@ final class manager_test extends \advanced_testcase { $otherdummy = $this->getMockBuilder(\core_sms\gateway::class) ->setConstructorArgs([ 'enabled' => true, - 'config' => '', + 'name' => 'dummy', + 'config' => json_encode($config), ]) ->onlyMethods(['get_send_priority', 'send']) ->setMockClassName('otherdummygw') @@ -174,15 +188,20 @@ final class manager_test extends \advanced_testcase { $manager = \core\di::get(\core_sms\manager::class); $gatewaya = $manager->create_gateway_instance( classname: $dummygw, + name: 'dummy', enabled: true, + config: $config, ); $gatewayb = $manager->create_gateway_instance( classname: $otherdummygw, + name: 'dummy', enabled: true, + config: $config, ); $gatewayc = $manager->create_gateway_instance( classname: $dummygw, - enabled: false, + name: 'dummy', + config: $config, ); $this->assertNotEquals($gatewaya->id, $gatewayb->id); @@ -224,14 +243,14 @@ final class manager_test extends \advanced_testcase { $this->resetAfterTest(); $manager = \core\di::get(\core_sms\manager::class); - $ukgw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true, (object) [ + $ukgw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, 'dummy', true, (object) [ 'startswith' => (object) [ '+44' => 100, '+61' => 1, ], 'priority' => 0, ]); - $augw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true, (object) [ + $augw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, 'dummy', true, (object) [ 'startswith' => (object) [ '+44' => 1, '+61' => 100, @@ -322,8 +341,16 @@ final class manager_test extends \advanced_testcase { public function test_send(): void { $this->resetAfterTest(); + $config = new \stdClass(); + $config->priority = 50; + $manager = \core\di::get(\core_sms\manager::class); - $gw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); + $gw = $manager->create_gateway_instance( + classname: \smsgateway_dummy\gateway::class, + name: 'dummy', + enabled: true, + config: $config, + ); $message = $manager->send( recipientnumber: '+447123456789', @@ -350,7 +377,10 @@ final class manager_test extends \advanced_testcase { $this->resetAfterTest(); $manager = \core\di::get(\core_sms\manager::class); - $gw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, true); + $config = new \stdClass(); + $config->priority = 50; + + $gw = $manager->create_gateway_instance(\smsgateway_dummy\gateway::class, 'dummy', true, $config); $message = $manager->send( recipientnumber: '+447123456789', From cceed874fd2e8742cf8dca44177a8003737cfb06 Mon Sep 17 00:00:00 2001 From: Safat Date: Fri, 5 Jul 2024 16:38:46 +1000 Subject: [PATCH 09/12] MDL-81924 factor_sms: Remove leftover AWS implementation Originally implemented as MDL-80962. --- .upgradenotes/MDL-80962-2024071606510000.yml | 9 ++ .../mfa/factor/sms/classes/event/sms_sent.php | 62 ------- admin/tool/mfa/factor/sms/classes/factor.php | 9 +- .../sms/classes/local/smsgateway/aws_sns.php | 151 ------------------ .../local/smsgateway/gateway_interface.php | 53 ------ admin/tool/mfa/factor/sms/db/upgrade.php | 13 ++ .../mfa/factor/sms/lang/en/deprecated.txt | 15 ++ .../mfa/factor/sms/lang/en/factor_sms.php | 34 ++-- admin/tool/mfa/factor/sms/settings.php | 27 ---- admin/tool/mfa/factor/sms/version.php | 2 +- 10 files changed, 62 insertions(+), 313 deletions(-) create mode 100644 .upgradenotes/MDL-80962-2024071606510000.yml delete mode 100644 admin/tool/mfa/factor/sms/classes/event/sms_sent.php delete mode 100644 admin/tool/mfa/factor/sms/classes/local/smsgateway/aws_sns.php delete mode 100644 admin/tool/mfa/factor/sms/classes/local/smsgateway/gateway_interface.php create mode 100644 admin/tool/mfa/factor/sms/lang/en/deprecated.txt diff --git a/.upgradenotes/MDL-80962-2024071606510000.yml b/.upgradenotes/MDL-80962-2024071606510000.yml new file mode 100644 index 00000000000..7f5fe7f4582 --- /dev/null +++ b/.upgradenotes/MDL-80962-2024071606510000.yml @@ -0,0 +1,9 @@ +issueNumber: MDL-80962 +notes: + factor_sms: + - message: > + The following classes are removed as the SMS feature now takes advantage of core_sms API: + - sms_sent (admin/tool/mfa/factor/sms/classes/event/sms_sent.php) + - aws_sns (admin/tool/mfa/factor/sms/classes/local/smsgateway/aws_sns.php) + - gateway_interface (admin/tool/mfa/factor/sms/classes/local/smsgateway/gateway_interface.php) + type: removed diff --git a/admin/tool/mfa/factor/sms/classes/event/sms_sent.php b/admin/tool/mfa/factor/sms/classes/event/sms_sent.php deleted file mode 100644 index 3421fd161f2..00000000000 --- a/admin/tool/mfa/factor/sms/classes/event/sms_sent.php +++ /dev/null @@ -1,62 +0,0 @@ -. - -namespace factor_sms\event; - -/** - * Event for a sent SMS - * - * @package factor_sms - * @author Alex Morris - * @copyright Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class sms_sent extends \core\event\base { - - /** - * Init sms sent event - */ - protected function init() { - $this->data['crud'] = 'r'; - $this->data['edulevel'] = self::LEVEL_OTHER; - } - - /** - * Returns non-localised event description with id's for admin use only. - * - * @return string - */ - public function get_description(): string { - - $content = [ - 'userid' => $this->other['userid'], - 'debuginfo' => is_array($this->other['debug']) ? json_encode($this->other['debug']) : $this->other['debug'], - ]; - - return get_string('event:smssentdescription', 'factor_sms', $content); - } - - /** - * Returns localised general event name. - * - * Override in subclass, we can not make it static and abstract at the same time. - * - * @return string - */ - public static function get_name(): string { - return get_string('event:smssent', 'factor_sms'); - } -} diff --git a/admin/tool/mfa/factor/sms/classes/factor.php b/admin/tool/mfa/factor/sms/classes/factor.php index ef4329ee5b5..e51603b99a2 100644 --- a/admin/tool/mfa/factor/sms/classes/factor.php +++ b/admin/tool/mfa/factor/sms/classes/factor.php @@ -19,6 +19,7 @@ namespace factor_sms; use moodle_url; use stdClass; use tool_mfa\local\factor\object_factor_base; +use tool_mfa\local\secret_manager; /** * SMS Factor implementation. @@ -231,7 +232,7 @@ class factor extends object_factor_base { unset($SESSION->tool_mfa_sms_number); } // Clean temp secrets code. - $secretmanager = new \tool_mfa\local\secret_manager('sms'); + $secretmanager = new secret_manager('sms'); $secretmanager->cleanup_temp_secrets(); } @@ -424,7 +425,7 @@ class factor extends object_factor_base { * @return bool */ private function check_verification_code(string $enteredcode): bool { - return ($this->secretmanager->validate_secret($enteredcode) === \tool_mfa\local\secret_manager::VALID) ? true : false; + return $this->secretmanager->validate_secret($enteredcode) === secret_manager::VALID; } /** @@ -453,8 +454,8 @@ class factor extends object_factor_base { if (empty($phonenumber)) { return get_string('errorsmssent', 'factor_sms'); - } else { - return get_string('logindesc', 'factor_' . $this->name, $phonenumber); } + + return get_string('logindesc', 'factor_' . $this->name, $phonenumber); } } diff --git a/admin/tool/mfa/factor/sms/classes/local/smsgateway/aws_sns.php b/admin/tool/mfa/factor/sms/classes/local/smsgateway/aws_sns.php deleted file mode 100644 index d193ff6d053..00000000000 --- a/admin/tool/mfa/factor/sms/classes/local/smsgateway/aws_sns.php +++ /dev/null @@ -1,151 +0,0 @@ -. - -namespace factor_sms\local\smsgateway; - -use core\aws\admin_settings_aws_region; -use core\aws\aws_helper; -use factor_sms\event\sms_sent; - -/** - * AWS SNS SMS Gateway class - * - * @package factor_sms - * @author Peter Burnett - * @copyright Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class aws_sns implements gateway_interface { - - /** - * Create an instance of this class. - */ - public function __construct() { - global $CFG; - require_once($CFG->libdir . '/aws-sdk/src/functions.php'); - } - - /** - * Sends a message using the AWS SNS API - * - * @param string $messagecontent the content to send in the SMS message. - * @param string $phonenumber the destination for the message. - * @return bool true on message send success - */ - public function send_sms_message(string $messagecontent, string $phonenumber): bool { - global $SITE, $USER; - - $config = get_config('factor_sms'); - - // Setup client params and instantiate client. - $params = [ - 'version' => 'latest', - 'region' => $config->api_region, - 'http' => ['proxy' => aws_helper::get_proxy_string()], - ]; - if (!$config->usecredchain) { - $params['credentials'] = [ - 'key' => $config->api_key, - 'secret' => $config->api_secret, - ]; - } - $client = new \Aws\Sns\SnsClient($params); - - // Transform the phone number to international standard. - $phonenumber = \factor_sms\helper::format_number($phonenumber); - - // Setup the sender information. - $senderid = $SITE->shortname; - // Remove spaces and non-alphanumeric characters from ID. - $senderid = preg_replace("/[^A-Za-z0-9]/", '', trim($senderid)); - // We have to truncate the senderID to 11 chars. - $senderid = substr($senderid, 0, 11); - - if (defined('BEHAT_SITE_RUNNING')) { - // Fake SMS sending in behat. - return true; - } - - try { - // These messages need to be transactional. - $client->SetSMSAttributes([ - 'attributes' => [ - 'DefaultSMSType' => 'Transactional', - 'DefaultSenderID' => $senderid, - ], - ]); - - // Actually send the message. - $result = $client->publish([ - 'Message' => $messagecontent, - 'PhoneNumber' => $phonenumber, - ]); - - $data = [ - 'relateduserid' => null, - 'context' => \context_user::instance($USER->id), - 'other' => [ - 'userid' => $USER->id, - 'debug' => [ - 'messageid' => $result->get('MessageId'), - ], - ], - ]; - $event = sms_sent::create($data); - $event->trigger(); - - return true; - } catch (\Aws\Exception\AwsException $e) { - throw new \moodle_exception('errorawsconection', 'factor_sms', '', $e->getAwsErrorMessage()); - } - } - - /** - * Add gateway specific settings to the SMS factor settings page. - * - * @param \admin_settingpage $settings - * @return void - */ - public static function add_settings(\admin_settingpage $settings): void { - $settings->add(new \admin_setting_configcheckbox('factor_sms/usecredchain', - get_string('settings:aws:usecredchain', 'factor_sms'), '', 0)); - - if (!get_config('factor_sms', 'usecredchain')) { - // AWS Settings. - $settings->add(new \admin_setting_configtext('factor_sms/api_key', - get_string('settings:aws:key', 'factor_sms'), - get_string('settings:aws:key_help', 'factor_sms'), '')); - - $settings->add(new \admin_setting_configpasswordunmask('factor_sms/api_secret', - get_string('settings:aws:secret', 'factor_sms'), - get_string('settings:aws:secret_help', 'factor_sms'), '')); - } - - $settings->add(new admin_settings_aws_region('factor_sms/api_region', - get_string('settings:aws:region', 'factor_sms'), - get_string('settings:aws:region_help', 'factor_sms'), - 'ap-southeast-2')); - } - - /** - * Returns whether or not the gateway is enabled - * - * @return bool - */ - public static function is_gateway_enabled(): bool { - return true; - } -} diff --git a/admin/tool/mfa/factor/sms/classes/local/smsgateway/gateway_interface.php b/admin/tool/mfa/factor/sms/classes/local/smsgateway/gateway_interface.php deleted file mode 100644 index 56d83b4c9d9..00000000000 --- a/admin/tool/mfa/factor/sms/classes/local/smsgateway/gateway_interface.php +++ /dev/null @@ -1,53 +0,0 @@ -. - -/** - * SMS Gateway interface - * - * @package factor_sms - * @author Peter Burnett - * @copyright Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -namespace factor_sms\local\smsgateway; - -interface gateway_interface { - - /** - * Sends an SMS message - * - * @param string $messagecontent the content to send in the SMS message. - * @param string $phonenumber the destination for the message. - * @return bool true on message send success - */ - public function send_sms_message(string $messagecontent, string $phonenumber): bool; - - /** - * Add gateway specific settings to the SMS factor settings page. - * - * @param \admin_settingpage $settings - * @return void - */ - public static function add_settings(\admin_settingpage $settings): void; - - /** - * Returns whether or not the gateway is enabled - * - * @return bool - */ - public static function is_gateway_enabled(): bool; -} diff --git a/admin/tool/mfa/factor/sms/db/upgrade.php b/admin/tool/mfa/factor/sms/db/upgrade.php index 1b5794e7738..cee549f253a 100644 --- a/admin/tool/mfa/factor/sms/db/upgrade.php +++ b/admin/tool/mfa/factor/sms/db/upgrade.php @@ -60,5 +60,18 @@ function xmldb_factor_sms_upgrade(int $oldversion): bool { upgrade_plugin_savepoint(true, 2024082200, 'factor', 'sms'); } + if ($oldversion < 2024082201) { + // Unset the removed admin settings. + unset_config('countrycode', 'factor_sms'); + unset_config('gateway', 'factor_sms'); + unset_config('usecredchain', 'factor_sms'); + unset_config('api_key', 'factor_sms'); + unset_config('api_secret', 'factor_sms'); + unset_config('api_region', 'factor_sms'); + + // MFA savepoint reached. + upgrade_plugin_savepoint(true, 2024082201, 'factor', 'sms'); + } + return true; } diff --git a/admin/tool/mfa/factor/sms/lang/en/deprecated.txt b/admin/tool/mfa/factor/sms/lang/en/deprecated.txt new file mode 100644 index 00000000000..a169d428b21 --- /dev/null +++ b/admin/tool/mfa/factor/sms/lang/en/deprecated.txt @@ -0,0 +1,15 @@ +settings:countrycode,factor_sms +settings:countrycode_help,factor_sms +settings:aws,factor_sms +settings:aws:key,factor_sms +settings:aws:key_help,factor_sms +settings:aws:region,factor_sms +settings:aws:region_help,factor_sms +settings:aws:secret,factor_sms +settings:aws:secret_help,factor_sms +settings:aws:usecredchain,factor_sms +settings:gateway,factor_sms +settings:gateway_help,factor_sms +errorawsconection,factor_sms +event:smssentdescription,factor_sms +event:smssent,factor_sms diff --git a/admin/tool/mfa/factor/sms/lang/en/factor_sms.php b/admin/tool/mfa/factor/sms/lang/en/factor_sms.php index 6ef13e700e7..8106d09cdf3 100644 --- a/admin/tool/mfa/factor/sms/lang/en/factor_sms.php +++ b/admin/tool/mfa/factor/sms/lang/en/factor_sms.php @@ -29,13 +29,10 @@ $string['addnumber'] = 'Mobile number'; $string['clientnotfound'] = 'AWS service client not found. Client must be fully qualified classname e.g. \Aws\S3\S3Client.'; $string['editphonenumber'] = 'Edit phone number'; $string['editphonenumberinfo'] = 'If you didn\'t receive the code or entered the wrong number, please edit the number and try again.'; -$string['errorawsconection'] = 'Error connecting to AWS server: {$a}'; $string['errorsmssent'] = 'Error sending a SMS message containing your verification code.'; $string['error:emptyverification'] = 'Empty code. Try again.'; $string['error:wrongphonenumber'] = 'The phone number you provided is not in a valid format.'; $string['error:wrongverification'] = 'Wrong code. Try again.'; -$string['event:smssent'] = 'SMS message sent.'; -$string['event:smssentdescription'] = 'The user with ID {$a->userid} was sent a verification code via SMS. Information: {$a->debuginfo}'; $string['info'] = 'Have a verification code sent to the mobile number you choose.'; $string['logindesc'] = 'SMS message containing a 6-digit code sent to mobile number {$a}'; $string['loginoption'] = 'Have a code sent to your mobile phone'; @@ -51,18 +48,6 @@ $string['phonehelp'] = 'Enter your mobile number (including country code) to rec $string['pluginname'] = 'SMS mobile phone'; $string['privacy:metadata'] = 'The SMS mobile phone factor plugin does not store any personal data.'; $string['revokefactorconfirmation'] = 'Remove \'{$a}\' SMS?'; -$string['settings:aws'] = 'AWS SNS'; -$string['settings:aws:key'] = 'Key'; -$string['settings:aws:key_help'] = 'Amazon API key credential.'; -$string['settings:aws:region'] = 'Region'; -$string['settings:aws:region_help'] = 'Amazon API gateway region.'; -$string['settings:aws:secret'] = 'Secret'; -$string['settings:aws:secret_help'] = 'Amazon API secret credential.'; -$string['settings:aws:usecredchain'] = 'Find AWS credentials using the default credential provider chain'; -$string['settings:countrycode'] = 'Country number code'; -$string['settings:countrycode_help'] = 'The calling code without the leading + as a default if users do not enter an international number with a + prefix. - -See this link for a list of calling codes: {$a}'; $string['settings:duration'] = 'Validity duration'; $string['settings:duration_help'] = 'The period of time that the code is valid.'; $string['settings:gateway'] = 'SMS gateway'; @@ -81,3 +66,22 @@ $string['smsstring'] = '{$a->code} is your {$a->fullname} one-time security code @{$a->url} #{$a->code}'; $string['summarycondition'] = 'Using an SMS one-time security code'; + +// Deprecated since Moodle 4.5. +$string['settings:countrycode'] = 'Country number code'; +$string['settings:countrycode_help'] = 'The calling code without the leading + as a default if users do not enter an international number with a + prefix. + +See this link for a list of calling codes: {$a}'; +$string['settings:aws'] = 'AWS SNS'; +$string['settings:aws:key'] = 'Key'; +$string['settings:aws:key_help'] = 'Amazon API key credential.'; +$string['settings:aws:region'] = 'Region'; +$string['settings:aws:region_help'] = 'Amazon API gateway region.'; +$string['settings:aws:secret'] = 'Secret'; +$string['settings:aws:secret_help'] = 'Amazon API secret credential.'; +$string['settings:aws:usecredchain'] = 'Find AWS credentials using the default credential provider chain'; +$string['settings:gateway'] = 'SMS Gateway'; +$string['settings:gateway_help'] = 'The SMS provider you wish to send messages via'; +$string['errorawsconection'] = 'Error connecting to AWS server: {$a}'; +$string['event:smssentdescription'] = 'The user with ID {$a->userid} was sent a verification code via SMS. Information: {$a->debuginfo}'; +$string['event:smssent'] = 'SMS message sent.'; diff --git a/admin/tool/mfa/factor/sms/settings.php b/admin/tool/mfa/factor/sms/settings.php index 99c4df91156..8b0d8dfb604 100644 --- a/admin/tool/mfa/factor/sms/settings.php +++ b/admin/tool/mfa/factor/sms/settings.php @@ -117,30 +117,3 @@ if (count($gatewayrecords) > 0) { ), ); } - - -// TODO MDL-80962 Remove these settings, strings and associated codes (if any). -/* -$codeslink = 'https://en.wikipedia.org/wiki/List_of_country_calling_codes'; -$link = \html_writer::link($codeslink, $codeslink); - -$settings->add(new admin_setting_configtext('factor_sms/countrycode', - get_string('settings:countrycode', 'factor_sms'), - get_string('settings:countrycode_help', 'factor_sms', $link), '', PARAM_INT)); - -$gateways = [ - 'aws_sns' => get_string('settings:aws', 'factor_sms'), -]; - -$settings->add(new admin_setting_configselect('factor_sms/gateway', - get_string('settings:gateway', 'factor_sms'), - get_string('settings:gateway_help', 'factor_sms'), - 'aws_sns', $gateways)); - -if (empty(get_config('factor_sms', 'gateway'))) { - return; -} - -$class = '\factor_sms\local\smsgateway\\' . get_config('factor_sms', 'gateway'); -call_user_func($class . '::add_settings', $settings); -*/ diff --git a/admin/tool/mfa/factor/sms/version.php b/admin/tool/mfa/factor/sms/version.php index 5640b982039..728febefb8f 100644 --- a/admin/tool/mfa/factor/sms/version.php +++ b/admin/tool/mfa/factor/sms/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024082200; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2024082201; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2024041600; // Requires this Moodle version. $plugin->component = 'factor_sms'; // Full name of the plugin (used for diagnostics). $plugin->maturity = MATURITY_STABLE; From 310f5f50ee1a9dcebf1c4c0599db9a78438fafe8 Mon Sep 17 00:00:00 2001 From: Safat Date: Mon, 15 Jul 2024 14:47:56 +1000 Subject: [PATCH 10/12] MDL-81924 smsgateway_aws: Move SMS related methods to AWS plugin Originally implemented as MDL-80962. --- sms/gateway/aws/classes/helper.php | 29 +++++++++++++++++++ .../aws/classes/local/service/aws_sns.php | 4 +-- sms/gateway/aws/tests/helper_test.php | 22 ++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/sms/gateway/aws/classes/helper.php b/sms/gateway/aws/classes/helper.php index c90e171c6fc..0f8fda5d296 100644 --- a/sms/gateway/aws/classes/helper.php +++ b/sms/gateway/aws/classes/helper.php @@ -25,4 +25,33 @@ namespace smsgateway_aws; */ class helper { + /** + * This creates a proxy string suitable for use with the AWS SDK. + * + * @return string the string to use for proxy settings. + */ + public static function get_proxy_string(): string { + global $CFG; + $proxy = ''; + if (empty($CFG->proxytype)) { + return $proxy; + } + if ($CFG->proxytype === 'SOCKS5') { + // If it is a SOCKS proxy, append the protocol info. + $protocol = 'socks5://'; + } else { + $protocol = ''; + } + if (!empty($CFG->proxyhost)) { + $proxy = $CFG->proxyhost; + if (!empty($CFG->proxyport)) { + $proxy .= ':'. $CFG->proxyport; + } + if (!empty($CFG->proxyuser) && !empty($CFG->proxypassword)) { + $proxy = $protocol . $CFG->proxyuser . ':' . $CFG->proxypassword . '@' . $proxy; + } + } + return $proxy; + } + } diff --git a/sms/gateway/aws/classes/local/service/aws_sns.php b/sms/gateway/aws/classes/local/service/aws_sns.php index c4767f5b595..f1654c91132 100644 --- a/sms/gateway/aws/classes/local/service/aws_sns.php +++ b/sms/gateway/aws/classes/local/service/aws_sns.php @@ -16,8 +16,8 @@ namespace smsgateway_aws\local\service; -use core\aws\aws_helper; use core_sms\message_status; +use smsgateway_aws\helper; use smsgateway_aws\local\aws_sms_service_provider; use stdClass; @@ -51,7 +51,7 @@ class aws_sns implements aws_sms_service_provider { $params = [ 'version' => 'latest', 'region' => $config->api_region, - 'http' => ['proxy' => aws_helper::get_proxy_string()], + 'http' => ['proxy' => helper::get_proxy_string()], ]; if (!property_exists($config, 'usecredchain') || !$config->usecredchain) { $params['credentials'] = [ diff --git a/sms/gateway/aws/tests/helper_test.php b/sms/gateway/aws/tests/helper_test.php index 07a3dc361a0..9729422557b 100644 --- a/sms/gateway/aws/tests/helper_test.php +++ b/sms/gateway/aws/tests/helper_test.php @@ -76,4 +76,26 @@ class helper_test extends \advanced_testcase { $this->resetAfterTest(); $this->assertEquals($expected, \core_sms\manager::format_number($phonenumber, $countrycode)); } + + /** + * Test the proxy strings. + */ + public function test_get_proxy_string(): void { + global $CFG; + $this->resetAfterTest(); + // Confirm with no config an empty string is returned. + $CFG->proxyhost = ''; + $this->assertEquals('', helper::get_proxy_string()); + + // Now set some configs. + $CFG->proxyhost = '127.0.0.1'; + $CFG->proxyuser = 'user'; + $CFG->proxypassword = 'password'; + $CFG->proxyport = '1337'; + $this->assertEquals('user:password@127.0.0.1:1337', helper::get_proxy_string()); + + // Now change to SOCKS proxy. + $CFG->proxytype = 'SOCKS5'; + $this->assertEquals('socks5://user:password@127.0.0.1:1337', helper::get_proxy_string()); + } } From d5bdb07c28b1fe8ba8df46174e21f06c55c55261 Mon Sep 17 00:00:00 2001 From: Safat Date: Mon, 15 Jul 2024 14:48:43 +1000 Subject: [PATCH 11/12] MDL-81924 core: Remove unused AWS classes and tests Originally implemented as MDL-80962. --- .upgradenotes/MDL-80962-2024071606563987.yml | 9 +++ .upgradenotes/MDL-80962-2024071606591847.yml | 8 +++ lib/classes/aws/admin_settings_aws_region.php | 18 ++--- lib/classes/aws/aws_helper.php | 32 ++++++--- lib/classes/aws/client_factory.php | 18 ++--- .../aws/admin_settings_aws_region_test.php | 65 ------------------- lib/tests/aws/aws_helper_test.php | 59 ----------------- 7 files changed, 58 insertions(+), 151 deletions(-) create mode 100644 .upgradenotes/MDL-80962-2024071606563987.yml create mode 100644 .upgradenotes/MDL-80962-2024071606591847.yml delete mode 100644 lib/tests/aws/admin_settings_aws_region_test.php delete mode 100644 lib/tests/aws/aws_helper_test.php diff --git a/.upgradenotes/MDL-80962-2024071606563987.yml b/.upgradenotes/MDL-80962-2024071606563987.yml new file mode 100644 index 00000000000..12462365886 --- /dev/null +++ b/.upgradenotes/MDL-80962-2024071606563987.yml @@ -0,0 +1,9 @@ +issueNumber: MDL-80962 +notes: + core: + - message: > + The following classes are deprecated as they are handled by core_sms API and smsgateway_aws plugin: + - admin_settings_aws_region (lib/classes/aws/admin_settings_aws_region.php) + - aws_helper (lib/classes/aws/aws_helper.php) + - client_factory (lib/classes/aws/client_factory.php) + type: deprecated diff --git a/.upgradenotes/MDL-80962-2024071606591847.yml b/.upgradenotes/MDL-80962-2024071606591847.yml new file mode 100644 index 00000000000..06a15b914cb --- /dev/null +++ b/.upgradenotes/MDL-80962-2024071606591847.yml @@ -0,0 +1,8 @@ +issueNumber: MDL-80962 +notes: + core: + - message: > + The following test classes are removed as their base classes are deprecated: + - admin_settings_aws_region_test (lib/tests/aws/admin_settings_aws_region_test.php) + - aws_helper_test (lib/tests/aws/aws_helper_test.php) + type: removed diff --git a/lib/classes/aws/admin_settings_aws_region.php b/lib/classes/aws/admin_settings_aws_region.php index 4ff65cb8af8..388a597352c 100644 --- a/lib/classes/aws/admin_settings_aws_region.php +++ b/lib/classes/aws/admin_settings_aws_region.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * Admin setting for AWS regions. - * - * @package core - * @author Dmitrii Metelkin - * @copyright 2020 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace core\aws; defined('MOODLE_INTERNAL') || die(); @@ -35,6 +26,8 @@ require_once($CFG->dirroot . '/lib/adminlib.php'); * @package core * @copyright 2020 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @deprecated Since Moodle 4.5 + * @todo MDL-82459 Final deprecation in Moodle 5.0. */ class admin_settings_aws_region extends \admin_setting_configtext { @@ -44,8 +37,15 @@ class admin_settings_aws_region extends \admin_setting_configtext { * @param mixed $data array or string depending on setting * @param string $query * @return string + * @deprecated Since Moodle 4.5 */ + #[\core\attribute\deprecated( + 'admin_settings_aws_region::output_html()', + since: '4.5', + mdl: 'MDL-80962', + )] public function output_html($data, $query='') { + \core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]); global $CFG, $OUTPUT; $default = $this->get_defaultsetting(); diff --git a/lib/classes/aws/aws_helper.php b/lib/classes/aws/aws_helper.php index a9b1a5e317d..ce77bb6c5f8 100644 --- a/lib/classes/aws/aws_helper.php +++ b/lib/classes/aws/aws_helper.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * AWS helper class. Contains useful functions when interacting with the SDK. - * - * @package core - * @author Peter Burnett - * @copyright 2020 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace core\aws; use Aws\CommandInterface; @@ -34,6 +25,8 @@ use Psr\Http\Message\RequestInterface; * * @copyright 2020 Catalyst IT * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @deprecated Since Moodle 4.5 + * @todo MDL-82459 Final deprecation in Moodle 5.0. */ class aws_helper { @@ -41,8 +34,15 @@ class aws_helper { * This creates a proxy string suitable for use with the AWS SDK. * * @return string the string to use for proxy settings. + * @deprecated Since Moodle 4.5 */ + #[\core\attribute\deprecated( + 'aws_helper::get_proxy_string()', + since: '4.5', + mdl: 'MDL-80962', + )] public static function get_proxy_string(): string { + \core\deprecation::emit_deprecation_if_present(__FUNCTION__); global $CFG; $proxy = ''; if (empty($CFG->proxytype)) { @@ -71,8 +71,15 @@ class aws_helper { * * @param AwsClient $client * @return AwsClient + * @deprecated Since Moodle 4.5 */ + #[\core\attribute\deprecated( + 'aws_helper::configure_client_proxy()', + since: '4.5', + mdl: 'MDL-80962', + )] public static function configure_client_proxy(AwsClient $client): AwsClient { + \core\deprecation::emit_deprecation_if_present(__FUNCTION__); $client->getHandlerList()->appendBuild(self::add_proxy_when_required(), 'proxy_bypass'); return $client; } @@ -81,8 +88,15 @@ class aws_helper { * Generate a middleware higher order function to wrap the handler and append proxy configuration based on target. * * @return callable Middleware high order callable. + * @deprecated Since Moodle 4.5 */ + #[\core\attribute\deprecated( + 'aws_helper::add_proxy_when_required()', + since: '4.5', + mdl: 'MDL-80962', + )] protected static function add_proxy_when_required(): callable { + \core\deprecation::emit_deprecation_if_present(__FUNCTION__); return function (callable $fn) { return function (CommandInterface $command, ?RequestInterface $request = null) use ($fn) { if (isset($request)) { diff --git a/lib/classes/aws/client_factory.php b/lib/classes/aws/client_factory.php index 2b46a0dbd1f..206ad4654fc 100644 --- a/lib/classes/aws/client_factory.php +++ b/lib/classes/aws/client_factory.php @@ -14,15 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -/** - * AWS Client factory. Retrieves a client with moodle specific HTTP configuration. - * - * @package core - * @author Peter Burnett - * @copyright 2022 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - namespace core\aws; use Aws\AwsClient; @@ -32,6 +23,8 @@ use Aws\AwsClient; * @copyright 2022 Catalyst IT * @author Peter Burnett * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @deprecated Since Moodle 4.5 + * @todo MDL-82459 Final deprecation in Moodle 5.0. */ class client_factory { /** @@ -40,8 +33,15 @@ class client_factory { * @param string $class Fully qualified AWS classname e.g. \Aws\S3\S3Client * @param array $opts array of constructor options for AWS Client. * @return AwsClient + * @deprecated Since Moodle 4.5 */ + #[\core\attribute\deprecated( + 'client_factory::get_client()', + since: '4.5', + mdl: 'MDL-80962', + )] public static function get_client(string $class, array $opts): AwsClient { + \core\deprecation::emit_deprecation_if_present(__FUNCTION__); // Modify the opts to add HTTP timeouts. if (empty($opts['http'])) { $opts['http'] = ['connect_timeout' => HOURSECS]; diff --git a/lib/tests/aws/admin_settings_aws_region_test.php b/lib/tests/aws/admin_settings_aws_region_test.php deleted file mode 100644 index 4fc203e2be8..00000000000 --- a/lib/tests/aws/admin_settings_aws_region_test.php +++ /dev/null @@ -1,65 +0,0 @@ -. - -/** - * factor_sms unit tests. - * - * @package core - * @author Mikhail Golenkov - * @copyright 2020 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -namespace core\aws; - -/** - * Testcase for the list of AWS regions admin setting. - * - * @package core - * @author Mikhail Golenkov - * @copyright 2020 Catalyst IT - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @covers \core\aws\admin_settings_aws_region - */ -class admin_settings_aws_region_test extends \advanced_testcase { - - /** - * Cleanup after all tests are executed. - * - * @return void - */ - public function tearDown(): void { - $admin = admin_get_root(); - $admin->purge_children(true); - parent::tearDown(); - } - /** - * Test that output_html() method works and returns HTML string with expected content. - */ - public function test_output_html(): void { - $this->resetAfterTest(); - $setting = new admin_settings_aws_region('test_aws_region', - 'Test visible name', 'Test description', 'Test default setting'); - $html = $setting->output_html(''); - $this->assertTrue(str_contains($html, 'Test visible name')); - $this->assertTrue(str_contains($html, 'Test description')); - $this->assertTrue(str_contains($html, 'Default: Test default setting')); - $this->assertTrue(str_contains($html, - 'assertTrue(str_contains($html, '')); - $this->assertTrue(str_contains($html, '