line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# automatically generated file, don't edit |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Copyright 2023 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::PT; |
20
|
2
|
|
|
2
|
|
1108
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
241
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
51
|
|
23
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
55
|
|
24
|
2
|
|
|
2
|
|
14
|
use utf8; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
12
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230903131448; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
30
|
|
|
|
|
|
|
'leading_digits' => '2[12]', |
31
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{4})' |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
35
|
|
|
|
|
|
|
'leading_digits' => ' |
36
|
|
|
|
|
|
|
16| |
37
|
|
|
|
|
|
|
[236-9] |
38
|
|
|
|
|
|
|
', |
39
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{3})(\\d{3})' |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
]; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $validators = { |
44
|
|
|
|
|
|
|
'fixed_line' => ' |
45
|
|
|
|
|
|
|
2(?: |
46
|
|
|
|
|
|
|
[12]\\d| |
47
|
|
|
|
|
|
|
3[1-689]| |
48
|
|
|
|
|
|
|
4[1-59]| |
49
|
|
|
|
|
|
|
[57][1-9]| |
50
|
|
|
|
|
|
|
6[1-35689]| |
51
|
|
|
|
|
|
|
8[1-69]| |
52
|
|
|
|
|
|
|
9[1256] |
53
|
|
|
|
|
|
|
)\\d{6} |
54
|
|
|
|
|
|
|
', |
55
|
|
|
|
|
|
|
'geographic' => ' |
56
|
|
|
|
|
|
|
2(?: |
57
|
|
|
|
|
|
|
[12]\\d| |
58
|
|
|
|
|
|
|
3[1-689]| |
59
|
|
|
|
|
|
|
4[1-59]| |
60
|
|
|
|
|
|
|
[57][1-9]| |
61
|
|
|
|
|
|
|
6[1-35689]| |
62
|
|
|
|
|
|
|
8[1-69]| |
63
|
|
|
|
|
|
|
9[1256] |
64
|
|
|
|
|
|
|
)\\d{6} |
65
|
|
|
|
|
|
|
', |
66
|
|
|
|
|
|
|
'mobile' => ' |
67
|
|
|
|
|
|
|
6(?: |
68
|
|
|
|
|
|
|
[06]92(?: |
69
|
|
|
|
|
|
|
30| |
70
|
|
|
|
|
|
|
9\\d |
71
|
|
|
|
|
|
|
)| |
72
|
|
|
|
|
|
|
[35]92(?: |
73
|
|
|
|
|
|
|
3[03]| |
74
|
|
|
|
|
|
|
9\\d |
75
|
|
|
|
|
|
|
) |
76
|
|
|
|
|
|
|
)\\d{3}| |
77
|
|
|
|
|
|
|
(?: |
78
|
|
|
|
|
|
|
(?: |
79
|
|
|
|
|
|
|
16| |
80
|
|
|
|
|
|
|
6[0356] |
81
|
|
|
|
|
|
|
)93| |
82
|
|
|
|
|
|
|
9(?: |
83
|
|
|
|
|
|
|
[1-36]\\d\\d| |
84
|
|
|
|
|
|
|
480 |
85
|
|
|
|
|
|
|
) |
86
|
|
|
|
|
|
|
)\\d{5} |
87
|
|
|
|
|
|
|
', |
88
|
|
|
|
|
|
|
'pager' => '6222\\d{5}', |
89
|
|
|
|
|
|
|
'personal_number' => '884[0-4689]\\d{5}', |
90
|
|
|
|
|
|
|
'specialrate' => '( |
91
|
|
|
|
|
|
|
80(?: |
92
|
|
|
|
|
|
|
8\\d| |
93
|
|
|
|
|
|
|
9[1579] |
94
|
|
|
|
|
|
|
)\\d{5} |
95
|
|
|
|
|
|
|
)|( |
96
|
|
|
|
|
|
|
(?: |
97
|
|
|
|
|
|
|
6(?: |
98
|
|
|
|
|
|
|
0[178]| |
99
|
|
|
|
|
|
|
4[68] |
100
|
|
|
|
|
|
|
)\\d| |
101
|
|
|
|
|
|
|
76(?: |
102
|
|
|
|
|
|
|
0[1-57]| |
103
|
|
|
|
|
|
|
1[2-47]| |
104
|
|
|
|
|
|
|
2[237] |
105
|
|
|
|
|
|
|
) |
106
|
|
|
|
|
|
|
)\\d{5} |
107
|
|
|
|
|
|
|
)|( |
108
|
|
|
|
|
|
|
70(?: |
109
|
|
|
|
|
|
|
38[01]| |
110
|
|
|
|
|
|
|
596| |
111
|
|
|
|
|
|
|
(?: |
112
|
|
|
|
|
|
|
7\\d| |
113
|
|
|
|
|
|
|
8[17] |
114
|
|
|
|
|
|
|
)\\d |
115
|
|
|
|
|
|
|
)\\d{4} |
116
|
|
|
|
|
|
|
)', |
117
|
|
|
|
|
|
|
'toll_free' => '80[02]\\d{6}', |
118
|
|
|
|
|
|
|
'voip' => '30\\d{7}' |
119
|
|
|
|
|
|
|
}; |
120
|
|
|
|
|
|
|
my %areanames = (); |
121
|
|
|
|
|
|
|
$areanames{en} = {"351255", "Penafiel", |
122
|
|
|
|
|
|
|
"351272", "Castelo\ Branco", |
123
|
|
|
|
|
|
|
"351251", "Valença", |
124
|
|
|
|
|
|
|
"351254", "Peso\ da\ Régua", |
125
|
|
|
|
|
|
|
"351258", "Viana\ do\ Castelo", |
126
|
|
|
|
|
|
|
"351259", "Vila\ Real", |
127
|
|
|
|
|
|
|
"351277", "Idanha\-a\-Nova", |
128
|
|
|
|
|
|
|
"351253", "Braga", |
129
|
|
|
|
|
|
|
"351256", "S\.\ João\ da\ Madeira", |
130
|
|
|
|
|
|
|
"351262", "Caldas\ da\ Rainha", |
131
|
|
|
|
|
|
|
"351268", "Estremoz", |
132
|
|
|
|
|
|
|
"351275", "Covilhã", |
133
|
|
|
|
|
|
|
"351269", "Santiago\ do\ Cacém", |
134
|
|
|
|
|
|
|
"351274", "Proença\-a\-Nova", |
135
|
|
|
|
|
|
|
"351263", "Vila\ Franca\ de\ Xira", |
136
|
|
|
|
|
|
|
"351266", "Évora", |
137
|
|
|
|
|
|
|
"351252", "V\.\ N\.\ de\ Famalicão", |
138
|
|
|
|
|
|
|
"351271", "Guarda", |
139
|
|
|
|
|
|
|
"351279", "Moncorvo", |
140
|
|
|
|
|
|
|
"351265", "Setúbal", |
141
|
|
|
|
|
|
|
"351278", "Mirandela", |
142
|
|
|
|
|
|
|
"351273", "Bragança", |
143
|
|
|
|
|
|
|
"351276", "Chaves", |
144
|
|
|
|
|
|
|
"351261", "Torres\ Vedras", |
145
|
|
|
|
|
|
|
"351257", "Braga", |
146
|
|
|
|
|
|
|
"351296", "Ponta\ Delgada", |
147
|
|
|
|
|
|
|
"351242", "Ponte\ de\ Sôr", |
148
|
|
|
|
|
|
|
"351232", "Viseu", |
149
|
|
|
|
|
|
|
"351291", "Funchal", |
150
|
|
|
|
|
|
|
"351295", "Angra\ do\ Heroísmo", |
151
|
|
|
|
|
|
|
"351282", "Portimão", |
152
|
|
|
|
|
|
|
"351241", "Abrantes", |
153
|
|
|
|
|
|
|
"35122", "Porto", |
154
|
|
|
|
|
|
|
"35121", "Lisbon", |
155
|
|
|
|
|
|
|
"351236", "Pombal", |
156
|
|
|
|
|
|
|
"351233", "Figueira\ da\ Foz", |
157
|
|
|
|
|
|
|
"351289", "Faro", |
158
|
|
|
|
|
|
|
"351244", "Leiria", |
159
|
|
|
|
|
|
|
"351238", "Seia", |
160
|
|
|
|
|
|
|
"351245", "Portalegre", |
161
|
|
|
|
|
|
|
"351239", "Coimbra", |
162
|
|
|
|
|
|
|
"351286", "Castro\ Verde", |
163
|
|
|
|
|
|
|
"351283", "Odemira", |
164
|
|
|
|
|
|
|
"351292", "Horta", |
165
|
|
|
|
|
|
|
"351285", "Moura", |
166
|
|
|
|
|
|
|
"351231", "Mealhada", |
167
|
|
|
|
|
|
|
"351234", "Aveiro", |
168
|
|
|
|
|
|
|
"351243", "Santarém", |
169
|
|
|
|
|
|
|
"351235", "Arganil", |
170
|
|
|
|
|
|
|
"351281", "Tavira", |
171
|
|
|
|
|
|
|
"351284", "Beja", |
172
|
|
|
|
|
|
|
"351249", "Torres\ Novas",}; |
173
|
|
|
|
|
|
|
$areanames{pt} = {"35121", "Lisboa",}; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub new { |
176
|
28
|
|
|
28
|
1
|
64
|
my $class = shift; |
177
|
28
|
|
|
|
|
48
|
my $number = shift; |
178
|
28
|
|
|
|
|
190
|
$number =~ s/(^\+351|\D)//g; |
179
|
28
|
|
|
|
|
167
|
my $self = bless({ country_code => '351', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
180
|
28
|
100
|
|
|
|
144
|
return $self->is_valid() ? $self : undef; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
1; |