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
|
|
1367
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
285
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
21
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
62
|
|
23
|
2
|
|
|
2
|
|
18
|
use warnings; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
58
|
|
24
|
2
|
|
|
2
|
|
19
|
use utf8; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
14
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230614174403; |
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} = {"2333726", "Salaga", |
160
|
|
|
|
|
|
|
"2333121", "Axim", |
161
|
|
|
|
|
|
|
"2333431", "Nkawkaw", |
162
|
|
|
|
|
|
|
"2333222", "Ashanti\ Mampong", |
163
|
|
|
|
|
|
|
"233378", "Northern\ Region", |
164
|
|
|
|
|
|
|
"2333425", "Suhum", |
165
|
|
|
|
|
|
|
"233347", "Eastern\ Region", |
166
|
|
|
|
|
|
|
"2333423", "Mpraeso", |
167
|
|
|
|
|
|
|
"2333620", "Ho", |
168
|
|
|
|
|
|
|
"233388", "Upper\ East\ Region", |
169
|
|
|
|
|
|
|
"2333320", "Swedru", |
170
|
|
|
|
|
|
|
"2333520", "Sunyani", |
171
|
|
|
|
|
|
|
"2333723", "Damongo", |
172
|
|
|
|
|
|
|
"233377", "Northern\ Region", |
173
|
|
|
|
|
|
|
"2333427", "Akuapim\ Mampong", |
174
|
|
|
|
|
|
|
"2333124", "Asankragwa", |
175
|
|
|
|
|
|
|
"2333725", "Bole", |
176
|
|
|
|
|
|
|
"233387", "Upper\ East\ Region", |
177
|
|
|
|
|
|
|
"2333426", "Asamankese", |
178
|
|
|
|
|
|
|
"233348", "Eastern\ Region", |
179
|
|
|
|
|
|
|
"2333120", "Takoradi", |
180
|
|
|
|
|
|
|
"2333430", "Akosombo", |
181
|
|
|
|
|
|
|
"2333225", "Obuasi", |
182
|
|
|
|
|
|
|
"233327", "Ashanti\ Region", |
183
|
|
|
|
|
|
|
"2333621", "Amedzofe", |
184
|
|
|
|
|
|
|
"2333223", "Ejura", |
185
|
|
|
|
|
|
|
"233398", "Upper\ West\ Region", |
186
|
|
|
|
|
|
|
"2333521", "Bechem", |
187
|
|
|
|
|
|
|
"2333321", "Cape\ Coast", |
188
|
|
|
|
|
|
|
"2333428", "Aburi", |
189
|
|
|
|
|
|
|
"2333822", "Bawku", |
190
|
|
|
|
|
|
|
"2333624", "Kete\-Krachi", |
191
|
|
|
|
|
|
|
"233328", "Ashanti\ Region", |
192
|
|
|
|
|
|
|
"233303", "Tema", |
193
|
|
|
|
|
|
|
"233392", "Wa", |
194
|
|
|
|
|
|
|
"2333722", "Buipe", |
195
|
|
|
|
|
|
|
"233397", "Upper\ West\ Region", |
196
|
|
|
|
|
|
|
"2333524", "Wenchi", |
197
|
|
|
|
|
|
|
"2333035", "Ada", |
198
|
|
|
|
|
|
|
"2333122", "Elubo", |
199
|
|
|
|
|
|
|
"233337", "Central\ Region", |
200
|
|
|
|
|
|
|
"2333323", "Winneba", |
201
|
|
|
|
|
|
|
"2333523", "Dormaa\ Ahenkro", |
202
|
|
|
|
|
|
|
"233357", "Brong\-Ahafo\ Region", |
203
|
|
|
|
|
|
|
"2333525", "Techiman", |
204
|
|
|
|
|
|
|
"2333420", "Koforidua", |
205
|
|
|
|
|
|
|
"2333623", "Kpandu", |
206
|
|
|
|
|
|
|
"233367", "Volta\ Region", |
207
|
|
|
|
|
|
|
"2333221", "Konongo", |
208
|
|
|
|
|
|
|
"2333625", "Denu\/Aflao", |
209
|
|
|
|
|
|
|
"23334292", "Akim\ Oda", |
210
|
|
|
|
|
|
|
"233308", "Greater\ Accra\ Region", |
211
|
|
|
|
|
|
|
"2333526", "Atebubu", |
212
|
|
|
|
|
|
|
"233368", "Volta\ Region", |
213
|
|
|
|
|
|
|
"2333820", "Bolgatanga", |
214
|
|
|
|
|
|
|
"233338", "Central\ Region", |
215
|
|
|
|
|
|
|
"2333626", "Keta\/Akatsi", |
216
|
|
|
|
|
|
|
"2333224", "Bekwai", |
217
|
|
|
|
|
|
|
"233358", "Brong\-Ahafo\ Region", |
218
|
|
|
|
|
|
|
"2333527", "Yeji", |
219
|
|
|
|
|
|
|
"233307", "Greater\ Accra\ Region", |
220
|
|
|
|
|
|
|
"233302", "Accra", |
221
|
|
|
|
|
|
|
"2333720", "Tamale", |
222
|
|
|
|
|
|
|
"2333220", "Kumasi", |
223
|
|
|
|
|
|
|
"2333421", "Nsawam", |
224
|
|
|
|
|
|
|
"2333622", "Hohoe", |
225
|
|
|
|
|
|
|
"2333522", "Berekum", |
226
|
|
|
|
|
|
|
"2333322", "Dunkwa", |
227
|
|
|
|
|
|
|
"2333125", "Samreboi", |
228
|
|
|
|
|
|
|
"2333724", "Yendi", |
229
|
|
|
|
|
|
|
"2333123", "Tarkwa", |
230
|
|
|
|
|
|
|
"233317", "Western\ Region", |
231
|
|
|
|
|
|
|
"2333424", "Donkorkrom", |
232
|
|
|
|
|
|
|
"2333821", "Navrongo", |
233
|
|
|
|
|
|
|
"233318", "Western\ Region", |
234
|
|
|
|
|
|
|
"2333721", "Walewale", |
235
|
|
|
|
|
|
|
"2333126", "Enchi",}; |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub new { |
238
|
10
|
|
|
10
|
1
|
28
|
my $class = shift; |
239
|
10
|
|
|
|
|
17
|
my $number = shift; |
240
|
10
|
|
|
|
|
69
|
$number =~ s/(^\+233|\D)//g; |
241
|
10
|
|
|
|
|
65
|
my $self = bless({ country_code => '233', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
242
|
10
|
100
|
|
|
|
60
|
return $self if ($self->is_valid()); |
243
|
1
|
|
|
|
|
9
|
$number =~ s/^(?:0)//; |
244
|
1
|
|
|
|
|
13
|
$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; |