File Coverage

blib/lib/Number/Phone/StubCountry/BJ.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::BJ;
20 2     2   1169 use base qw(Number::Phone::StubCountry);
  2         7  
  2         213  
21              
22 2     2   19 use strict;
  2         6  
  2         47  
23 2     2   13 use warnings;
  2         5  
  2         53  
24 2     2   10 use utf8;
  2         5  
  2         15  
25             our $VERSION = 1.20230307181417;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3 $4',
30             'leading_digits' => '[24-689]',
31             'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})'
32             }
33             ];
34              
35             my $validators = {
36             'fixed_line' => '
37             2(?:
38             02|
39             1[037]|
40             2[45]|
41             3[68]|
42             4\\d
43             )\\d{5}
44             ',
45             'geographic' => '
46             2(?:
47             02|
48             1[037]|
49             2[45]|
50             3[68]|
51             4\\d
52             )\\d{5}
53             ',
54             'mobile' => '
55             (?:
56             4[0-2]|
57             [56]\\d|
58             9[013-9]
59             )\\d{6}
60             ',
61             'pager' => '',
62             'personal_number' => '',
63             'specialrate' => '(81\\d{6})',
64             'toll_free' => '',
65             'voip' => '857[58]\\d{4}'
66             };
67             my %areanames = ();
68             $areanames{fr} = {"2292259", "Départements\ Mono\/Couffo\/Zou\/Collines",
69             "2292139", "Départements\ Littoral\/Atlantique",
70             "2292029", "Départements\ Ouémé\/Plateau",
71             "2292249", "Départements\ Mono\/Couffo\/Zou\/Collines",};
72             $areanames{en} = {"2292365", "Banikoara",
73             "2292021", "Ongala",
74             "2292255", "Savè",
75             "2292029", "Ouémé\/Plateau\ departments",
76             "2292022", "Kandiévé",
77             "2292027", "Adjohoun",
78             "2292135", "Godomey",
79             "2292139", "Littoral\/Atlantique\ departments",
80             "2292383", "Tanguiéta",
81             "2292361", "Parakou",
82             "2292251", "Bohicon",
83             "2292380", "Djougou",
84             "2292025", "Pobè\/Kétou",
85             "2292132", "Jéricho",
86             "2292137", "Allada",
87             "2292259", "Mono\/Kouffo\/Zou\/Collines\ departments",
88             "2292367", "Malanville",
89             "2292362", "Nikki\/Ndali",
90             "2292246", "Dogbo",
91             "2292252", "Covè",
92             "2292131", "Ganhi",
93             "2292243", "Come",
94             "2292382", "Natitingou",
95             "2292130", "Cadjehoun",
96             "2292254", "Savalou",
97             "2292136", "Abomey\-Calaci",
98             "22924", "Tanguiéta",
99             "2292133", "Akpakpa",
100             "2292241", "Lokossa",
101             "2292250", "Abomey",
102             "2292249", "Mono\/Kouffo\/Zou\/Collines\ departments",
103             "2292363", "Kandi\/Gogounou\/Ségbana",
104             "2292253", "Dassa\-Zoumé",
105             "2292134", "Ouidah",
106             "2292138", "Kouhounou",
107             "2292024", "Sèmè",
108             "2292026", "Sakété\/Igolo",};
109              
110             sub new {
111 13     13 1 28 my $class = shift;
112 13         22 my $number = shift;
113 13         76 $number =~ s/(^\+229|\D)//g;
114 13         73 my $self = bless({ country_code => '229', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
115 13 100       57 return $self->is_valid() ? $self : undef;
116             }
117             1;