blib/lib/Number/Phone/StubCountry/KE.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/JO.pm ↑ Summary blib/lib/Number/Phone/StubCountry/KG.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::KE;
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 '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 2 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-8]|
85 [18]\\d|
86 2[014]|
87 30|
88 4[0-5]
89 )|
90 7\\d\\d
91 )\\d{6}
92 ',
93 'pager' => '',
94 'personal_number' => '',
95 'specialrate' => '(900[02-9]\\d{5})',
96 'toll_free' => '800[02-8]\\d{5,6}',
97 'voip' => ''
98 };
99 2 my %areanames = ();
100 2 $areanames{en} = {"25442", "Malindi\/Lamu\/Garsen",
101 "25465", "Nyahururu\/Maralal",
102 "25457", "Kisumu\/Siaya\/Maseno",
103 "25443", "Voi\/Wundanyi\/Mwatate\/Taveta",
104 "25440", "Kwale\/Ukunda\/Msambweni\/Lungalunga",
105 "25466", "Thika\/Ruiru",
106 "25444", "Machakos\/Makueni\/Mwingi\/Kitui",
107 "25451", "Nakuru\/Njoro\/Molo",
108 "25454", "Kitale\/Moi\'s\ Bridge\/Kapenguria\/Lodwar",
109 "25441", "Mombasa\/Mariakani\/Kilifi",
110 "25459", "Homabay\/Migori",
111 "25468", "Embu",
112 "25450", "Naivasha\/Narok\/Gilgil",
113 "25453", "Eldoret\/Turbo\/Kapsabet\/Iten\/Kabarnet",
114 "25452", "Kericho\/Bomet",
115 "25456", "Kakamega\/Mbale\/Butere\/Mumias\/Vihiga",
116 "25461", "Nyeri\/Karatina",
117 "2542", "Nairobi",
118 "25455", "Bungoma\/Busia",
119 "25467", "Kiambu\/Kikuyu",
120 "25445", "Kajiado\/Ngong\/Loitokitok\/Athi\ River",
121 "25462", "Nanyuki",
122 "25460", "Muranga\/Kerugoya",
123 "25458", "Kisii\/Kilgoris\/Oyugis\/Nyamira",
124 "25464", "Meru\/Maua\/Chuka",
125 "25446", "Garissa\/Hola\/Wajir\/Mandera",
126 "25469", "Marsabit\/Moyale",};
127 2 my $timezones = {
128 '' => [
129 'Africa/Nairobi'
130 ]
131 };
132  
133 13 ▶ sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
134 13 my $class = shift;
135 13 my $number = shift;
136 13 $number =~ s/(^\+254|\D)//g;
137 13 my $self = bless({ country_code => '254', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class);
138 13 ▶ return $self if ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_valid 12 1 13
139 1 $number =~ s/^(?:0)//;
140 1 $self = bless({ country_code => '254', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
141 1 ▶ return $self->is_valid() ? $self : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 0 1 1
142 }
143 2 1;
« blib/lib/Number/Phone/StubCountry/JO.pm ↑ Summary blib/lib/Number/Phone/StubCountry/KG.pm »