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
|
|
1233
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
237
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
50
|
|
23
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
106
|
|
24
|
2
|
|
|
2
|
|
17
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230903131447; |
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} = {"25450", "Naivasha\/Narok\/Gilgil", |
100
|
|
|
|
|
|
|
"25459", "Homabay\/Migori", |
101
|
|
|
|
|
|
|
"25467", "Kiambu\/Kikuyu", |
102
|
|
|
|
|
|
|
"25464", "Meru\/Maua\/Chuka", |
103
|
|
|
|
|
|
|
"25440", "Kwale\/Ukunda\/Msambweni\/Lungalunga", |
104
|
|
|
|
|
|
|
"25466", "Thika\/Ruiru", |
105
|
|
|
|
|
|
|
"25468", "Embu", |
106
|
|
|
|
|
|
|
"25445", "Kajiado\/Ngong\/Loitokitok\/Athi\ River", |
107
|
|
|
|
|
|
|
"25462", "Nanyuki", |
108
|
|
|
|
|
|
|
"25455", "Bungoma\/Busia", |
109
|
|
|
|
|
|
|
"25461", "Nyeri\/Karatina", |
110
|
|
|
|
|
|
|
"25465", "Nyahururu\/Maralal", |
111
|
|
|
|
|
|
|
"25453", "Eldoret\/Turbo\/Kapsabet\/Iten\/Kabarnet", |
112
|
|
|
|
|
|
|
"25452", "Kericho\/Bomet", |
113
|
|
|
|
|
|
|
"25446", "Garissa\/Hola\/Wajir\/Mandera", |
114
|
|
|
|
|
|
|
"25451", "Nakuru\/Njoro\/Molo", |
115
|
|
|
|
|
|
|
"2542", "Nairobi", |
116
|
|
|
|
|
|
|
"25456", "Kakamega\/Mbale\/Butere\/Mumias\/Vihiga", |
117
|
|
|
|
|
|
|
"25441", "Mombasa\/Mariakani\/Kilifi", |
118
|
|
|
|
|
|
|
"25458", "Kisii\/Kilgoris\/Oyugis\/Nyamira", |
119
|
|
|
|
|
|
|
"25443", "Voi\/Wundanyi\/Mwatate\/Taveta", |
120
|
|
|
|
|
|
|
"25442", "Malindi\/Lamu\/Garsen", |
121
|
|
|
|
|
|
|
"25454", "Kitale\/Moi\'s\ Bridge\/Kapenguria\/Lodwar", |
122
|
|
|
|
|
|
|
"25460", "Muranga\/Kerugoya", |
123
|
|
|
|
|
|
|
"25457", "Kisumu\/Siaya\/Maseno", |
124
|
|
|
|
|
|
|
"25469", "Marsabit\/Moyale", |
125
|
|
|
|
|
|
|
"25444", "Machakos\/Makueni\/Mwingi\/Kitui",}; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub new { |
128
|
13
|
|
|
13
|
1
|
60
|
my $class = shift; |
129
|
13
|
|
|
|
|
27
|
my $number = shift; |
130
|
13
|
|
|
|
|
90
|
$number =~ s/(^\+254|\D)//g; |
131
|
13
|
|
|
|
|
77
|
my $self = bless({ country_code => '254', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
132
|
13
|
100
|
|
|
|
69
|
return $self if ($self->is_valid()); |
133
|
1
|
|
|
|
|
15
|
$number =~ s/^(?:0)//; |
134
|
1
|
|
|
|
|
11
|
$self = bless({ country_code => '254', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
135
|
1
|
50
|
|
|
|
5
|
return $self->is_valid() ? $self : undef; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
1; |