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   1104 use base qw(Number::Phone::StubCountry);
  2         6  
  2         216  
21              
22 2     2   16 use strict;
  2         9  
  2         48  
23 2     2   11 use warnings;
  2         6  
  2         47  
24 2     2   13 use utf8;
  2         4  
  2         10  
25             our $VERSION = 1.20230614174401;
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-356]|
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} = {"2292139", "Départements\ Littoral\/Atlantique",
69             "2292029", "Départements\ Ouémé\/Plateau",
70             "2292259", "Départements\ Mono\/Couffo\/Zou\/Collines",
71             "2292249", "Départements\ Mono\/Couffo\/Zou\/Collines",};
72             $areanames{en} = {"2292241", "Lokossa",
73             "2292252", "Covè",
74             "2292251", "Bohicon",
75             "2292026", "Sakété\/Igolo",
76             "2292135", "Godomey",
77             "2292133", "Akpakpa",
78             "2292130", "Cadjehoun",
79             "2292027", "Adjohoun",
80             "2292249", "Mono\/Kouffo\/Zou\/Collines\ departments",
81             "2292362", "Nikki\/Ndali",
82             "22924", "Tanguiéta",
83             "2292361", "Parakou",
84             "2292259", "Mono\/Kouffo\/Zou\/Collines\ departments",
85             "2292254", "Savalou",
86             "2292136", "Abomey\-Calaci",
87             "2292380", "Djougou",
88             "2292025", "Pobè\/Kétou",
89             "2292383", "Tanguiéta",
90             "2292137", "Allada",
91             "2292250", "Abomey",
92             "2292367", "Malanville",
93             "2292131", "Ganhi",
94             "2292132", "Jéricho",
95             "2292029", "Ouémé\/Plateau\ departments",
96             "2292024", "Sèmè",
97             "2292253", "Dassa\-Zoumé",
98             "2292255", "Savè",
99             "2292243", "Come",
100             "2292382", "Natitingou",
101             "2292139", "Littoral\/Atlantique\ departments",
102             "2292021", "Ongala",
103             "2292022", "Kandiévé",
104             "2292134", "Ouidah",
105             "2292138", "Kouhounou",
106             "2292246", "Dogbo",
107             "2292363", "Kandi\/Gogounou\/Ségbana",
108             "2292365", "Banikoara",};
109              
110             sub new {
111 13     13 1 37 my $class = shift;
112 13         29 my $number = shift;
113 13         83 $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       64 return $self->is_valid() ? $self : undef;
116             }
117             1;