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   1219 use base qw(Number::Phone::StubCountry);
  2         7  
  2         261  
21              
22 2     2   39 use strict;
  2         9  
  2         59  
23 2     2   12 use warnings;
  2         12  
  2         59  
24 2     2   15 use utf8;
  2         5  
  2         11  
25             our $VERSION = 1.20230307181421;
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} = {"960339", "Vilimalé",
86             "960331", "Malé\/Hulhulé\/Aarah",
87             "960659", "Raa",
88             "960300", "Malé\/Hulhulé\/Aarah",
89             "960678", "Thaa",
90             "960689", "Addu",
91             "960672", "Meemu",
92             "960666", "Alifu\ Alifu",
93             "960335", "Hulhumalé",
94             "960682", "Gaafu\ Alifu",
95             "960660", "Baa",
96             "960664", "Kaafu",
97             "960688", "Addu",
98             "960332", "Malé\/Hulhulé\/Aarah",
99             "960658", "Raa",
100             "960333", "Malé\/Hulhulé\/Aarah",
101             "960652", "Haa\ Dhaalu",
102             "960654", "Shaviyani",
103             "960650", "Haa\ Alifu",
104             "960665", "Kaafu",
105             "960656", "Noonu",
106             "960334", "Malé\/Hulhulé\/Aarah",
107             "960330", "Malé\/Hulhulé\/Aarah",
108             "960680", "Laamu",
109             "960684", "Gaafu\ Dhaalu",
110             "960668", "Alifu\ Dhaalu",
111             "960662", "Lhaviyani",
112             "960686", "Gnaviyani",
113             "960301", "Malé\/Hulhulé\/Aarah",
114             "960303", "Malé\ Region",
115             "960674", "Faafu",
116             "960670", "Vaavu",
117             "960302", "Malé\ Region",
118             "960676", "Dhaalu",};
119              
120             sub new {
121 16     16 1 43 my $class = shift;
122 16         34 my $number = shift;
123 16         116 $number =~ s/(^\+960|\D)//g;
124 16         101 my $self = bless({ country_code => '960', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
125 16 100       102 return $self->is_valid() ? $self : undef;
126             }
127             1;