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