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