File Coverage

blib/lib/Number/Phone/StubCountry/GW.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::GW;
20 2     2   1370 use base qw(Number::Phone::StubCountry);
  2         6  
  2         290  
21              
22 2     2   15 use strict;
  2         5  
  2         48  
23 2     2   11 use warnings;
  2         5  
  2         58  
24 2     2   11 use utf8;
  2         7  
  2         16  
25             our $VERSION = 1.20230903131447;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2',
30             'leading_digits' => '40',
31             'pattern' => '(\\d{3})(\\d{4})'
32             },
33             {
34             'format' => '$1 $2 $3',
35             'leading_digits' => '[49]',
36             'pattern' => '(\\d{3})(\\d{3})(\\d{3})'
37             }
38             ];
39              
40             my $validators = {
41             'fixed_line' => '443\\d{6}',
42             'geographic' => '443\\d{6}',
43             'mobile' => '
44             9(?:
45             5\\d|
46             6[569]|
47             77
48             )\\d{6}
49             ',
50             'pager' => '',
51             'personal_number' => '',
52             'specialrate' => '',
53             'toll_free' => '',
54             'voip' => '40\\d{5}'
55             };
56             my %areanames = ();
57             $areanames{en} = {"24544322", "St\.\ Luzia",
58             "24544320", "Bissau",
59             "24544391", "Canchungo",
60             "24544335", "Farim",
61             "24544370", "Buba",
62             "24544394", "Bula",
63             "24544393", "S\.\ Domingos",
64             "24544342", "Bambadinca",
65             "24544331", "Mansôa",
66             "24544396", "Ingoré",
67             "24544397", "Bigene",
68             "24544334", "Mansaba",
69             "24544352", "Sonaco",
70             "24544321", "Bissau",
71             "24544341", "Bafatá",
72             "24544392", "Cacheu",
73             "24544332", "Bissora",
74             "24544351", "Gabu",
75             "24544353", "Pirada",
76             "24544354", "Pitche",
77             "24544325", "Brá",};
78             $areanames{pt} = {"245325", "Brá",
79             "245335", "Farim",
80             "245353", "Pirada",
81             "245331", "Mansôa",
82             "245370", "Buba",
83             "245321", "Bissau",
84             "245392", "Cacheu",
85             "245394", "Bula",
86             "245391", "Canchungo",
87             "245322", "Sta\.\ Luzia",
88             "245334", "Mansaba",
89             "245332", "Bigene\/Bissorã",
90             "245351", "Gabú",
91             "245320", "Bissau",
92             "245352", "Sonaco",
93             "245354", "Pitche",
94             "245396", "Ingoré",
95             "245393", "S\.\ Domingos",
96             "245341", "Bafatá",
97             "245342", "Bambadinca",};
98              
99             sub new {
100 10     10 1 44 my $class = shift;
101 10         19 my $number = shift;
102 10         63 $number =~ s/(^\+245|\D)//g;
103 10         74 my $self = bless({ country_code => '245', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
104 10 100       58 return $self->is_valid() ? $self : undef;
105             }
106             1;