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
|
|
1105
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
212
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
24
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
66
|
|
23
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
52
|
|
24
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
18
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230614174404; |
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} = {"351277", "Idanha\-a\-Nova", |
122
|
|
|
|
|
|
|
"351289", "Faro", |
123
|
|
|
|
|
|
|
"351272", "Castelo\ Branco", |
124
|
|
|
|
|
|
|
"351271", "Guarda", |
125
|
|
|
|
|
|
|
"351282", "Portimão", |
126
|
|
|
|
|
|
|
"351279", "Moncorvo", |
127
|
|
|
|
|
|
|
"351281", "Tavira", |
128
|
|
|
|
|
|
|
"351249", "Torres\ Novas", |
129
|
|
|
|
|
|
|
"351278", "Mirandela", |
130
|
|
|
|
|
|
|
"351242", "Ponte\ de\ Sôr", |
131
|
|
|
|
|
|
|
"351235", "Arganil", |
132
|
|
|
|
|
|
|
"351234", "Aveiro", |
133
|
|
|
|
|
|
|
"351254", "Peso\ da\ Régua", |
134
|
|
|
|
|
|
|
"351255", "Penafiel", |
135
|
|
|
|
|
|
|
"351241", "Abrantes", |
136
|
|
|
|
|
|
|
"351265", "Setúbal", |
137
|
|
|
|
|
|
|
"351296", "Ponta\ Delgada", |
138
|
|
|
|
|
|
|
"35121", "Lisbon", |
139
|
|
|
|
|
|
|
"351291", "Funchal", |
140
|
|
|
|
|
|
|
"351292", "Horta", |
141
|
|
|
|
|
|
|
"351263", "Vila\ Franca\ de\ Xira", |
142
|
|
|
|
|
|
|
"351276", "Chaves", |
143
|
|
|
|
|
|
|
"351253", "Braga", |
144
|
|
|
|
|
|
|
"351233", "Figueira\ da\ Foz", |
145
|
|
|
|
|
|
|
"351286", "Castro\ Verde", |
146
|
|
|
|
|
|
|
"351285", "Moura", |
147
|
|
|
|
|
|
|
"351268", "Estremoz", |
148
|
|
|
|
|
|
|
"351284", "Beja", |
149
|
|
|
|
|
|
|
"351258", "Viana\ do\ Castelo", |
150
|
|
|
|
|
|
|
"351238", "Seia", |
151
|
|
|
|
|
|
|
"351274", "Proença\-a\-Nova", |
152
|
|
|
|
|
|
|
"351275", "Covilhã", |
153
|
|
|
|
|
|
|
"351257", "Braga", |
154
|
|
|
|
|
|
|
"351245", "Portalegre", |
155
|
|
|
|
|
|
|
"351232", "Viseu", |
156
|
|
|
|
|
|
|
"351244", "Leiria", |
157
|
|
|
|
|
|
|
"351261", "Torres\ Vedras", |
158
|
|
|
|
|
|
|
"351252", "V\.\ N\.\ de\ Famalicão", |
159
|
|
|
|
|
|
|
"351231", "Mealhada", |
160
|
|
|
|
|
|
|
"351251", "Valença", |
161
|
|
|
|
|
|
|
"351262", "Caldas\ da\ Rainha", |
162
|
|
|
|
|
|
|
"351239", "Coimbra", |
163
|
|
|
|
|
|
|
"351259", "Vila\ Real", |
164
|
|
|
|
|
|
|
"351269", "Santiago\ do\ Cacém", |
165
|
|
|
|
|
|
|
"351236", "Pombal", |
166
|
|
|
|
|
|
|
"351256", "S\.\ João\ da\ Madeira", |
167
|
|
|
|
|
|
|
"351273", "Bragança", |
168
|
|
|
|
|
|
|
"351295", "Angra\ do\ Heroísmo", |
169
|
|
|
|
|
|
|
"351266", "Évora", |
170
|
|
|
|
|
|
|
"35122", "Porto", |
171
|
|
|
|
|
|
|
"351283", "Odemira", |
172
|
|
|
|
|
|
|
"351243", "Santarém",}; |
173
|
|
|
|
|
|
|
$areanames{pt} = {"35121", "Lisboa",}; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub new { |
176
|
28
|
|
|
28
|
1
|
74
|
my $class = shift; |
177
|
28
|
|
|
|
|
51
|
my $number = shift; |
178
|
28
|
|
|
|
|
182
|
$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
|
|
|
|
151
|
return $self->is_valid() ? $self : undef; |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
1; |