| 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::GH; |
|
20
|
2
|
|
|
2
|
|
1349
|
use base qw(Number::Phone::StubCountry); |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
270
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
16
|
use strict; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
54
|
|
|
23
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
9
|
|
|
|
2
|
|
|
|
|
61
|
|
|
24
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
35
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230307181420; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
|
|
|
|
|
|
'format' => '$1 $2', |
|
30
|
|
|
|
|
|
|
'intl_format' => 'NA', |
|
31
|
|
|
|
|
|
|
'leading_digits' => ' |
|
32
|
|
|
|
|
|
|
[237]| |
|
33
|
|
|
|
|
|
|
8[0-2] |
|
34
|
|
|
|
|
|
|
', |
|
35
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{4})' |
|
36
|
|
|
|
|
|
|
}, |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
|
|
|
|
|
|
'format' => '$1 $2', |
|
39
|
|
|
|
|
|
|
'leading_digits' => '8', |
|
40
|
|
|
|
|
|
|
'national_rule' => '0$1', |
|
41
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{5})' |
|
42
|
|
|
|
|
|
|
}, |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
|
45
|
|
|
|
|
|
|
'leading_digits' => '[235]', |
|
46
|
|
|
|
|
|
|
'national_rule' => '0$1', |
|
47
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{4})' |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
]; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $validators = { |
|
52
|
|
|
|
|
|
|
'fixed_line' => ' |
|
53
|
|
|
|
|
|
|
3082[0-5]\\d{4}| |
|
54
|
|
|
|
|
|
|
3(?: |
|
55
|
|
|
|
|
|
|
0(?: |
|
56
|
|
|
|
|
|
|
[237]\\d| |
|
57
|
|
|
|
|
|
|
8[01] |
|
58
|
|
|
|
|
|
|
)| |
|
59
|
|
|
|
|
|
|
[167](?: |
|
60
|
|
|
|
|
|
|
2[0-6]| |
|
61
|
|
|
|
|
|
|
7\\d| |
|
62
|
|
|
|
|
|
|
80 |
|
63
|
|
|
|
|
|
|
)| |
|
64
|
|
|
|
|
|
|
2(?: |
|
65
|
|
|
|
|
|
|
2[0-5]| |
|
66
|
|
|
|
|
|
|
7\\d| |
|
67
|
|
|
|
|
|
|
80 |
|
68
|
|
|
|
|
|
|
)| |
|
69
|
|
|
|
|
|
|
3(?: |
|
70
|
|
|
|
|
|
|
2[0-3]| |
|
71
|
|
|
|
|
|
|
7\\d| |
|
72
|
|
|
|
|
|
|
80 |
|
73
|
|
|
|
|
|
|
)| |
|
74
|
|
|
|
|
|
|
4(?: |
|
75
|
|
|
|
|
|
|
2[013-9]| |
|
76
|
|
|
|
|
|
|
3[01]| |
|
77
|
|
|
|
|
|
|
7\\d| |
|
78
|
|
|
|
|
|
|
80 |
|
79
|
|
|
|
|
|
|
)| |
|
80
|
|
|
|
|
|
|
5(?: |
|
81
|
|
|
|
|
|
|
2[0-7]| |
|
82
|
|
|
|
|
|
|
7\\d| |
|
83
|
|
|
|
|
|
|
80 |
|
84
|
|
|
|
|
|
|
)| |
|
85
|
|
|
|
|
|
|
8(?: |
|
86
|
|
|
|
|
|
|
2[0-2]| |
|
87
|
|
|
|
|
|
|
7\\d| |
|
88
|
|
|
|
|
|
|
80 |
|
89
|
|
|
|
|
|
|
)| |
|
90
|
|
|
|
|
|
|
9(?: |
|
91
|
|
|
|
|
|
|
[28]0| |
|
92
|
|
|
|
|
|
|
7\\d |
|
93
|
|
|
|
|
|
|
) |
|
94
|
|
|
|
|
|
|
)\\d{5} |
|
95
|
|
|
|
|
|
|
', |
|
96
|
|
|
|
|
|
|
'geographic' => ' |
|
97
|
|
|
|
|
|
|
3082[0-5]\\d{4}| |
|
98
|
|
|
|
|
|
|
3(?: |
|
99
|
|
|
|
|
|
|
0(?: |
|
100
|
|
|
|
|
|
|
[237]\\d| |
|
101
|
|
|
|
|
|
|
8[01] |
|
102
|
|
|
|
|
|
|
)| |
|
103
|
|
|
|
|
|
|
[167](?: |
|
104
|
|
|
|
|
|
|
2[0-6]| |
|
105
|
|
|
|
|
|
|
7\\d| |
|
106
|
|
|
|
|
|
|
80 |
|
107
|
|
|
|
|
|
|
)| |
|
108
|
|
|
|
|
|
|
2(?: |
|
109
|
|
|
|
|
|
|
2[0-5]| |
|
110
|
|
|
|
|
|
|
7\\d| |
|
111
|
|
|
|
|
|
|
80 |
|
112
|
|
|
|
|
|
|
)| |
|
113
|
|
|
|
|
|
|
3(?: |
|
114
|
|
|
|
|
|
|
2[0-3]| |
|
115
|
|
|
|
|
|
|
7\\d| |
|
116
|
|
|
|
|
|
|
80 |
|
117
|
|
|
|
|
|
|
)| |
|
118
|
|
|
|
|
|
|
4(?: |
|
119
|
|
|
|
|
|
|
2[013-9]| |
|
120
|
|
|
|
|
|
|
3[01]| |
|
121
|
|
|
|
|
|
|
7\\d| |
|
122
|
|
|
|
|
|
|
80 |
|
123
|
|
|
|
|
|
|
)| |
|
124
|
|
|
|
|
|
|
5(?: |
|
125
|
|
|
|
|
|
|
2[0-7]| |
|
126
|
|
|
|
|
|
|
7\\d| |
|
127
|
|
|
|
|
|
|
80 |
|
128
|
|
|
|
|
|
|
)| |
|
129
|
|
|
|
|
|
|
8(?: |
|
130
|
|
|
|
|
|
|
2[0-2]| |
|
131
|
|
|
|
|
|
|
7\\d| |
|
132
|
|
|
|
|
|
|
80 |
|
133
|
|
|
|
|
|
|
)| |
|
134
|
|
|
|
|
|
|
9(?: |
|
135
|
|
|
|
|
|
|
[28]0| |
|
136
|
|
|
|
|
|
|
7\\d |
|
137
|
|
|
|
|
|
|
) |
|
138
|
|
|
|
|
|
|
)\\d{5} |
|
139
|
|
|
|
|
|
|
', |
|
140
|
|
|
|
|
|
|
'mobile' => ' |
|
141
|
|
|
|
|
|
|
(?: |
|
142
|
|
|
|
|
|
|
2(?: |
|
143
|
|
|
|
|
|
|
[0346-9]\\d| |
|
144
|
|
|
|
|
|
|
5[67] |
|
145
|
|
|
|
|
|
|
)| |
|
146
|
|
|
|
|
|
|
5(?: |
|
147
|
|
|
|
|
|
|
[03-7]\\d| |
|
148
|
|
|
|
|
|
|
9[1-9] |
|
149
|
|
|
|
|
|
|
) |
|
150
|
|
|
|
|
|
|
)\\d{6} |
|
151
|
|
|
|
|
|
|
', |
|
152
|
|
|
|
|
|
|
'pager' => '', |
|
153
|
|
|
|
|
|
|
'personal_number' => '', |
|
154
|
|
|
|
|
|
|
'specialrate' => '', |
|
155
|
|
|
|
|
|
|
'toll_free' => '800\\d{5}', |
|
156
|
|
|
|
|
|
|
'voip' => '' |
|
157
|
|
|
|
|
|
|
}; |
|
158
|
|
|
|
|
|
|
my %areanames = (); |
|
159
|
|
|
|
|
|
|
$areanames{en} = {"2333621", "Amedzofe", |
|
160
|
|
|
|
|
|
|
"233358", "Brong\-Ahafo\ Region", |
|
161
|
|
|
|
|
|
|
"2333224", "Bekwai", |
|
162
|
|
|
|
|
|
|
"233317", "Western\ Region", |
|
163
|
|
|
|
|
|
|
"233357", "Brong\-Ahafo\ Region", |
|
164
|
|
|
|
|
|
|
"233318", "Western\ Region", |
|
165
|
|
|
|
|
|
|
"2333220", "Kumasi", |
|
166
|
|
|
|
|
|
|
"2333622", "Hohoe", |
|
167
|
|
|
|
|
|
|
"2333123", "Tarkwa", |
|
168
|
|
|
|
|
|
|
"233387", "Upper\ East\ Region", |
|
169
|
|
|
|
|
|
|
"233388", "Upper\ East\ Region", |
|
170
|
|
|
|
|
|
|
"2333523", "Dormaa\ Ahenkro", |
|
171
|
|
|
|
|
|
|
"2333724", "Yendi", |
|
172
|
|
|
|
|
|
|
"2333421", "Nsawam", |
|
173
|
|
|
|
|
|
|
"233308", "Greater\ Accra\ Region", |
|
174
|
|
|
|
|
|
|
"233307", "Greater\ Accra\ Region", |
|
175
|
|
|
|
|
|
|
"233302", "Accra", |
|
176
|
|
|
|
|
|
|
"2333720", "Tamale", |
|
177
|
|
|
|
|
|
|
"2333726", "Salaga", |
|
178
|
|
|
|
|
|
|
"2333525", "Techiman", |
|
179
|
|
|
|
|
|
|
"2333125", "Samreboi", |
|
180
|
|
|
|
|
|
|
"2333721", "Walewale", |
|
181
|
|
|
|
|
|
|
"2333424", "Donkorkrom", |
|
182
|
|
|
|
|
|
|
"2333420", "Koforidua", |
|
183
|
|
|
|
|
|
|
"2333426", "Asamankese", |
|
184
|
|
|
|
|
|
|
"2333722", "Buipe", |
|
185
|
|
|
|
|
|
|
"2333624", "Kete\-Krachi", |
|
186
|
|
|
|
|
|
|
"233337", "Central\ Region", |
|
187
|
|
|
|
|
|
|
"2333221", "Konongo", |
|
188
|
|
|
|
|
|
|
"233338", "Central\ Region", |
|
189
|
|
|
|
|
|
|
"2333626", "Keta\/Akatsi", |
|
190
|
|
|
|
|
|
|
"2333222", "Ashanti\ Mampong", |
|
191
|
|
|
|
|
|
|
"2333323", "Winneba", |
|
192
|
|
|
|
|
|
|
"2333620", "Ho", |
|
193
|
|
|
|
|
|
|
"2333527", "Yeji", |
|
194
|
|
|
|
|
|
|
"2333820", "Bolgatanga", |
|
195
|
|
|
|
|
|
|
"2333425", "Suhum", |
|
196
|
|
|
|
|
|
|
"233327", "Ashanti\ Region", |
|
197
|
|
|
|
|
|
|
"2333321", "Cape\ Coast", |
|
198
|
|
|
|
|
|
|
"2333124", "Asankragwa", |
|
199
|
|
|
|
|
|
|
"233328", "Ashanti\ Region", |
|
200
|
|
|
|
|
|
|
"2333524", "Wenchi", |
|
201
|
|
|
|
|
|
|
"2333120", "Takoradi", |
|
202
|
|
|
|
|
|
|
"2333520", "Sunyani", |
|
203
|
|
|
|
|
|
|
"2333526", "Atebubu", |
|
204
|
|
|
|
|
|
|
"2333322", "Dunkwa", |
|
205
|
|
|
|
|
|
|
"2333223", "Ejura", |
|
206
|
|
|
|
|
|
|
"2333126", "Enchi", |
|
207
|
|
|
|
|
|
|
"2333625", "Denu\/Aflao", |
|
208
|
|
|
|
|
|
|
"2333431", "Nkawkaw", |
|
209
|
|
|
|
|
|
|
"233378", "Northern\ Region", |
|
210
|
|
|
|
|
|
|
"233377", "Northern\ Region", |
|
211
|
|
|
|
|
|
|
"2333427", "Akuapim\ Mampong", |
|
212
|
|
|
|
|
|
|
"233303", "Tema", |
|
213
|
|
|
|
|
|
|
"2333723", "Damongo", |
|
214
|
|
|
|
|
|
|
"233398", "Upper\ West\ Region", |
|
215
|
|
|
|
|
|
|
"233397", "Upper\ West\ Region", |
|
216
|
|
|
|
|
|
|
"233392", "Wa", |
|
217
|
|
|
|
|
|
|
"233348", "Eastern\ Region", |
|
218
|
|
|
|
|
|
|
"233347", "Eastern\ Region", |
|
219
|
|
|
|
|
|
|
"2333225", "Obuasi", |
|
220
|
|
|
|
|
|
|
"2333428", "Aburi", |
|
221
|
|
|
|
|
|
|
"23334292", "Akim\ Oda", |
|
222
|
|
|
|
|
|
|
"2333430", "Akosombo", |
|
223
|
|
|
|
|
|
|
"2333423", "Mpraeso", |
|
224
|
|
|
|
|
|
|
"233368", "Volta\ Region", |
|
225
|
|
|
|
|
|
|
"233367", "Volta\ Region", |
|
226
|
|
|
|
|
|
|
"2333725", "Bole", |
|
227
|
|
|
|
|
|
|
"2333121", "Axim", |
|
228
|
|
|
|
|
|
|
"2333822", "Bawku", |
|
229
|
|
|
|
|
|
|
"2333521", "Bechem", |
|
230
|
|
|
|
|
|
|
"2333320", "Swedru", |
|
231
|
|
|
|
|
|
|
"2333623", "Kpandu", |
|
232
|
|
|
|
|
|
|
"2333821", "Navrongo", |
|
233
|
|
|
|
|
|
|
"2333035", "Ada", |
|
234
|
|
|
|
|
|
|
"2333122", "Elubo", |
|
235
|
|
|
|
|
|
|
"2333522", "Berekum",}; |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub new { |
|
238
|
10
|
|
|
10
|
1
|
35
|
my $class = shift; |
|
239
|
10
|
|
|
|
|
28
|
my $number = shift; |
|
240
|
10
|
|
|
|
|
64
|
$number =~ s/(^\+233|\D)//g; |
|
241
|
10
|
|
|
|
|
60
|
my $self = bless({ country_code => '233', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
|
242
|
10
|
100
|
|
|
|
48
|
return $self if ($self->is_valid()); |
|
243
|
1
|
|
|
|
|
3
|
$number =~ s/^(?:0)//; |
|
244
|
1
|
|
|
|
|
17
|
$self = bless({ country_code => '233', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
|
245
|
1
|
50
|
|
|
|
5
|
return $self->is_valid() ? $self : undef; |
|
246
|
|
|
|
|
|
|
} |
|
247
|
|
|
|
|
|
|
1; |