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::MA; |
20
|
3
|
|
|
3
|
|
1702
|
use base qw(Number::Phone::StubCountry); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
326
|
|
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
3
|
|
28
|
use strict; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
74
|
|
23
|
3
|
|
|
3
|
|
21
|
use warnings; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
77
|
|
24
|
3
|
|
|
3
|
|
16
|
use utf8; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
15
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230614174404; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1-$2', |
30
|
|
|
|
|
|
|
'leading_digits' => ' |
31
|
|
|
|
|
|
|
529(?: |
32
|
|
|
|
|
|
|
1[1-46-9]| |
33
|
|
|
|
|
|
|
2[013-8]| |
34
|
|
|
|
|
|
|
90 |
35
|
|
|
|
|
|
|
)| |
36
|
|
|
|
|
|
|
5(?: |
37
|
|
|
|
|
|
|
298| |
38
|
|
|
|
|
|
|
389 |
39
|
|
|
|
|
|
|
)[0-46-9] |
40
|
|
|
|
|
|
|
', |
41
|
|
|
|
|
|
|
'national_rule' => '0$1', |
42
|
|
|
|
|
|
|
'pattern' => '(\\d{5})(\\d{4})' |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
'format' => '$1 $2 $3 $4', |
46
|
|
|
|
|
|
|
'leading_digits' => '5[45]', |
47
|
|
|
|
|
|
|
'national_rule' => '0$1', |
48
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})' |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
'format' => '$1-$2', |
52
|
|
|
|
|
|
|
'leading_digits' => ' |
53
|
|
|
|
|
|
|
5(?: |
54
|
|
|
|
|
|
|
2(?: |
55
|
|
|
|
|
|
|
[2-49]| |
56
|
|
|
|
|
|
|
8[235-9] |
57
|
|
|
|
|
|
|
)| |
58
|
|
|
|
|
|
|
3[5-9]| |
59
|
|
|
|
|
|
|
9 |
60
|
|
|
|
|
|
|
)| |
61
|
|
|
|
|
|
|
892 |
62
|
|
|
|
|
|
|
', |
63
|
|
|
|
|
|
|
'national_rule' => '0$1', |
64
|
|
|
|
|
|
|
'pattern' => '(\\d{4})(\\d{5})' |
65
|
|
|
|
|
|
|
}, |
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
'format' => '$1-$2', |
68
|
|
|
|
|
|
|
'leading_digits' => '8', |
69
|
|
|
|
|
|
|
'national_rule' => '0$1', |
70
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{7})' |
71
|
|
|
|
|
|
|
}, |
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
'format' => '$1-$2', |
74
|
|
|
|
|
|
|
'leading_digits' => '[5-7]', |
75
|
|
|
|
|
|
|
'national_rule' => '0$1', |
76
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{6})' |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
]; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $validators = { |
81
|
|
|
|
|
|
|
'fixed_line' => ' |
82
|
|
|
|
|
|
|
5293[01]\\d{4}| |
83
|
|
|
|
|
|
|
5(?: |
84
|
|
|
|
|
|
|
2(?: |
85
|
|
|
|
|
|
|
[0-25-7]\\d| |
86
|
|
|
|
|
|
|
3[1-578]| |
87
|
|
|
|
|
|
|
4[02-46-8]| |
88
|
|
|
|
|
|
|
8[0235-7]| |
89
|
|
|
|
|
|
|
9[0-289] |
90
|
|
|
|
|
|
|
)| |
91
|
|
|
|
|
|
|
3(?: |
92
|
|
|
|
|
|
|
[0-47]\\d| |
93
|
|
|
|
|
|
|
5[02-9]| |
94
|
|
|
|
|
|
|
6[02-8]| |
95
|
|
|
|
|
|
|
8[0189]| |
96
|
|
|
|
|
|
|
9[3-9] |
97
|
|
|
|
|
|
|
)| |
98
|
|
|
|
|
|
|
(?: |
99
|
|
|
|
|
|
|
4[067]| |
100
|
|
|
|
|
|
|
5[03] |
101
|
|
|
|
|
|
|
)\\d |
102
|
|
|
|
|
|
|
)\\d{5} |
103
|
|
|
|
|
|
|
', |
104
|
|
|
|
|
|
|
'geographic' => ' |
105
|
|
|
|
|
|
|
5293[01]\\d{4}| |
106
|
|
|
|
|
|
|
5(?: |
107
|
|
|
|
|
|
|
2(?: |
108
|
|
|
|
|
|
|
[0-25-7]\\d| |
109
|
|
|
|
|
|
|
3[1-578]| |
110
|
|
|
|
|
|
|
4[02-46-8]| |
111
|
|
|
|
|
|
|
8[0235-7]| |
112
|
|
|
|
|
|
|
9[0-289] |
113
|
|
|
|
|
|
|
)| |
114
|
|
|
|
|
|
|
3(?: |
115
|
|
|
|
|
|
|
[0-47]\\d| |
116
|
|
|
|
|
|
|
5[02-9]| |
117
|
|
|
|
|
|
|
6[02-8]| |
118
|
|
|
|
|
|
|
8[0189]| |
119
|
|
|
|
|
|
|
9[3-9] |
120
|
|
|
|
|
|
|
)| |
121
|
|
|
|
|
|
|
(?: |
122
|
|
|
|
|
|
|
4[067]| |
123
|
|
|
|
|
|
|
5[03] |
124
|
|
|
|
|
|
|
)\\d |
125
|
|
|
|
|
|
|
)\\d{5} |
126
|
|
|
|
|
|
|
', |
127
|
|
|
|
|
|
|
'mobile' => ' |
128
|
|
|
|
|
|
|
(?: |
129
|
|
|
|
|
|
|
6(?: |
130
|
|
|
|
|
|
|
[0-79]\\d| |
131
|
|
|
|
|
|
|
8[0-247-9] |
132
|
|
|
|
|
|
|
)| |
133
|
|
|
|
|
|
|
7(?: |
134
|
|
|
|
|
|
|
[017]\\d| |
135
|
|
|
|
|
|
|
2[0-2]| |
136
|
|
|
|
|
|
|
6[0-8]| |
137
|
|
|
|
|
|
|
8[0-3] |
138
|
|
|
|
|
|
|
) |
139
|
|
|
|
|
|
|
)\\d{6} |
140
|
|
|
|
|
|
|
', |
141
|
|
|
|
|
|
|
'pager' => '', |
142
|
|
|
|
|
|
|
'personal_number' => '', |
143
|
|
|
|
|
|
|
'specialrate' => '(89\\d{7})', |
144
|
|
|
|
|
|
|
'toll_free' => '80\\d{7}', |
145
|
|
|
|
|
|
|
'voip' => ' |
146
|
|
|
|
|
|
|
592(?: |
147
|
|
|
|
|
|
|
4[0-2]| |
148
|
|
|
|
|
|
|
93 |
149
|
|
|
|
|
|
|
)\\d{4} |
150
|
|
|
|
|
|
|
' |
151
|
|
|
|
|
|
|
}; |
152
|
|
|
|
|
|
|
my %areanames = (); |
153
|
|
|
|
|
|
|
$areanames{fr} = {"2125246", "Safi\/El\ Youssoufia", |
154
|
|
|
|
|
|
|
"2125399", "Tanger\/Larache\/Al\ Hoceima", |
155
|
|
|
|
|
|
|
"2125388", "Tanger\ et\ alentours", |
156
|
|
|
|
|
|
|
"2125367", "Oujda\/Bouarfa", |
157
|
|
|
|
|
|
|
"2125366", "Oujda\/Figuig", |
158
|
|
|
|
|
|
|
"212525", "Maroc\ Sud", |
159
|
|
|
|
|
|
|
"21253890", "Fès\/Maknès\ et\ alentours", |
160
|
|
|
|
|
|
|
"2125393", "Tanger", |
161
|
|
|
|
|
|
|
"2125233", "Mohammedia\/El\ Jadida", |
162
|
|
|
|
|
|
|
"212532", "Fès\/Oujda\/Meknès\/Taza\/Nador\/Errachidia", |
163
|
|
|
|
|
|
|
"212531", "Tanger\/Tétouan\/Larache\/Al\ Hoceima\/Cherfchaouen", |
164
|
|
|
|
|
|
|
"212530", "Rabat\/Kénitra", |
165
|
|
|
|
|
|
|
"2125283", "Inezgane\/Taroudannt", |
166
|
|
|
|
|
|
|
"2125285", "Taroudannt\/Oulad\ Teima", |
167
|
|
|
|
|
|
|
"2125234", "Settat", |
168
|
|
|
|
|
|
|
"212521", "Casablanca\/Maroc\ Central", |
169
|
|
|
|
|
|
|
"21252980", "Marrakech\ et\ alentours", |
170
|
|
|
|
|
|
|
"21252990", "Agadir\ et\ alentours", |
171
|
|
|
|
|
|
|
"2125380", "Rabat\ et\ alentours", |
172
|
|
|
|
|
|
|
"2125282", "Agadir\/Inezgane\/Ait\ Melou", |
173
|
|
|
|
|
|
|
"2125288", "Es\-Semara\/Agadir\/Tarfaya", |
174
|
|
|
|
|
|
|
"2125289", "Laayoune\/Dakhla",}; |
175
|
|
|
|
|
|
|
$areanames{en} = {"2125359", "Fès", |
176
|
|
|
|
|
|
|
"2125394", "Asilah", |
177
|
|
|
|
|
|
|
"2125358", "Ifrane", |
178
|
|
|
|
|
|
|
"2125227", "Casablanca", |
179
|
|
|
|
|
|
|
"2125234", "Settai", |
180
|
|
|
|
|
|
|
"2125285", "Oulad\ Teima\/Taroudant", |
181
|
|
|
|
|
|
|
"2125283", "Inezgane\/Taroudant", |
182
|
|
|
|
|
|
|
"2125374", "Ouazzane", |
183
|
|
|
|
|
|
|
"2125226", "Casablanca", |
184
|
|
|
|
|
|
|
"2125352", "Taza", |
185
|
|
|
|
|
|
|
"2125287", "Guelmim\/Tan\ Tan", |
186
|
|
|
|
|
|
|
"212521", "Casablanca\/Central\ Morocco", |
187
|
|
|
|
|
|
|
"21252980", "Marrakech\ area", |
188
|
|
|
|
|
|
|
"21252990", "Agadir\ area", |
189
|
|
|
|
|
|
|
"2125286", "Tiznit", |
190
|
|
|
|
|
|
|
"212520", "Casablanca", |
191
|
|
|
|
|
|
|
"2125225", "Casablanca", |
192
|
|
|
|
|
|
|
"2125223", "Casablanca", |
193
|
|
|
|
|
|
|
"2125229", "Casablanca", |
194
|
|
|
|
|
|
|
"2125228", "Casablanca", |
195
|
|
|
|
|
|
|
"2125357", "Goulmima", |
196
|
|
|
|
|
|
|
"2125282", "Agadir\/Ait\ Meloul\/Inezgane", |
197
|
|
|
|
|
|
|
"2125244", "Marrakech", |
198
|
|
|
|
|
|
|
"2125380", "Rabat\ area", |
199
|
|
|
|
|
|
|
"2125356", "Fès", |
200
|
|
|
|
|
|
|
"2125222", "Casablanca", |
201
|
|
|
|
|
|
|
"2125288", "Agadir\/Es\-Semara\/Tarfaya", |
202
|
|
|
|
|
|
|
"2125289", "Dakhla\/Laayoune", |
203
|
|
|
|
|
|
|
"2125355", "Meknès", |
204
|
|
|
|
|
|
|
"2125353", "Midelt", |
205
|
|
|
|
|
|
|
"2125399", "Al\ Hoceima\/Larache\/Tangier", |
206
|
|
|
|
|
|
|
"2125354", "Meknès", |
207
|
|
|
|
|
|
|
"2125398", "Al\ Hoceima\/Chefchaouen", |
208
|
|
|
|
|
|
|
"2125246", "El\ Youssoufia\/Safi", |
209
|
|
|
|
|
|
|
"2125365", "Oujda", |
210
|
|
|
|
|
|
|
"2125363", "Nador", |
211
|
|
|
|
|
|
|
"2125378", "Salé", |
212
|
|
|
|
|
|
|
"2125379", "Souk\ Larbaa", |
213
|
|
|
|
|
|
|
"2125247", "Essaouira", |
214
|
|
|
|
|
|
|
"2125220", "Casablanca", |
215
|
|
|
|
|
|
|
"212525", "Southern\ Morocco", |
216
|
|
|
|
|
|
|
"2125366", "Figuig\/Oujda", |
217
|
|
|
|
|
|
|
"2125243", "Marrakech", |
218
|
|
|
|
|
|
|
"2125232", "Mohammedia", |
219
|
|
|
|
|
|
|
"2125290", "Casablanca", |
220
|
|
|
|
|
|
|
"2125372", "Rabat", |
221
|
|
|
|
|
|
|
"2125367", "Bouarfa\/Oujda", |
222
|
|
|
|
|
|
|
"2125388", "Tangier\ area", |
223
|
|
|
|
|
|
|
"2125224", "Casablanca", |
224
|
|
|
|
|
|
|
"2125237", "Settat", |
225
|
|
|
|
|
|
|
"2125397", "Tétouan", |
226
|
|
|
|
|
|
|
"2125376", "Rabat\/Témara", |
227
|
|
|
|
|
|
|
"2125362", "Berkane", |
228
|
|
|
|
|
|
|
"2125248", "Ouarzazate", |
229
|
|
|
|
|
|
|
"21253890", "Fès\/Meknès\ areas", |
230
|
|
|
|
|
|
|
"2125396", "Fnideq\/Martil\/Mdiq", |
231
|
|
|
|
|
|
|
"2125377", "Rabat", |
232
|
|
|
|
|
|
|
"212531", "Tangier\/Al\ Hoceima\/Larache\/Tètouan\/Chefchaouen", |
233
|
|
|
|
|
|
|
"212530", "Rabat\/Kènitra", |
234
|
|
|
|
|
|
|
"212532", "Fès\/Errachidia\/Meknès\/Nador\/Oujda\/Taza", |
235
|
|
|
|
|
|
|
"2125373", "Kénitra", |
236
|
|
|
|
|
|
|
"2125375", "Khémisset", |
237
|
|
|
|
|
|
|
"2125233", "El\ Jedida\/Mohammedia", |
238
|
|
|
|
|
|
|
"2125242", "El\ Kelaa\ des\ Sraghna", |
239
|
|
|
|
|
|
|
"2125235", "Oued\ Zem", |
240
|
|
|
|
|
|
|
"2125368", "Figuig", |
241
|
|
|
|
|
|
|
"2125395", "Larache", |
242
|
|
|
|
|
|
|
"2125393", "Tangier",}; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub new { |
245
|
49
|
|
|
49
|
1
|
112
|
my $class = shift; |
246
|
49
|
|
|
|
|
90
|
my $number = shift; |
247
|
49
|
|
|
|
|
297
|
$number =~ s/(^\+212|\D)//g; |
248
|
49
|
|
|
|
|
305
|
my $self = bless({ country_code => '212', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
249
|
49
|
100
|
|
|
|
264
|
return $self if ($self->is_valid()); |
250
|
3
|
|
|
|
|
6
|
$number =~ s/^(?:0)//; |
251
|
3
|
|
|
|
|
32
|
$self = bless({ country_code => '212', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
252
|
3
|
50
|
|
|
|
11
|
return $self->is_valid() ? $self : undef; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
1; |