| 1 | # automatically generated file, don't edit | ||||||||||
| 2 | |||||||||||
| 3 | |||||||||||
| 4 | |||||||||||
| 5 | # Copyright 2026 David Cantrell, derived from data from libphonenumber | ||||||||||
| 6 | # http://code.google.com/p/libphonenumber/ | ||||||||||
| 7 | # | ||||||||||
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||
| 9 | # you may not use this file except in compliance with the License. | ||||||||||
| 10 | # You may obtain a copy of the License at | ||||||||||
| 11 | # | ||||||||||
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||
| 13 | # | ||||||||||
| 14 | # Unless required by applicable law or agreed to in writing, software | ||||||||||
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||
| 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||
| 17 | # See the License for the specific language governing permissions and | ||||||||||
| 18 | # limitations under the License. | ||||||||||
| 19 | package Number::Phone::StubCountry::PH; | ||||||||||
| 20 | 2 | ▶ | use base qw(Number::Phone::StubCountry); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 2 | our $VERSION = 1.20260904101551; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1 $2', | ||||||||||
| 30 | 'leading_digits' => '2', | ||||||||||
| 31 | 'national_rule' => '(0$1)', | ||||||||||
| 32 | 'pattern' => '(\\d)(\\d{5})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2', | ||||||||||
| 36 | 'leading_digits' => ' | ||||||||||
| 37 | 3(?: | ||||||||||
| 38 | 230| | ||||||||||
| 39 | 397| | ||||||||||
| 40 | 461 | ||||||||||
| 41 | )| | ||||||||||
| 42 | 4(?: | ||||||||||
| 43 | 2(?: | ||||||||||
| 44 | 35| | ||||||||||
| 45 | [46]4| | ||||||||||
| 46 | 51 | ||||||||||
| 47 | )| | ||||||||||
| 48 | 396| | ||||||||||
| 49 | 4(?: | ||||||||||
| 50 | 22| | ||||||||||
| 51 | 63 | ||||||||||
| 52 | )| | ||||||||||
| 53 | 59[347]| | ||||||||||
| 54 | 76[15] | ||||||||||
| 55 | )| | ||||||||||
| 56 | 5(?: | ||||||||||
| 57 | 221| | ||||||||||
| 58 | 446 | ||||||||||
| 59 | )| | ||||||||||
| 60 | 642[23]| | ||||||||||
| 61 | 8(?: | ||||||||||
| 62 | 622| | ||||||||||
| 63 | 8(?: | ||||||||||
| 64 | [24]2| | ||||||||||
| 65 | 5[13] | ||||||||||
| 66 | ) | ||||||||||
| 67 | ) | ||||||||||
| 68 | ', | ||||||||||
| 69 | 'national_rule' => '(0$1)', | ||||||||||
| 70 | 'pattern' => '(\\d{4})(\\d{4,6})' | ||||||||||
| 71 | }, | ||||||||||
| 72 | { | ||||||||||
| 73 | 'format' => '$1 $2', | ||||||||||
| 74 | 'leading_digits' => ' | ||||||||||
| 75 | 3469| | ||||||||||
| 76 | 4(?: | ||||||||||
| 77 | 279| | ||||||||||
| 78 | 9(?: | ||||||||||
| 79 | 30| | ||||||||||
| 80 | 56 | ||||||||||
| 81 | ) | ||||||||||
| 82 | )| | ||||||||||
| 83 | 8834 | ||||||||||
| 84 | ', | ||||||||||
| 85 | 'national_rule' => '(0$1)', | ||||||||||
| 86 | 'pattern' => '(\\d{5})(\\d{4})' | ||||||||||
| 87 | }, | ||||||||||
| 88 | { | ||||||||||
| 89 | 'format' => '$1 $2 $3', | ||||||||||
| 90 | 'leading_digits' => '2', | ||||||||||
| 91 | 'national_rule' => '(0$1)', | ||||||||||
| 92 | 'pattern' => '(\\d)(\\d{4})(\\d{4})' | ||||||||||
| 93 | }, | ||||||||||
| 94 | { | ||||||||||
| 95 | 'format' => '$1 $2 $3', | ||||||||||
| 96 | 'leading_digits' => ' | ||||||||||
| 97 | [3-7]| | ||||||||||
| 98 | 8[2-8] | ||||||||||
| 99 | ', | ||||||||||
| 100 | 'national_rule' => '(0$1)', | ||||||||||
| 101 | 'pattern' => '(\\d{2})(\\d{3})(\\d{4})' | ||||||||||
| 102 | }, | ||||||||||
| 103 | { | ||||||||||
| 104 | 'format' => '$1 $2 $3', | ||||||||||
| 105 | 'leading_digits' => '[89]', | ||||||||||
| 106 | 'national_rule' => '0$1', | ||||||||||
| 107 | 'pattern' => '(\\d{3})(\\d{3})(\\d{4})' | ||||||||||
| 108 | }, | ||||||||||
| 109 | { | ||||||||||
| 110 | 'format' => '$1 $2 $3', | ||||||||||
| 111 | 'leading_digits' => '1', | ||||||||||
| 112 | 'pattern' => '(\\d{4})(\\d{3})(\\d{4})' | ||||||||||
| 113 | }, | ||||||||||
| 114 | { | ||||||||||
| 115 | 'format' => '$1 $2 $3 $4', | ||||||||||
| 116 | 'leading_digits' => '1', | ||||||||||
| 117 | 'pattern' => '(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})' | ||||||||||
| 118 | } | ||||||||||
| 119 | ]; | ||||||||||
| 120 | |||||||||||
| 121 | 2 | my $validators = { | |||||||||
| 122 | 'fixed_line' => ' | ||||||||||
| 123 | (?: | ||||||||||
| 124 | (?: | ||||||||||
| 125 | 2[3-8]| | ||||||||||
| 126 | 3[2-68]| | ||||||||||
| 127 | 4[2-9]| | ||||||||||
| 128 | 5[2-6]| | ||||||||||
| 129 | 6[2-58]| | ||||||||||
| 130 | 7[24578] | ||||||||||
| 131 | )\\d{3}| | ||||||||||
| 132 | 88(?: | ||||||||||
| 133 | 22\\d\\d| | ||||||||||
| 134 | 42 | ||||||||||
| 135 | ) | ||||||||||
| 136 | )\\d{4}| | ||||||||||
| 137 | (?: | ||||||||||
| 138 | 2| | ||||||||||
| 139 | 8[2-8]\\d\\d | ||||||||||
| 140 | )\\d{5} | ||||||||||
| 141 | ', | ||||||||||
| 142 | 'geographic' => ' | ||||||||||
| 143 | (?: | ||||||||||
| 144 | (?: | ||||||||||
| 145 | 2[3-8]| | ||||||||||
| 146 | 3[2-68]| | ||||||||||
| 147 | 4[2-9]| | ||||||||||
| 148 | 5[2-6]| | ||||||||||
| 149 | 6[2-58]| | ||||||||||
| 150 | 7[24578] | ||||||||||
| 151 | )\\d{3}| | ||||||||||
| 152 | 88(?: | ||||||||||
| 153 | 22\\d\\d| | ||||||||||
| 154 | 42 | ||||||||||
| 155 | ) | ||||||||||
| 156 | )\\d{4}| | ||||||||||
| 157 | (?: | ||||||||||
| 158 | 2| | ||||||||||
| 159 | 8[2-8]\\d\\d | ||||||||||
| 160 | )\\d{5} | ||||||||||
| 161 | ', | ||||||||||
| 162 | 'mobile' => ' | ||||||||||
| 163 | (?: | ||||||||||
| 164 | 8(?: | ||||||||||
| 165 | 1[37]| | ||||||||||
| 166 | 9[5-8] | ||||||||||
| 167 | )| | ||||||||||
| 168 | 9(?: | ||||||||||
| 169 | 0[5-9]| | ||||||||||
| 170 | 1[0-24-9]| | ||||||||||
| 171 | [235-7]\\d| | ||||||||||
| 172 | 4[2-9]| | ||||||||||
| 173 | 8[135-9]| | ||||||||||
| 174 | 9[1-9] | ||||||||||
| 175 | ) | ||||||||||
| 176 | )\\d{7} | ||||||||||
| 177 | ', | ||||||||||
| 178 | 'pager' => '', | ||||||||||
| 179 | 'personal_number' => '', | ||||||||||
| 180 | 'specialrate' => '', | ||||||||||
| 181 | 'toll_free' => '1800\\d{7,9}', | ||||||||||
| 182 | 'voip' => '' | ||||||||||
| 183 | }; | ||||||||||
| 184 | 2 | my %areanames = (); | |||||||||
| 185 | 2 | $areanames{en} = {"6335", "Negros\ Oriental", | |||||||||
| 186 | "634593", "Pampanga", | ||||||||||
| 187 | "634765", "Zambales", | ||||||||||
| 188 | "6377", "Ilocos\ Sur\/Ilocos\ Norte", | ||||||||||
| 189 | "6348", "Palawan", | ||||||||||
| 190 | "6338", "Bohol", | ||||||||||
| 191 | "6372", "La\ Union", | ||||||||||
| 192 | "6384", "Davao\ del\ Norte", | ||||||||||
| 193 | "634244", "Quezon", | ||||||||||
| 194 | "635446", "Camarines\ Sur", | ||||||||||
| 195 | "634761", "Zambales", | ||||||||||
| 196 | "638834", "Misamis\ Occidental", | ||||||||||
| 197 | "6374", "Abra\/Benguet\/Kalinga\-Apayao\/Ifugao\/Mountain\ Province", | ||||||||||
| 198 | "6353", "Leyte", | ||||||||||
| 199 | "6382", "Davao\ del\ Sur\/Davao", | ||||||||||
| 200 | "634396", "Batangas", | ||||||||||
| 201 | "6363", "Lanao\ del\ Norte\/Lanao\ del\ Sur", | ||||||||||
| 202 | "6387", "Davao\ Oriental", | ||||||||||
| 203 | "6346", "Cavite", | ||||||||||
| 204 | "6336", "Antique\/Aklan\/Capiz", | ||||||||||
| 205 | "638853", "Bukidnon", | ||||||||||
| 206 | "633461", "Negros\ Occidental", | ||||||||||
| 207 | "6383", "South\ Cotabato", | ||||||||||
| 208 | "6362", "Zamboanga\ del\ Sur", | ||||||||||
| 209 | "635221", "Albay", | ||||||||||
| 210 | "634279", "Quezon", | ||||||||||
| 211 | "636422", "North\ Cotabato", | ||||||||||
| 212 | "634594", "Pampanga", | ||||||||||
| 213 | "636423", "North\ Cotabato", | ||||||||||
| 214 | "6385", "Agusan\ del\ Sur\/Agusan\ del\ Norte", | ||||||||||
| 215 | "6365", "Zamboanga\ del\ Norte\/Zamboanga\ del\ Sur", | ||||||||||
| 216 | "6355", "Western\ Samar", | ||||||||||
| 217 | "634251", "Quezon", | ||||||||||
| 218 | "638622", "Surigao\ del\ Sur", | ||||||||||
| 219 | "6332", "Cebu", | ||||||||||
| 220 | "638822", "Misamis\ Oriental", | ||||||||||
| 221 | "6378", "Isabela\/Quirino\/Batanes\/Nueva\ Vizcaya\/Cagayan\ Valley", | ||||||||||
| 222 | "638842", "Misamis\ Oriental", | ||||||||||
| 223 | "638851", "Bukidnon", | ||||||||||
| 224 | "634463", "Bulacan", | ||||||||||
| 225 | "634264", "Quezon", | ||||||||||
| 226 | "634422", "Bulacan", | ||||||||||
| 227 | "634597", "Pampanga", | ||||||||||
| 228 | "6333", "Iloilo", | ||||||||||
| 229 | "6356", "Sorsogon\/Masbate", | ||||||||||
| 230 | "634235", "Quezon", | ||||||||||
| 231 | "6375", "Pangasinan",}; | ||||||||||
| 232 | 2 | my $timezones = { | |||||||||
| 233 | '' => [ | ||||||||||
| 234 | 'Asia/Manila' | ||||||||||
| 235 | ] | ||||||||||
| 236 | }; | ||||||||||
| 237 | |||||||||||
| 238 | 10 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 239 | 10 | my $class = shift; | |||||||||
| 240 | 10 | my $number = shift; | |||||||||
| 241 | 10 | $number =~ s/(^\+63|\D)//g; | |||||||||
| 242 | 10 | my $self = bless({ country_code => '63', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 243 | 10 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 244 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 245 | 1 | $self = bless({ country_code => '63', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 246 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 247 | } | ||||||||||
| 248 | 2 | 1; | |||||||||