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