blib/lib/Number/Phone/StubCountry/GH.pm

filter: Statementstmt 100% 27 / 27 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 97.3% 36 / 37 CC 3 SCAR 6.2
CC
3
Cov
97%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Number/Phone/StubCountry/GE.pm ↑ Summary blib/lib/Number/Phone/StubCountry/HR.pm »
1 # automatically generated file, don't edit
2  
3  
4  
5 # Copyright 2026 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 ▶use base qw(Number::Phone::StubCountry);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 our $VERSION = 1.20260904101550;
26  
27 2 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' => '[2358]',
46 'national_rule' => '0$1',
47 'pattern' => '(\\d{2})(\\d{3})(\\d{4})'
48 }
49 ];
50  
51 2 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,6}',
156 'voip' => ''
157 };
158 2 my %areanames = ();
159 2 $areanames{en} = {"2333122", "Elubo",
160 "2333120", "Takoradi",
161 "2333431", "Nkawkaw",
162 "2333035", "Ada",
163 "2333525", "Techiman",
164 "2333621", "Amedzofe",
165 "2333722", "Buipe",
166 "2333720", "Tamale",
167 "2333626", "Keta\/Akatsi",
168 "2333123", "Tarkwa",
169 "2333524", "Wenchi",
170 "233368", "Volta\ Region",
171 "233367", "Volta\ Region",
172 "2333723", "Damongo",
173 "233308", "Greater\ Accra\ Region",
174 "233307", "Greater\ Accra\ Region",
175 "2333424", "Donkorkrom",
176 "2333121", "Axim",
177 "2333428", "Aburi",
178 "2333430", "Akosombo",
179 "233392", "Wa",
180 "233398", "Upper\ West\ Region",
181 "2333721", "Walewale",
182 "233397", "Upper\ West\ Region",
183 "2333224", "Bekwai",
184 "233302", "Accra",
185 "2333620", "Ho",
186 "2333622", "Hohoe",
187 "2333726", "Salaga",
188 "233318", "Western\ Region",
189 "233317", "Western\ Region",
190 "2333425", "Suhum",
191 "2333623", "Kpandu",
192 "233377", "Northern\ Region",
193 "233378", "Northern\ Region",
194 "2333225", "Obuasi",
195 "2333126", "Enchi",
196 "2333323", "Winneba",
197 "233387", "Upper\ East\ Region",
198 "233388", "Upper\ East\ Region",
199 "2333625", "Denu\/Aflao",
200 "2333223", "Ejura",
201 "2333521", "Bechem",
202 "2333423", "Mpraeso",
203 "2333527", "Yeji",
204 "2333220", "Kumasi",
205 "2333222", "Ashanti\ Mampong",
206 "2333821", "Navrongo",
207 "2333624", "Kete\-Krachi",
208 "233303", "Tema",
209 "233358", "Brong\-Ahafo\ Region",
210 "2333322", "Dunkwa",
211 "233357", "Brong\-Ahafo\ Region",
212 "2333320", "Swedru",
213 "2333420", "Koforidua",
214 "2333526", "Atebubu",
215 "233338", "Central\ Region",
216 "2333522", "Berekum",
217 "233337", "Central\ Region",
218 "2333426", "Asamankese",
219 "2333520", "Sunyani",
220 "233327", "Ashanti\ Region",
221 "2333725", "Bole",
222 "233328", "Ashanti\ Region",
223 "23334292", "Akim\ Oda",
224 "2333125", "Samreboi",
225 "233347", "Eastern\ Region",
226 "233348", "Eastern\ Region",
227 "2333321", "Cape\ Coast",
228 "2333221", "Konongo",
229 "2333523", "Dormaa\ Ahenkro",
230 "2333724", "Yendi",
231 "2333822", "Bawku",
232 "2333820", "Bolgatanga",
233 "2333427", "Akuapim\ Mampong",
234 "2333421", "Nsawam",
235 "2333124", "Asankragwa",};
236 2 my $timezones = {
237 '' => [
238 'Africa/Accra'
239 ]
240 };
241  
242 10 ▶ sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
243 10 my $class = shift;
244 10 my $number = shift;
245 10 $number =~ s/(^\+233|\D)//g;
246 10 my $self = bless({ country_code => '233', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class);
247 10 ▶ return $self if ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_valid 9 1 10
248 1 $number =~ s/^(?:0)//;
249 1 $self = bless({ country_code => '233', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
250 1 ▶ return $self->is_valid() ? $self : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 0 1 1
251 }
252 2 1;
« blib/lib/Number/Phone/StubCountry/GE.pm ↑ Summary blib/lib/Number/Phone/StubCountry/HR.pm »