File Coverage

blib/lib/Number/Phone/StubCountry/SN.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::SN;
20 2     2   1120 use base qw(Number::Phone::StubCountry);
  2         13  
  2         222  
21              
22 2     2   17 use strict;
  2         8  
  2         47  
23 2     2   9 use warnings;
  2         8  
  2         53  
24 2     2   13 use utf8;
  2         4  
  2         14  
25             our $VERSION = 1.20230307181422;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3 $4',
30             'leading_digits' => '8',
31             'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})'
32             },
33             {
34             'format' => '$1 $2 $3 $4',
35             'leading_digits' => '[379]',
36             'pattern' => '(\\d{2})(\\d{3})(\\d{2})(\\d{2})'
37             }
38             ];
39              
40             my $validators = {
41             'fixed_line' => '
42             3(?:
43             0(?:
44             1[0-2]|
45             80
46             )|
47             282|
48             3(?:
49             8[1-9]|
50             9[3-9]
51             )|
52             611
53             )\\d{5}
54             ',
55             'geographic' => '
56             3(?:
57             0(?:
58             1[0-2]|
59             80
60             )|
61             282|
62             3(?:
63             8[1-9]|
64             9[3-9]
65             )|
66             611
67             )\\d{5}
68             ',
69             'mobile' => '
70             7(?:
71             (?:
72             [06-8]\\d|
73             21|
74             90
75             )\\d|
76             5(?:
77             01|
78             [19]0|
79             25|
80             [38]3|
81             [4-7]\\d
82             )
83             )\\d{5}
84             ',
85             'pager' => '',
86             'personal_number' => '',
87             'specialrate' => '(81[02468]\\d{6})|(88[4689]\\d{6})',
88             'toll_free' => '800\\d{6}',
89             'voip' => '
90             (?:
91             3(?:
92             392|
93             9[01]\\d
94             )\\d|
95             93(?:
96             3[13]0|
97             929
98             )
99             )\\d{4}
100             '
101             };
102             my %areanames = ();
103             $areanames{en} = {"2213399", "Outside\ Dakar",
104             "221338", "Dakar",
105             "2213397", "Outside\ Dakar",
106             "2213393", "Outside\ Dakar",
107             "2213396", "Outside\ Dakar",
108             "2213394", "Outside\ Dakar",
109             "2213398", "Outside\ Dakar",
110             "2213395", "Outside\ Dakar",};
111              
112             sub new {
113 19     19 1 41 my $class = shift;
114 19         36 my $number = shift;
115 19         122 $number =~ s/(^\+221|\D)//g;
116 19         102 my $self = bless({ country_code => '221', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
117 19 100       92 return $self->is_valid() ? $self : undef;
118             }
119             1;