| 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::NG; | ||||||||||
| 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.20260904101551; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1 $2 $3', | ||||||||||
| 30 | 'leading_digits' => '[7-9]', | ||||||||||
| 31 | 'national_rule' => '0$1', | ||||||||||
| 32 | 'pattern' => '(\\d{3})(\\d{3})(\\d{3,4})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2 $3', | ||||||||||
| 36 | 'leading_digits' => '20[129]', | ||||||||||
| 37 | 'national_rule' => '0$1', | ||||||||||
| 38 | 'pattern' => '(\\d{3})(\\d{3})(\\d{4})' | ||||||||||
| 39 | }, | ||||||||||
| 40 | { | ||||||||||
| 41 | 'format' => '$1 $2 $3', | ||||||||||
| 42 | 'leading_digits' => '2', | ||||||||||
| 43 | 'national_rule' => '0$1', | ||||||||||
| 44 | 'pattern' => '(\\d{4})(\\d{2})(\\d{4})' | ||||||||||
| 45 | }, | ||||||||||
| 46 | { | ||||||||||
| 47 | 'format' => '$1 $2 $3', | ||||||||||
| 48 | 'leading_digits' => '[78]', | ||||||||||
| 49 | 'national_rule' => '0$1', | ||||||||||
| 50 | 'pattern' => '(\\d{3})(\\d{4})(\\d{4,5})' | ||||||||||
| 51 | }, | ||||||||||
| 52 | { | ||||||||||
| 53 | 'format' => '$1 $2 $3', | ||||||||||
| 54 | 'leading_digits' => '[78]', | ||||||||||
| 55 | 'national_rule' => '0$1', | ||||||||||
| 56 | 'pattern' => '(\\d{3})(\\d{5})(\\d{5,6})' | ||||||||||
| 57 | } | ||||||||||
| 58 | ]; | ||||||||||
| 59 | |||||||||||
| 60 | 2 | my $validators = { | |||||||||
| 61 | 'fixed_line' => ' | ||||||||||
| 62 | 20(?: | ||||||||||
| 63 | [1259]\\d| | ||||||||||
| 64 | 3[013-9]| | ||||||||||
| 65 | 4[1-8]| | ||||||||||
| 66 | 6[024-689]| | ||||||||||
| 67 | 7[1-79]| | ||||||||||
| 68 | 8[2-9] | ||||||||||
| 69 | )\\d{6} | ||||||||||
| 70 | ', | ||||||||||
| 71 | 'geographic' => ' | ||||||||||
| 72 | 20(?: | ||||||||||
| 73 | [1259]\\d| | ||||||||||
| 74 | 3[013-9]| | ||||||||||
| 75 | 4[1-8]| | ||||||||||
| 76 | 6[024-689]| | ||||||||||
| 77 | 7[1-79]| | ||||||||||
| 78 | 8[2-9] | ||||||||||
| 79 | )\\d{6} | ||||||||||
| 80 | ', | ||||||||||
| 81 | 'mobile' => ' | ||||||||||
| 82 | (?: | ||||||||||
| 83 | 702[0-24-9]| | ||||||||||
| 84 | 819[01] | ||||||||||
| 85 | )\\d{6}| | ||||||||||
| 86 | (?: | ||||||||||
| 87 | 7(?: | ||||||||||
| 88 | 0[13-9]| | ||||||||||
| 89 | [12]\\d | ||||||||||
| 90 | )| | ||||||||||
| 91 | 8(?: | ||||||||||
| 92 | 0[1-9]| | ||||||||||
| 93 | 1[0-8] | ||||||||||
| 94 | )| | ||||||||||
| 95 | 9(?: | ||||||||||
| 96 | 0[1-9]| | ||||||||||
| 97 | 1[1-6] | ||||||||||
| 98 | ) | ||||||||||
| 99 | )\\d{7} | ||||||||||
| 100 | ', | ||||||||||
| 101 | 'pager' => '', | ||||||||||
| 102 | 'personal_number' => '', | ||||||||||
| 103 | 'specialrate' => '(700\\d{7,11})', | ||||||||||
| 104 | 'toll_free' => '800\\d{7,11}', | ||||||||||
| 105 | 'voip' => '' | ||||||||||
| 106 | }; | ||||||||||
| 107 | 2 | my %areanames = (); | |||||||||
| 108 | 2 | $areanames{en} = {"2342043", "Abakaliki", | |||||||||
| 109 | "2342054", "Sapele", | ||||||||||
| 110 | "2342058", "Lokoja", | ||||||||||
| 111 | "2342064", "Kano", | ||||||||||
| 112 | "2342037", "Ijebu\ Ode", | ||||||||||
| 113 | "2342068", "Birin\ Kebbi", | ||||||||||
| 114 | "2342031", "Ilorin", | ||||||||||
| 115 | "2342055", "Agbor", | ||||||||||
| 116 | "2342036", "Ile\ Ife", | ||||||||||
| 117 | "2342065", "Katsina", | ||||||||||
| 118 | "2342042", "Nsukka\ Enugu", | ||||||||||
| 119 | "2342059", "Okitipupa", | ||||||||||
| 120 | "2342069", "Zaria", | ||||||||||
| 121 | "2342074", "Damaturu", | ||||||||||
| 122 | "2342088", "Umuahia", | ||||||||||
| 123 | "2342084", "Port\ Harcourt", | ||||||||||
| 124 | "2342046", "Onitsha", | ||||||||||
| 125 | "2342030", "Ado\ Ekiti", | ||||||||||
| 126 | "2342085", "Uyo", | ||||||||||
| 127 | "2342075", "Yola", | ||||||||||
| 128 | "2342041", "Wukari", | ||||||||||
| 129 | "2342033", "New\ Bussa", | ||||||||||
| 130 | "2342079", "Jalingo", | ||||||||||
| 131 | "2342089", "Yenagoa", | ||||||||||
| 132 | "2342047", "Lafia\/Keffi", | ||||||||||
| 133 | "2342066", "Minna", | ||||||||||
| 134 | "2342056", "Asaba", | ||||||||||
| 135 | "2342035", "Osogbo", | ||||||||||
| 136 | "2342039", "Abeokuta", | ||||||||||
| 137 | "2342083", "Owerri", | ||||||||||
| 138 | "2342073", "Jos", | ||||||||||
| 139 | "234201", "Lagos", | ||||||||||
| 140 | "2342057", "Auchi", | ||||||||||
| 141 | "2342034", "Akure", | ||||||||||
| 142 | "2342038", "Oyo", | ||||||||||
| 143 | "2342072", "Gombe", | ||||||||||
| 144 | "234209", "Abuja", | ||||||||||
| 145 | "2342082", "Aba", | ||||||||||
| 146 | "2342051", "Owoh", | ||||||||||
| 147 | "2342086", "Ahoada", | ||||||||||
| 148 | "2342076", "Maiduguri", | ||||||||||
| 149 | "2342048", "Awka", | ||||||||||
| 150 | "234202", "Ibadan", | ||||||||||
| 151 | "2342044", "Makurdi", | ||||||||||
| 152 | "2342053", "Warri", | ||||||||||
| 153 | "2342087", "Calabar", | ||||||||||
| 154 | "2342077", "Bauchi", | ||||||||||
| 155 | "2342050", "Ikare", | ||||||||||
| 156 | "2342052", "Benin", | ||||||||||
| 157 | "2342071", "Azare", | ||||||||||
| 158 | "2342060", "Sokoto", | ||||||||||
| 159 | "2342062", "Kaduna", | ||||||||||
| 160 | "2342045", "Ogoja",}; | ||||||||||
| 161 | 2 | my $timezones = { | |||||||||
| 162 | '' => [ | ||||||||||
| 163 | 'Africa/Lagos' | ||||||||||
| 164 | ] | ||||||||||
| 165 | }; | ||||||||||
| 166 | |||||||||||
| 167 | 13 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 168 | 13 | my $class = shift; | |||||||||
| 169 | 13 | my $number = shift; | |||||||||
| 170 | 13 | $number =~ s/(^\+234|\D)//g; | |||||||||
| 171 | 13 | my $self = bless({ country_code => '234', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 172 | 13 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 173 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 174 | 1 | $self = bless({ country_code => '234', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 175 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 176 | } | ||||||||||
| 177 | 2 | 1; | |||||||||