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::BW; |
20
|
2
|
|
|
2
|
|
1172
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
228
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
48
|
|
23
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
60
|
|
24
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230614174401; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1 $2', |
30
|
|
|
|
|
|
|
'leading_digits' => '90', |
31
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{5})' |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
'format' => '$1 $2', |
35
|
|
|
|
|
|
|
'leading_digits' => ' |
36
|
|
|
|
|
|
|
[24-6]| |
37
|
|
|
|
|
|
|
3[15-79] |
38
|
|
|
|
|
|
|
', |
39
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{4})' |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
43
|
|
|
|
|
|
|
'leading_digits' => '[37]', |
44
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{3})' |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
48
|
|
|
|
|
|
|
'pattern' => '(\\d{4})(\\d{3})(\\d{3})' |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
52
|
|
|
|
|
|
|
'leading_digits' => '8', |
53
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{4})(\\d{3})' |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
]; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $validators = { |
58
|
|
|
|
|
|
|
'fixed_line' => ' |
59
|
|
|
|
|
|
|
(?: |
60
|
|
|
|
|
|
|
2(?: |
61
|
|
|
|
|
|
|
4[0-48]| |
62
|
|
|
|
|
|
|
6[0-24]| |
63
|
|
|
|
|
|
|
9[0578] |
64
|
|
|
|
|
|
|
)| |
65
|
|
|
|
|
|
|
3(?: |
66
|
|
|
|
|
|
|
1[0-35-9]| |
67
|
|
|
|
|
|
|
55| |
68
|
|
|
|
|
|
|
[69]\\d| |
69
|
|
|
|
|
|
|
7[013] |
70
|
|
|
|
|
|
|
)| |
71
|
|
|
|
|
|
|
4(?: |
72
|
|
|
|
|
|
|
6[03]| |
73
|
|
|
|
|
|
|
7[1267]| |
74
|
|
|
|
|
|
|
9[0-5] |
75
|
|
|
|
|
|
|
)| |
76
|
|
|
|
|
|
|
5(?: |
77
|
|
|
|
|
|
|
3[03489]| |
78
|
|
|
|
|
|
|
4[0489]| |
79
|
|
|
|
|
|
|
7[1-47]| |
80
|
|
|
|
|
|
|
88| |
81
|
|
|
|
|
|
|
9[0-49] |
82
|
|
|
|
|
|
|
)| |
83
|
|
|
|
|
|
|
6(?: |
84
|
|
|
|
|
|
|
2[1-35]| |
85
|
|
|
|
|
|
|
5[149]| |
86
|
|
|
|
|
|
|
8[067] |
87
|
|
|
|
|
|
|
) |
88
|
|
|
|
|
|
|
)\\d{4} |
89
|
|
|
|
|
|
|
', |
90
|
|
|
|
|
|
|
'geographic' => ' |
91
|
|
|
|
|
|
|
(?: |
92
|
|
|
|
|
|
|
2(?: |
93
|
|
|
|
|
|
|
4[0-48]| |
94
|
|
|
|
|
|
|
6[0-24]| |
95
|
|
|
|
|
|
|
9[0578] |
96
|
|
|
|
|
|
|
)| |
97
|
|
|
|
|
|
|
3(?: |
98
|
|
|
|
|
|
|
1[0-35-9]| |
99
|
|
|
|
|
|
|
55| |
100
|
|
|
|
|
|
|
[69]\\d| |
101
|
|
|
|
|
|
|
7[013] |
102
|
|
|
|
|
|
|
)| |
103
|
|
|
|
|
|
|
4(?: |
104
|
|
|
|
|
|
|
6[03]| |
105
|
|
|
|
|
|
|
7[1267]| |
106
|
|
|
|
|
|
|
9[0-5] |
107
|
|
|
|
|
|
|
)| |
108
|
|
|
|
|
|
|
5(?: |
109
|
|
|
|
|
|
|
3[03489]| |
110
|
|
|
|
|
|
|
4[0489]| |
111
|
|
|
|
|
|
|
7[1-47]| |
112
|
|
|
|
|
|
|
88| |
113
|
|
|
|
|
|
|
9[0-49] |
114
|
|
|
|
|
|
|
)| |
115
|
|
|
|
|
|
|
6(?: |
116
|
|
|
|
|
|
|
2[1-35]| |
117
|
|
|
|
|
|
|
5[149]| |
118
|
|
|
|
|
|
|
8[067] |
119
|
|
|
|
|
|
|
) |
120
|
|
|
|
|
|
|
)\\d{4} |
121
|
|
|
|
|
|
|
', |
122
|
|
|
|
|
|
|
'mobile' => ' |
123
|
|
|
|
|
|
|
(?: |
124
|
|
|
|
|
|
|
321| |
125
|
|
|
|
|
|
|
7(?: |
126
|
|
|
|
|
|
|
[1-7]\\d| |
127
|
|
|
|
|
|
|
8[0-4] |
128
|
|
|
|
|
|
|
) |
129
|
|
|
|
|
|
|
)\\d{5} |
130
|
|
|
|
|
|
|
', |
131
|
|
|
|
|
|
|
'pager' => '', |
132
|
|
|
|
|
|
|
'personal_number' => '', |
133
|
|
|
|
|
|
|
'specialrate' => '(90\\d{5})', |
134
|
|
|
|
|
|
|
'toll_free' => ' |
135
|
|
|
|
|
|
|
(?: |
136
|
|
|
|
|
|
|
0800| |
137
|
|
|
|
|
|
|
800\\d |
138
|
|
|
|
|
|
|
)\\d{6} |
139
|
|
|
|
|
|
|
', |
140
|
|
|
|
|
|
|
'voip' => ' |
141
|
|
|
|
|
|
|
79(?: |
142
|
|
|
|
|
|
|
1(?: |
143
|
|
|
|
|
|
|
[01]\\d| |
144
|
|
|
|
|
|
|
2[0-7] |
145
|
|
|
|
|
|
|
)| |
146
|
|
|
|
|
|
|
2[0-7]\\d |
147
|
|
|
|
|
|
|
)\\d{3} |
148
|
|
|
|
|
|
|
' |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
my %areanames = (); |
151
|
|
|
|
|
|
|
$areanames{en} = {"26726", "Selebi\-Phikwe", |
152
|
|
|
|
|
|
|
"26768", "Maun", |
153
|
|
|
|
|
|
|
"267654", "Kgalagadi", |
154
|
|
|
|
|
|
|
"267659", "Gantsi", |
155
|
|
|
|
|
|
|
"26759", "Molepolole", |
156
|
|
|
|
|
|
|
"267651", "Kgalagadi", |
157
|
|
|
|
|
|
|
"267533", "Lobatse", |
158
|
|
|
|
|
|
|
"26746", "Serowe", |
159
|
|
|
|
|
|
|
"26724", "Francistown", |
160
|
|
|
|
|
|
|
"267313", "Gaborone", |
161
|
|
|
|
|
|
|
"267371", "Gaborone", |
162
|
|
|
|
|
|
|
"26735", "Gaborone", |
163
|
|
|
|
|
|
|
"267370", "Gaborone", |
164
|
|
|
|
|
|
|
"26736", "Gaborone", |
165
|
|
|
|
|
|
|
"267316", "Gaborone", |
166
|
|
|
|
|
|
|
"26747", "Mahalapye", |
167
|
|
|
|
|
|
|
"267393", "Gaborone", |
168
|
|
|
|
|
|
|
"26758", "Jwaneng", |
169
|
|
|
|
|
|
|
"267319", "Gaborone", |
170
|
|
|
|
|
|
|
"267315", "Gaborone", |
171
|
|
|
|
|
|
|
"267539", "Ramotswa", |
172
|
|
|
|
|
|
|
"267534", "Lobatse", |
173
|
|
|
|
|
|
|
"267312", "Gaborone", |
174
|
|
|
|
|
|
|
"26757", "Mochudi", |
175
|
|
|
|
|
|
|
"267530", "Lobatse", |
176
|
|
|
|
|
|
|
"267317", "Gaborone", |
177
|
|
|
|
|
|
|
"267310", "Gaborone\ \(outer\)", |
178
|
|
|
|
|
|
|
"26754", "Barolong\/Ngwaketse", |
179
|
|
|
|
|
|
|
"267394", "Gaborone", |
180
|
|
|
|
|
|
|
"267395", "Gaborone", |
181
|
|
|
|
|
|
|
"26762", "Kasane", |
182
|
|
|
|
|
|
|
"26749", "Palapye", |
183
|
|
|
|
|
|
|
"267392", "Gaborone", |
184
|
|
|
|
|
|
|
"26729", "Letlhakane\/Orapa", |
185
|
|
|
|
|
|
|
"267538", "Ramotswa", |
186
|
|
|
|
|
|
|
"267397", "Gaborone", |
187
|
|
|
|
|
|
|
"267391", "Gaborone", |
188
|
|
|
|
|
|
|
"267390", "Gaborone", |
189
|
|
|
|
|
|
|
"267318", "Gaborone",}; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub new { |
192
|
16
|
|
|
16
|
1
|
40
|
my $class = shift; |
193
|
16
|
|
|
|
|
26
|
my $number = shift; |
194
|
16
|
|
|
|
|
96
|
$number =~ s/(^\+267|\D)//g; |
195
|
16
|
|
|
|
|
98
|
my $self = bless({ country_code => '267', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
196
|
16
|
100
|
|
|
|
84
|
return $self->is_valid() ? $self : undef; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
1; |