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   1301 use base qw(Number::Phone::StubCountry);
  2         9  
  2         286  
21              
22 2     2   15 use strict;
  2         6  
  2         72  
23 2     2   14 use warnings;
  2         7  
  2         77  
24 2     2   13 use utf8;
  2         5  
  2         16  
25             our $VERSION = 1.20230614174403;
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} = {"24544335", "Farim",
58             "24544396", "Ingoré",
59             "24544352", "Sonaco",
60             "24544320", "Bissau",
61             "24544341", "Bafatá",
62             "24544332", "Bissora",
63             "24544391", "Canchungo",
64             "24544354", "Pitche",
65             "24544334", "Mansaba",
66             "24544393", "S\.\ Domingos",
67             "24544322", "St\.\ Luzia",
68             "24544325", "Brá",
69             "24544370", "Buba",
70             "24544353", "Pirada",
71             "24544394", "Bula",
72             "24544321", "Bissau",
73             "24544331", "Mansôa",
74             "24544397", "Bigene",
75             "24544342", "Bambadinca",
76             "24544351", "Gabu",
77             "24544392", "Cacheu",};
78             $areanames{pt} = {"245392", "Cacheu",
79             "245391", "Canchungo",
80             "245393", "S\.\ Domingos",
81             "245394", "Bula",
82             "245370", "Buba",
83             "245320", "Bissau",
84             "245396", "Ingoré",
85             "245341", "Bafatá",
86             "245321", "Bissau",
87             "245354", "Pitche",
88             "245335", "Farim",
89             "245342", "Bambadinca",
90             "245322", "Sta\.\ Luzia",
91             "245334", "Mansaba",
92             "245351", "Gabú",
93             "245353", "Pirada",
94             "245331", "Mansôa",
95             "245352", "Sonaco",
96             "245325", "Brá",
97             "245332", "Bigene\/Bissorã",};
98              
99             sub new {
100 10     10 1 34 my $class = shift;
101 10         23 my $number = shift;
102 10         65 $number =~ s/(^\+245|\D)//g;
103 10         79 my $self = bless({ country_code => '245', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
104 10 100       69 return $self->is_valid() ? $self : undef;
105             }
106             1;