File Coverage

blib/lib/Number/Phone/StubCountry/MV.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 25 100.0


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::MV;
20 2     2   1470 use base qw(Number::Phone::StubCountry);
  2         7  
  2         276  
21              
22 2     2   18 use strict;
  2         7  
  2         52  
23 2     2   14 use warnings;
  2         4  
  2         59  
24 2     2   11 use utf8;
  2         6  
  2         16  
25             our $VERSION = 1.20230614174404;
26              
27             my $formatters = [
28             {
29             'format' => '$1-$2',
30             'leading_digits' => '[34679]',
31             'pattern' => '(\\d{3})(\\d{4})'
32             },
33             {
34             'format' => '$1 $2 $3',
35             'leading_digits' => '[89]',
36             'pattern' => '(\\d{3})(\\d{3})(\\d{4})'
37             }
38             ];
39              
40             my $validators = {
41             'fixed_line' => '
42             (?:
43             3(?:
44             0[0-3]|
45             3[0-59]
46             )|
47             6(?:
48             [58][024689]|
49             6[024-68]|
50             7[02468]
51             )
52             )\\d{4}
53             ',
54             'geographic' => '
55             (?:
56             3(?:
57             0[0-3]|
58             3[0-59]
59             )|
60             6(?:
61             [58][024689]|
62             6[024-68]|
63             7[02468]
64             )
65             )\\d{4}
66             ',
67             'mobile' => '
68             (?:
69             46[46]|
70             [79]\\d\\d
71             )\\d{4}
72             ',
73             'pager' => '',
74             'personal_number' => '',
75             'specialrate' => '(900\\d{7})|(
76             4(?:
77             0[01]|
78             50
79             )\\d{4}
80             )',
81             'toll_free' => '800\\d{7}',
82             'voip' => ''
83             };
84             my %areanames = ();
85             $areanames{en} = {"960682", "Gaafu\ Alifu",
86             "960674", "Faafu",
87             "960680", "Laamu",
88             "960689", "Addu",
89             "960302", "Malé\ Region",
90             "960684", "Gaafu\ Dhaalu",
91             "960668", "Alifu\ Dhaalu",
92             "960672", "Meemu",
93             "960670", "Vaavu",
94             "960301", "Malé\/Hulhulé\/Aarah",
95             "960658", "Raa",
96             "960300", "Malé\/Hulhulé\/Aarah",
97             "960332", "Malé\/Hulhulé\/Aarah",
98             "960654", "Shaviyani",
99             "960659", "Raa",
100             "960331", "Malé\/Hulhulé\/Aarah",
101             "960688", "Addu",
102             "960664", "Kaafu",
103             "960665", "Kaafu",
104             "960330", "Malé\/Hulhulé\/Aarah",
105             "960335", "Hulhumalé",
106             "960339", "Vilimalé",
107             "960660", "Baa",
108             "960334", "Malé\/Hulhulé\/Aarah",
109             "960652", "Haa\ Dhaalu",
110             "960650", "Haa\ Alifu",
111             "960678", "Thaa",
112             "960662", "Lhaviyani",
113             "960656", "Noonu",
114             "960303", "Malé\ Region",
115             "960666", "Alifu\ Alifu",
116             "960686", "Gnaviyani",
117             "960333", "Malé\/Hulhulé\/Aarah",
118             "960676", "Dhaalu",};
119              
120             sub new {
121 16     16 1 39 my $class = shift;
122 16         22 my $number = shift;
123 16         104 $number =~ s/(^\+960|\D)//g;
124 16         100 my $self = bless({ country_code => '960', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
125 16 100       85 return $self->is_valid() ? $self : undef;
126             }
127             1;