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::KE; |
20
|
2
|
|
|
2
|
|
1069
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
211
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
44
|
|
23
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
46
|
|
24
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230307181421; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1 $2', |
30
|
|
|
|
|
|
|
'leading_digits' => '[24-6]', |
31
|
|
|
|
|
|
|
'national_rule' => '0$1', |
32
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{5,7})' |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
'format' => '$1 $2', |
36
|
|
|
|
|
|
|
'leading_digits' => '[17]', |
37
|
|
|
|
|
|
|
'national_rule' => '0$1', |
38
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{6})' |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
42
|
|
|
|
|
|
|
'leading_digits' => '[89]', |
43
|
|
|
|
|
|
|
'national_rule' => '0$1', |
44
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})' |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
]; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $validators = { |
49
|
|
|
|
|
|
|
'fixed_line' => ' |
50
|
|
|
|
|
|
|
(?: |
51
|
|
|
|
|
|
|
4[245]| |
52
|
|
|
|
|
|
|
5[1-79]| |
53
|
|
|
|
|
|
|
6[01457-9] |
54
|
|
|
|
|
|
|
)\\d{5,7}| |
55
|
|
|
|
|
|
|
(?: |
56
|
|
|
|
|
|
|
4[136]| |
57
|
|
|
|
|
|
|
5[08]| |
58
|
|
|
|
|
|
|
62 |
59
|
|
|
|
|
|
|
)\\d{7}| |
60
|
|
|
|
|
|
|
(?: |
61
|
|
|
|
|
|
|
[24]0| |
62
|
|
|
|
|
|
|
66 |
63
|
|
|
|
|
|
|
)\\d{6,7} |
64
|
|
|
|
|
|
|
', |
65
|
|
|
|
|
|
|
'geographic' => ' |
66
|
|
|
|
|
|
|
(?: |
67
|
|
|
|
|
|
|
4[245]| |
68
|
|
|
|
|
|
|
5[1-79]| |
69
|
|
|
|
|
|
|
6[01457-9] |
70
|
|
|
|
|
|
|
)\\d{5,7}| |
71
|
|
|
|
|
|
|
(?: |
72
|
|
|
|
|
|
|
4[136]| |
73
|
|
|
|
|
|
|
5[08]| |
74
|
|
|
|
|
|
|
62 |
75
|
|
|
|
|
|
|
)\\d{7}| |
76
|
|
|
|
|
|
|
(?: |
77
|
|
|
|
|
|
|
[24]0| |
78
|
|
|
|
|
|
|
66 |
79
|
|
|
|
|
|
|
)\\d{6,7} |
80
|
|
|
|
|
|
|
', |
81
|
|
|
|
|
|
|
'mobile' => ' |
82
|
|
|
|
|
|
|
(?: |
83
|
|
|
|
|
|
|
1(?: |
84
|
|
|
|
|
|
|
0[0-6]| |
85
|
|
|
|
|
|
|
1[0-5]| |
86
|
|
|
|
|
|
|
2[014]| |
87
|
|
|
|
|
|
|
30 |
88
|
|
|
|
|
|
|
)| |
89
|
|
|
|
|
|
|
7\\d\\d |
90
|
|
|
|
|
|
|
)\\d{6} |
91
|
|
|
|
|
|
|
', |
92
|
|
|
|
|
|
|
'pager' => '', |
93
|
|
|
|
|
|
|
'personal_number' => '', |
94
|
|
|
|
|
|
|
'specialrate' => '(900[02-9]\\d{5})', |
95
|
|
|
|
|
|
|
'toll_free' => '800[2-8]\\d{5,6}', |
96
|
|
|
|
|
|
|
'voip' => '' |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
my %areanames = (); |
99
|
|
|
|
|
|
|
$areanames{en} = {"25462", "Nanyuki", |
100
|
|
|
|
|
|
|
"25461", "Nyeri\/Karatina", |
101
|
|
|
|
|
|
|
"25465", "Nyahururu\/Maralal", |
102
|
|
|
|
|
|
|
"25450", "Naivasha\/Narok\/Gilgil", |
103
|
|
|
|
|
|
|
"25440", "Kwale\/Ukunda\/Msambweni\/Lungalunga", |
104
|
|
|
|
|
|
|
"25457", "Kisumu\/Siaya\/Maseno", |
105
|
|
|
|
|
|
|
"25468", "Embu", |
106
|
|
|
|
|
|
|
"25458", "Kisii\/Kilgoris\/Oyugis\/Nyamira", |
107
|
|
|
|
|
|
|
"2542", "Nairobi", |
108
|
|
|
|
|
|
|
"25442", "Malindi\/Lamu\/Garsen", |
109
|
|
|
|
|
|
|
"25441", "Mombasa\/Mariakani\/Kilifi", |
110
|
|
|
|
|
|
|
"25445", "Kajiado\/Ngong\/Loitokitok\/Athi\ River", |
111
|
|
|
|
|
|
|
"25467", "Kiambu\/Kikuyu", |
112
|
|
|
|
|
|
|
"25451", "Nakuru\/Njoro\/Molo", |
113
|
|
|
|
|
|
|
"25452", "Kericho\/Bomet", |
114
|
|
|
|
|
|
|
"25460", "Muranga\/Kerugoya", |
115
|
|
|
|
|
|
|
"25455", "Bungoma\/Busia", |
116
|
|
|
|
|
|
|
"25469", "Marsabit\/Moyale", |
117
|
|
|
|
|
|
|
"25446", "Garissa\/Hola\/Wajir\/Mandera", |
118
|
|
|
|
|
|
|
"25443", "Voi\/Wundanyi\/Mwatate\/Taveta", |
119
|
|
|
|
|
|
|
"25464", "Meru\/Maua\/Chuka", |
120
|
|
|
|
|
|
|
"25453", "Eldoret\/Turbo\/Kapsabet\/Iten\/Kabarnet", |
121
|
|
|
|
|
|
|
"25456", "Kakamega\/Mbale\/Butere\/Mumias\/Vihiga", |
122
|
|
|
|
|
|
|
"25466", "Thika\/Ruiru", |
123
|
|
|
|
|
|
|
"25444", "Machakos\/Makueni\/Mwingi\/Kitui", |
124
|
|
|
|
|
|
|
"25454", "Kitale\/Moi\'s\ Bridge\/Kapenguria\/Lodwar", |
125
|
|
|
|
|
|
|
"25459", "Homabay\/Migori",}; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub new { |
128
|
13
|
|
|
13
|
1
|
25
|
my $class = shift; |
129
|
13
|
|
|
|
|
30
|
my $number = shift; |
130
|
13
|
|
|
|
|
82
|
$number =~ s/(^\+254|\D)//g; |
131
|
13
|
|
|
|
|
68
|
my $self = bless({ country_code => '254', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
132
|
13
|
100
|
|
|
|
57
|
return $self if ($self->is_valid()); |
133
|
1
|
|
|
|
|
2
|
$number =~ s/^(?:0)//; |
134
|
1
|
|
|
|
|
10
|
$self = bless({ country_code => '254', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
135
|
1
|
50
|
|
|
|
3
|
return $self->is_valid() ? $self : undef; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
1; |