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::TO; |
20
|
2
|
|
|
2
|
|
1244
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
225
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
20
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
49
|
|
23
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
54
|
|
24
|
2
|
|
|
2
|
|
15
|
use utf8; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
17
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230614174404; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1-$2', |
30
|
|
|
|
|
|
|
'leading_digits' => ' |
31
|
|
|
|
|
|
|
[2-4]| |
32
|
|
|
|
|
|
|
50| |
33
|
|
|
|
|
|
|
6[09]| |
34
|
|
|
|
|
|
|
7[0-24-69]| |
35
|
|
|
|
|
|
|
8[05] |
36
|
|
|
|
|
|
|
', |
37
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})' |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
'format' => '$1 $2', |
41
|
|
|
|
|
|
|
'pattern' => '(\\d{4})(\\d{3})' |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
'format' => '$1 $2', |
45
|
|
|
|
|
|
|
'leading_digits' => '[5-9]', |
46
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{4})' |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
]; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $validators = { |
51
|
|
|
|
|
|
|
'fixed_line' => ' |
52
|
|
|
|
|
|
|
(?: |
53
|
|
|
|
|
|
|
2\\d| |
54
|
|
|
|
|
|
|
3[0-8]| |
55
|
|
|
|
|
|
|
4[0-4]| |
56
|
|
|
|
|
|
|
50| |
57
|
|
|
|
|
|
|
6[09]| |
58
|
|
|
|
|
|
|
7[0-24-69]| |
59
|
|
|
|
|
|
|
8[05] |
60
|
|
|
|
|
|
|
)\\d{3} |
61
|
|
|
|
|
|
|
', |
62
|
|
|
|
|
|
|
'geographic' => ' |
63
|
|
|
|
|
|
|
(?: |
64
|
|
|
|
|
|
|
2\\d| |
65
|
|
|
|
|
|
|
3[0-8]| |
66
|
|
|
|
|
|
|
4[0-4]| |
67
|
|
|
|
|
|
|
50| |
68
|
|
|
|
|
|
|
6[09]| |
69
|
|
|
|
|
|
|
7[0-24-69]| |
70
|
|
|
|
|
|
|
8[05] |
71
|
|
|
|
|
|
|
)\\d{3} |
72
|
|
|
|
|
|
|
', |
73
|
|
|
|
|
|
|
'mobile' => ' |
74
|
|
|
|
|
|
|
(?: |
75
|
|
|
|
|
|
|
55[4-6]| |
76
|
|
|
|
|
|
|
6(?: |
77
|
|
|
|
|
|
|
[09]\\d| |
78
|
|
|
|
|
|
|
3[02]| |
79
|
|
|
|
|
|
|
8[15-9] |
80
|
|
|
|
|
|
|
)| |
81
|
|
|
|
|
|
|
(?: |
82
|
|
|
|
|
|
|
7\\d| |
83
|
|
|
|
|
|
|
8[46-9] |
84
|
|
|
|
|
|
|
)\\d| |
85
|
|
|
|
|
|
|
999 |
86
|
|
|
|
|
|
|
)\\d{4} |
87
|
|
|
|
|
|
|
', |
88
|
|
|
|
|
|
|
'pager' => '', |
89
|
|
|
|
|
|
|
'personal_number' => '', |
90
|
|
|
|
|
|
|
'specialrate' => '', |
91
|
|
|
|
|
|
|
'toll_free' => '0800\\d{3}', |
92
|
|
|
|
|
|
|
'voip' => '55[0-37-9]\\d{4}' |
93
|
|
|
|
|
|
|
}; |
94
|
|
|
|
|
|
|
my %areanames = (); |
95
|
|
|
|
|
|
|
$areanames{en} = {"67633", "Kolonga", |
96
|
|
|
|
|
|
|
"67640", "Kolovai", |
97
|
|
|
|
|
|
|
"67685", "Niuas", |
98
|
|
|
|
|
|
|
"67635", "Nakolo", |
99
|
|
|
|
|
|
|
"67679", "Vava\’u", |
100
|
|
|
|
|
|
|
"67636", "Nakolo", |
101
|
|
|
|
|
|
|
"67634", "Kolonga", |
102
|
|
|
|
|
|
|
"6762", "Nuku\'alofa", |
103
|
|
|
|
|
|
|
"67660", "Ha\’apai", |
104
|
|
|
|
|
|
|
"67672", "Vava\’u", |
105
|
|
|
|
|
|
|
"67637", "Vaini", |
106
|
|
|
|
|
|
|
"67671", "Vava\’u", |
107
|
|
|
|
|
|
|
"67643", "Matangiake", |
108
|
|
|
|
|
|
|
"67680", "Niuas", |
109
|
|
|
|
|
|
|
"67638", "Vaini", |
110
|
|
|
|
|
|
|
"67630", "Pea", |
111
|
|
|
|
|
|
|
"67670", "Vava\’u", |
112
|
|
|
|
|
|
|
"67632", "Muʻa", |
113
|
|
|
|
|
|
|
"67629", "Pea", |
114
|
|
|
|
|
|
|
"67631", "Muʻa", |
115
|
|
|
|
|
|
|
"67642", "Masilamea", |
116
|
|
|
|
|
|
|
"67674", "Vava\’u", |
117
|
|
|
|
|
|
|
"67650", "\‘Eua", |
118
|
|
|
|
|
|
|
"67641", "Masilamea", |
119
|
|
|
|
|
|
|
"67669", "Ha\’apai", |
120
|
|
|
|
|
|
|
"67675", "Vava\’u", |
121
|
|
|
|
|
|
|
"67676", "Vava\’u",}; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub new { |
124
|
13
|
|
|
13
|
1
|
34
|
my $class = shift; |
125
|
13
|
|
|
|
|
25
|
my $number = shift; |
126
|
13
|
|
|
|
|
80
|
$number =~ s/(^\+676|\D)//g; |
127
|
13
|
|
|
|
|
86
|
my $self = bless({ country_code => '676', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
128
|
13
|
100
|
|
|
|
100
|
return $self->is_valid() ? $self : undef; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
1; |