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
|
|
1663
|
use base qw(Number::Phone::StubCountry); |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
325
|
|
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
3
|
|
46
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
71
|
|
23
|
3
|
|
|
3
|
|
23
|
use warnings; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
117
|
|
24
|
3
|
|
|
3
|
|
30
|
use utf8; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
18
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230903131448; |
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{en} = {"2125396", "Fnideq\/Martil\/Mdiq", |
154
|
|
|
|
|
|
|
"2125237", "Settat", |
155
|
|
|
|
|
|
|
"2125229", "Casablanca", |
156
|
|
|
|
|
|
|
"2125395", "Larache", |
157
|
|
|
|
|
|
|
"2125353", "Midelt", |
158
|
|
|
|
|
|
|
"2125366", "Figuig\/Oujda", |
159
|
|
|
|
|
|
|
"2125287", "Guelmim\/Tan\ Tan", |
160
|
|
|
|
|
|
|
"212532", "Fès\/Errachidia\/Meknès\/Nador\/Oujda\/Taza", |
161
|
|
|
|
|
|
|
"2125394", "Asilah", |
162
|
|
|
|
|
|
|
"2125378", "Salé", |
163
|
|
|
|
|
|
|
"2125365", "Oujda", |
164
|
|
|
|
|
|
|
"2125393", "Tangier", |
165
|
|
|
|
|
|
|
"2125355", "Meknès", |
166
|
|
|
|
|
|
|
"2125222", "Casablanca", |
167
|
|
|
|
|
|
|
"2125247", "Essaouira", |
168
|
|
|
|
|
|
|
"2125356", "Fès", |
169
|
|
|
|
|
|
|
"2125290", "Casablanca", |
170
|
|
|
|
|
|
|
"2125363", "Nador", |
171
|
|
|
|
|
|
|
"2125354", "Meknès", |
172
|
|
|
|
|
|
|
"2125232", "Mohammedia", |
173
|
|
|
|
|
|
|
"21253890", "Fès\/Meknès\ areas", |
174
|
|
|
|
|
|
|
"2125388", "Tangier\ area", |
175
|
|
|
|
|
|
|
"2125374", "Ouazzane", |
176
|
|
|
|
|
|
|
"2125398", "Al\ Hoceima\/Chefchaouen", |
177
|
|
|
|
|
|
|
"2125376", "Rabat\/Témara", |
178
|
|
|
|
|
|
|
"212531", "Tangier\/Al\ Hoceima\/Larache\/Tètouan\/Chefchaouen", |
179
|
|
|
|
|
|
|
"2125282", "Agadir\/Ait\ Meloul\/Inezgane", |
180
|
|
|
|
|
|
|
"2125375", "Khémisset", |
181
|
|
|
|
|
|
|
"2125368", "Figuig", |
182
|
|
|
|
|
|
|
"2125220", "Casablanca", |
183
|
|
|
|
|
|
|
"2125358", "Ifrane", |
184
|
|
|
|
|
|
|
"2125242", "El\ Kelaa\ des\ Sraghna", |
185
|
|
|
|
|
|
|
"2125227", "Casablanca", |
186
|
|
|
|
|
|
|
"212530", "Rabat\/Kènitra", |
187
|
|
|
|
|
|
|
"2125373", "Kénitra", |
188
|
|
|
|
|
|
|
"2125289", "Dakhla\/Laayoune", |
189
|
|
|
|
|
|
|
"21252980", "Marrakech\ area", |
190
|
|
|
|
|
|
|
"2125372", "Rabat", |
191
|
|
|
|
|
|
|
"2125285", "Oulad\ Teima\/Taroudant", |
192
|
|
|
|
|
|
|
"2125286", "Tiznit", |
193
|
|
|
|
|
|
|
"2125234", "Settai", |
194
|
|
|
|
|
|
|
"2125367", "Bouarfa\/Oujda", |
195
|
|
|
|
|
|
|
"2125243", "Marrakech", |
196
|
|
|
|
|
|
|
"2125397", "Tétouan", |
197
|
|
|
|
|
|
|
"2125235", "Oued\ Zem", |
198
|
|
|
|
|
|
|
"2125380", "Rabat\ area", |
199
|
|
|
|
|
|
|
"2125244", "Marrakech", |
200
|
|
|
|
|
|
|
"2125379", "Souk\ Larbaa", |
201
|
|
|
|
|
|
|
"2125283", "Inezgane\/Taroudant", |
202
|
|
|
|
|
|
|
"2125357", "Goulmima", |
203
|
|
|
|
|
|
|
"2125233", "El\ Jedida\/Mohammedia", |
204
|
|
|
|
|
|
|
"2125246", "El\ Youssoufia\/Safi", |
205
|
|
|
|
|
|
|
"2125228", "Casablanca", |
206
|
|
|
|
|
|
|
"212525", "Southern\ Morocco", |
207
|
|
|
|
|
|
|
"2125288", "Agadir\/Es\-Semara\/Tarfaya", |
208
|
|
|
|
|
|
|
"2125362", "Berkane", |
209
|
|
|
|
|
|
|
"21252990", "Agadir\ area", |
210
|
|
|
|
|
|
|
"2125377", "Rabat", |
211
|
|
|
|
|
|
|
"2125359", "Fès", |
212
|
|
|
|
|
|
|
"2125223", "Casablanca", |
213
|
|
|
|
|
|
|
"212521", "Casablanca\/Central\ Morocco", |
214
|
|
|
|
|
|
|
"2125224", "Casablanca", |
215
|
|
|
|
|
|
|
"212520", "Casablanca", |
216
|
|
|
|
|
|
|
"2125226", "Casablanca", |
217
|
|
|
|
|
|
|
"2125248", "Ouarzazate", |
218
|
|
|
|
|
|
|
"2125399", "Al\ Hoceima\/Larache\/Tangier", |
219
|
|
|
|
|
|
|
"2125225", "Casablanca", |
220
|
|
|
|
|
|
|
"2125352", "Taza",}; |
221
|
|
|
|
|
|
|
$areanames{fr} = {"2125233", "Mohammedia\/El\ Jadida", |
222
|
|
|
|
|
|
|
"2125246", "Safi\/El\ Youssoufia", |
223
|
|
|
|
|
|
|
"2125380", "Rabat\ et\ alentours", |
224
|
|
|
|
|
|
|
"2125283", "Inezgane\/Taroudannt", |
225
|
|
|
|
|
|
|
"2125285", "Taroudannt\/Oulad\ Teima", |
226
|
|
|
|
|
|
|
"2125367", "Oujda\/Bouarfa", |
227
|
|
|
|
|
|
|
"2125234", "Settat", |
228
|
|
|
|
|
|
|
"2125399", "Tanger\/Larache\/Al\ Hoceima", |
229
|
|
|
|
|
|
|
"212521", "Casablanca\/Maroc\ Central", |
230
|
|
|
|
|
|
|
"212525", "Maroc\ Sud", |
231
|
|
|
|
|
|
|
"2125288", "Es\-Semara\/Agadir\/Tarfaya", |
232
|
|
|
|
|
|
|
"21252990", "Agadir\ et\ alentours", |
233
|
|
|
|
|
|
|
"2125393", "Tanger", |
234
|
|
|
|
|
|
|
"2125366", "Oujda\/Figuig", |
235
|
|
|
|
|
|
|
"212532", "Fès\/Oujda\/Meknès\/Taza\/Nador\/Errachidia", |
236
|
|
|
|
|
|
|
"2125289", "Laayoune\/Dakhla", |
237
|
|
|
|
|
|
|
"21252980", "Marrakech\ et\ alentours", |
238
|
|
|
|
|
|
|
"212530", "Rabat\/Kénitra", |
239
|
|
|
|
|
|
|
"212531", "Tanger\/Tétouan\/Larache\/Al\ Hoceima\/Cherfchaouen", |
240
|
|
|
|
|
|
|
"2125282", "Agadir\/Inezgane\/Ait\ Melou", |
241
|
|
|
|
|
|
|
"21253890", "Fès\/Maknès\ et\ alentours", |
242
|
|
|
|
|
|
|
"2125388", "Tanger\ et\ alentours",}; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub new { |
245
|
49
|
|
|
49
|
1
|
117
|
my $class = shift; |
246
|
49
|
|
|
|
|
80
|
my $number = shift; |
247
|
49
|
|
|
|
|
302
|
$number =~ s/(^\+212|\D)//g; |
248
|
49
|
|
|
|
|
269
|
my $self = bless({ country_code => '212', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
249
|
49
|
100
|
|
|
|
218
|
return $self if ($self->is_valid()); |
250
|
3
|
|
|
|
|
8
|
$number =~ s/^(?:0)//; |
251
|
3
|
|
|
|
|
35
|
$self = bless({ country_code => '212', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
252
|
3
|
50
|
|
|
|
13
|
return $self->is_valid() ? $self : undef; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
1; |