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