| 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::EG; | ||||||||||
| 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.20260904101549; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1 $2', | ||||||||||
| 30 | 'leading_digits' => '[23]', | ||||||||||
| 31 | 'national_rule' => '0$1', | ||||||||||
| 32 | 'pattern' => '(\\d)(\\d{7,8})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2', | ||||||||||
| 36 | 'leading_digits' => ' | ||||||||||
| 37 | 1[35]| | ||||||||||
| 38 | [4-6]| | ||||||||||
| 39 | 8[2468]| | ||||||||||
| 40 | 9[235-7] | ||||||||||
| 41 | ', | ||||||||||
| 42 | 'national_rule' => '0$1', | ||||||||||
| 43 | 'pattern' => '(\\d{2})(\\d{6,7})' | ||||||||||
| 44 | }, | ||||||||||
| 45 | { | ||||||||||
| 46 | 'format' => '$1 $2 $3', | ||||||||||
| 47 | 'leading_digits' => '[89]', | ||||||||||
| 48 | 'national_rule' => '0$1', | ||||||||||
| 49 | 'pattern' => '(\\d{3})(\\d{3})(\\d{4})' | ||||||||||
| 50 | }, | ||||||||||
| 51 | { | ||||||||||
| 52 | 'format' => '$1 $2', | ||||||||||
| 53 | 'leading_digits' => '1', | ||||||||||
| 54 | 'national_rule' => '0$1', | ||||||||||
| 55 | 'pattern' => '(\\d{2})(\\d{8})' | ||||||||||
| 56 | } | ||||||||||
| 57 | ]; | ||||||||||
| 58 | |||||||||||
| 59 | 2 | my $validators = { | |||||||||
| 60 | 'fixed_line' => ' | ||||||||||
| 61 | 13[23]\\d{6}| | ||||||||||
| 62 | (?: | ||||||||||
| 63 | 15| | ||||||||||
| 64 | 57 | ||||||||||
| 65 | )\\d{6,7}| | ||||||||||
| 66 | (?: | ||||||||||
| 67 | 2\\d| | ||||||||||
| 68 | 3| | ||||||||||
| 69 | 4[05-8]| | ||||||||||
| 70 | 5[05]| | ||||||||||
| 71 | 6[24-689]| | ||||||||||
| 72 | 8[2468]| | ||||||||||
| 73 | 9[235-7] | ||||||||||
| 74 | )\\d{7} | ||||||||||
| 75 | ', | ||||||||||
| 76 | 'geographic' => ' | ||||||||||
| 77 | 13[23]\\d{6}| | ||||||||||
| 78 | (?: | ||||||||||
| 79 | 15| | ||||||||||
| 80 | 57 | ||||||||||
| 81 | )\\d{6,7}| | ||||||||||
| 82 | (?: | ||||||||||
| 83 | 2\\d| | ||||||||||
| 84 | 3| | ||||||||||
| 85 | 4[05-8]| | ||||||||||
| 86 | 5[05]| | ||||||||||
| 87 | 6[24-689]| | ||||||||||
| 88 | 8[2468]| | ||||||||||
| 89 | 9[235-7] | ||||||||||
| 90 | )\\d{7} | ||||||||||
| 91 | ', | ||||||||||
| 92 | 'mobile' => '1[0-25]\\d{8}', | ||||||||||
| 93 | 'pager' => '', | ||||||||||
| 94 | 'personal_number' => '', | ||||||||||
| 95 | 'specialrate' => '(900\\d{7})', | ||||||||||
| 96 | 'toll_free' => '800\\d{7}', | ||||||||||
| 97 | 'voip' => '' | ||||||||||
| 98 | }; | ||||||||||
| 99 | 2 | my %areanames = (); | |||||||||
| 100 | 2 | $areanames{en} = {"2050", "Mansoura", | |||||||||
| 101 | "20554", "10th\ of\ Ramadan", | ||||||||||
| 102 | "2045", "Damanhur", | ||||||||||
| 103 | "202", "Cairo\/Giza\/Qalyubia", | ||||||||||
| 104 | "2068", "El\-Arish", | ||||||||||
| 105 | "203", "Alexandria", | ||||||||||
| 106 | "2093", "Sohag", | ||||||||||
| 107 | "2013", "Banha", | ||||||||||
| 108 | "2064", "Ismailia", | ||||||||||
| 109 | "2055", "Zagazig", | ||||||||||
| 110 | "2096", "Qena", | ||||||||||
| 111 | "2097", "Aswan", | ||||||||||
| 112 | "2040", "Tanta", | ||||||||||
| 113 | "2065", "Red\ Sea", | ||||||||||
| 114 | "2048", "Monufia", | ||||||||||
| 115 | "2088", "Assiout", | ||||||||||
| 116 | "2092", "Wadi\ El\-Gedid", | ||||||||||
| 117 | "2084", "Fayoum", | ||||||||||
| 118 | "2082", "Beni\ Suef", | ||||||||||
| 119 | "2086", "Minia", | ||||||||||
| 120 | "2047", "Kafr\ El\-Sheikh", | ||||||||||
| 121 | "2046", "Marsa\ Matruh", | ||||||||||
| 122 | "2069", "El\-Tor", | ||||||||||
| 123 | "2062", "Suez", | ||||||||||
| 124 | "2015", "10th\ of\ Ramadan", | ||||||||||
| 125 | "2095", "Luxor", | ||||||||||
| 126 | "2066", "Port\ Said", | ||||||||||
| 127 | "2057", "Damietta",}; | ||||||||||
| 128 | 2 | my $timezones = { | |||||||||
| 129 | '' => [ | ||||||||||
| 130 | 'Africa/Cairo' | ||||||||||
| 131 | ] | ||||||||||
| 132 | }; | ||||||||||
| 133 | |||||||||||
| 134 | 13 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 135 | 13 | my $class = shift; | |||||||||
| 136 | 13 | my $number = shift; | |||||||||
| 137 | 13 | $number =~ s/(^\+20|\D)//g; | |||||||||
| 138 | 13 | my $self = bless({ country_code => '20', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 139 | 13 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 140 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 141 | 1 | $self = bless({ country_code => '20', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 142 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 143 | } | ||||||||||
| 144 | 2 | 1; | |||||||||