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