blib/lib/Number/Phone/StubCountry/ZA.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/YE.pm ↑ Summary blib/lib/Number/Phone/StubCountry/ZM.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::ZA;
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.20260904101552;
26  
27 2 my $formatters = [
28 {
29 'format' => '$1 $2',
30 'leading_digits' => '8[1-4]',
31 'national_rule' => '0$1',
32 'pattern' => '(\\d{2})(\\d{3,4})'
33 },
34 {
35 'format' => '$1 $2 $3',
36 'leading_digits' => '8[1-4]',
37 'national_rule' => '0$1',
38 'pattern' => '(\\d{2})(\\d{3})(\\d{2,3})'
39 },
40 {
41 'format' => '$1 $2 $3',
42 'leading_digits' => '860',
43 'national_rule' => '0$1',
44 'pattern' => '(\\d{3})(\\d{3})(\\d{3})'
45 },
46 {
47 'format' => '$1 $2 $3',
48 'leading_digits' => '[1-9]',
49 'national_rule' => '0$1',
50 'pattern' => '(\\d{2})(\\d{3})(\\d{4})'
51 },
52 {
53 'format' => '$1 $2 $3',
54 'leading_digits' => '8',
55 'national_rule' => '0$1',
56 'pattern' => '(\\d{3})(\\d{3})(\\d{4})'
57 }
58 ];
59  
60 2 my $validators = {
61 'fixed_line' => '
62 (?:
63 2(?:
64 0330|
65 4302
66 )|
67 52087
68 )0\\d{3}|
69 (?:
70 1[0-8]|
71 2[1-378]|
72 3[1-69]|
73 4\\d|
74 5[1346-8]
75 )\\d{7}
76 ',
77 'geographic' => '
78 (?:
79 2(?:
80 0330|
81 4302
82 )|
83 52087
84 )0\\d{3}|
85 (?:
86 1[0-8]|
87 2[1-378]|
88 3[1-69]|
89 4\\d|
90 5[1346-8]
91 )\\d{7}
92 ',
93 'mobile' => '
94 (?:
95 1(?:
96 3492[0-25]|
97 4495[0235]|
98 549(?:
99 20|
100 5[01]
101 )
102 )|
103 4[34]492[01]
104 )\\d{3}|
105 8[1-4]\\d{3,7}|
106 (?:
107 2[27]|
108 47|
109 54
110 )4950\\d{3}|
111 (?:
112 1(?:
113 049[2-4]|
114 9[12]\\d\\d
115 )|
116 (?:
117 50[0-2]|
118 [67]\\d\\d
119 )\\d\\d|
120 8(?:
121 5\\d{3}|
122 7(?:
123 08[67]|
124 158|
125 28[5-9]|
126 310
127 )
128 )
129 )\\d{4}|
130 (?:
131 1[6-8]|
132 28|
133 3[2-69]|
134 4[025689]|
135 5[36-8]
136 )4920\\d{3}|
137 (?:
138 12|
139 [2-5]1
140 )492\\d{4}
141 ',
142 'pager' => '',
143 'personal_number' => '',
144 'specialrate' => '(860\\d{6})|(
145 (?:
146 86[2-9]|
147 9[0-2]\\d
148 )\\d{6}
149 )|(861\\d{6,7})',
150 'toll_free' => '80\\d{7}',
151 'voip' => '
152 87(?:
153 08[0-589]|
154 15[0-79]|
155 28[0-4]|
156 31[1-9]
157 )\\d{4}|
158 87(?:
159 [02][0-79]|
160 1[0-46-9]|
161 3[02-9]|
162 [4-9]\\d
163 )\\d{5}
164 '
165 };
166 2 my %areanames = ();
167 2 $areanames{en} = {"2748", "Cradock\/Northern\ part\ of\ Eastern\ Cape\/Steynsburg",
168 "2731", "Durban",
169 "2741", "Port\ Elizabeth\/Uitenhage",
170 "2716", "Vaal\ Triangle",
171 "2740", "Alice\/Bhisho",
172 "2717", "Ermelo\/Secunda\/Southern\ Mpumalanga",
173 "2734", "Newcastle\/Northern\ KwaZulu\ Natal\/Vryheid",
174 "2744", "Garden\ Route\/George\/Knysna\/Mossel\ Bay\/Oudtshoorn\/Plettenberg\ Bay",
175 "2728", "Caledon\/Hermanus\/Southern\ coast\ of\ Western\ Cape\/Swellendam",
176 "2721", "Cape\ Town\/Gordons\ Bay\/Somerset\ West\/Stellenbosch",
177 "2712", "Brits\/Tshwane",
178 "2751", "Aliwal\ North\/Bloemfontein\/Far\ eastern\ part\ of\ Eastern\ Cape\/Southern\ and\ Central\ Free\ State",
179 "2758", "Bethlehem\/Eastern\ Free\ State",
180 "2745", "Northern\ and\ eastern\ parts\ of\ Eastern\ Cape\/Queenstown",
181 "2735", "Richards\ Bay\/St\.\ Lucia\/Ulundi\/Zululand",
182 "2754", "Upington\/Gordonia",
183 "2713", "Bronkhorstspruit\/Eastern\ Gauteng\/Middelburg\/Nelspruit\/Northern\ and\ Western\ Mpumalanga\/Witbank",
184 "2743", "East\ London",
185 "2733", "KwaZulu\ Natal\ Midlands\/Pietermaritzburg",
186 "2756", "Kroonstad\/Parys\/Northern\ Free\ State",
187 "2715", "Northern\ and\ Eastern\ Limpopo\/Polokwane",
188 "2757", "Northern\ Free\ State\ Goldfields\/Welkom",
189 "2723", "Beaufort\ West\/Karoo\/Robertson\/Worcester",
190 "2739", "Eastern\ Pondoland\/Port\ Shepstone\/Southern\ coast\ of\ KwaZulu\ Natal",
191 "2749", "Graaff\-Reinet\/Western\ part\ of\ Eastern\ Cape",
192 "2742", "Jeffreys\ Bay\/Humansdorp\/Southern\ and\ central\ Eastern\ Cape",
193 "2732", "Ballito\/KwaZulu\ Natal\ coast\/Stanger\/Tongaat\/Verulam",
194 "2753", "Eastern\ part\ of\ Northern\ Cape\/Far\ western\ part\ of\ North\ West\/Kimberley\/Kuruman",
195 "2727", "Alexander\ Bay\/Calvinia\/Clanwilliam\/Namaqualand\/Port\ Nolloth\/Springbok\/Vredendal",
196 "2714", "Modimolle\/Northern\ North\ West\ and\ Southwestern\ Limpopo\/Rustenburg",
197 "2710", "Johannesburg",
198 "2747", "Butterworth\/Eastern\ part\ of\ Eastern\ Cape\/Mthatha",
199 "2736", "Drakensberg\/Ladysmith",
200 "2746", "Bathurst\/Southern\ and\ eastern\ parts\ of\ Eastern\ Cape\/Grahamstown\/Kenton\-on\-Sea\/Port\ Alfred",
201 "2722", "Boland\/Malmesbury\/Vredenburg\/Western\ coast\ of\ Western\ Cape",
202 "2711", "Johannesburg",
203 "2718", "Klerksdorp\/Lichtenburg\/Potchefstroom",};
204 2 my $timezones = {
205 '' => [
206 'Africa/Johannesburg'
207 ]
208 };
209  
210 22 ▶ sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
211 22 my $class = shift;
212 22 my $number = shift;
213 22 $number =~ s/(^\+27|\D)//g;
214 22 my $self = bless({ country_code => '27', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class);
215 22 ▶ return $self if ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_valid 21 1 22
216 1 $number =~ s/^(?:0)//;
217 1 $self = bless({ country_code => '27', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
218 1 ▶ return $self->is_valid() ? $self : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 0 1 1
219 }
220 2 1;
« blib/lib/Number/Phone/StubCountry/YE.pm ↑ Summary blib/lib/Number/Phone/StubCountry/ZM.pm »