File Coverage

blib/lib/Number/Phone/StubCountry/GN.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::GN;
20 2     2   1228 use base qw(Number::Phone::StubCountry);
  2         6  
  2         224  
21              
22 2     2   16 use strict;
  2         7  
  2         46  
23 2     2   11 use warnings;
  2         4  
  2         49  
24 2     2   16 use utf8;
  2         6  
  2         13  
25             our $VERSION = 1.20230614174403;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3 $4',
30             'leading_digits' => '3',
31             'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})'
32             },
33             {
34             'format' => '$1 $2 $3 $4',
35             'leading_digits' => '[67]',
36             'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})'
37             }
38             ];
39              
40             my $validators = {
41             'fixed_line' => '
42             3(?:
43             0(?:
44             24|
45             3[12]|
46             4[1-35-7]|
47             5[13]|
48             6[189]|
49             [78]1|
50             9[1478]
51             )|
52             1\\d\\d
53             )\\d{4}
54             ',
55             'geographic' => '
56             3(?:
57             0(?:
58             24|
59             3[12]|
60             4[1-35-7]|
61             5[13]|
62             6[189]|
63             [78]1|
64             9[1478]
65             )|
66             1\\d\\d
67             )\\d{4}
68             ',
69             'mobile' => '6[0-356]\\d{7}',
70             'pager' => '',
71             'personal_number' => '',
72             'specialrate' => '',
73             'toll_free' => '',
74             'voip' => '722\\d{6}'
75             };
76             my %areanames = ();
77             $areanames{en} = {"224302", "Fria",
78             "224307", "Kankan",
79             "2243091", "N\'Zérékoré",
80             "2243051", "Labé",
81             "2243041", "Conakry",
82             "2243042", "Sangoya",
83             "2243043", "Conakry",
84             "2243031", "Boké",
85             "2243045", "Conakry",
86             "2243053", "Pita",
87             "2243032", "Kamsar",
88             "2243069", "Dalaba",
89             "2243068", "Mamou",
90             "22430613", "Télimélé",
91             "2243097", "Guéckédou",
92             "2243047", "Conakry",
93             "224308", "Faranah",
94             "2243094", "Macenta",
95             "2243098", "Kissidougou",
96             "2243046", "Boussoura",
97             "2243061", "Kindia",};
98              
99             sub new {
100 10     10 1 19 my $class = shift;
101 10         19 my $number = shift;
102 10         69 $number =~ s/(^\+224|\D)//g;
103 10         74 my $self = bless({ country_code => '224', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
104 10 100       61 return $self->is_valid() ? $self : undef;
105             }
106             1;