File Coverage

blib/lib/Number/Phone/StubCountry/FJ.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::FJ;
20 2     2   1051 use base qw(Number::Phone::StubCountry);
  2         6  
  2         209  
21              
22 2     2   16 use strict;
  2         6  
  2         43  
23 2     2   10 use warnings;
  2         8  
  2         51  
24 2     2   11 use utf8;
  2         5  
  2         13  
25             our $VERSION = 1.20230307181420;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2',
30             'leading_digits' => '
31             [235-9]|
32             45
33             ',
34             'pattern' => '(\\d{3})(\\d{4})'
35             },
36             {
37             'format' => '$1 $2 $3',
38             'pattern' => '(\\d{4})(\\d{3})(\\d{4})'
39             }
40             ];
41              
42             my $validators = {
43             'fixed_line' => '
44             603\\d{4}|
45             (?:
46             3[0-5]|
47             6[25-7]|
48             8[58]
49             )\\d{5}
50             ',
51             'geographic' => '
52             603\\d{4}|
53             (?:
54             3[0-5]|
55             6[25-7]|
56             8[58]
57             )\\d{5}
58             ',
59             'mobile' => '
60             (?:
61             [279]\\d|
62             45|
63             5[01568]|
64             8[034679]
65             )\\d{5}
66             ',
67             'pager' => '',
68             'personal_number' => '',
69             'specialrate' => '',
70             'toll_free' => '0800\\d{7}',
71             'voip' => ''
72             };
73             my %areanames = ();
74             $areanames{en} = {"67988", "Vanua\ Levu",
75             "67985", "Vanua\ Levu",
76             "67967", "Nadi",
77             "67965", "Coral\ Coast\/Sigatoka",
78             "6793", "Suva\ City\/Nausori\/Korovou",
79             "67966", "Lautoka\/Ba\/Vatukoula\/Tavua\/Rakiraki",};
80              
81             sub new {
82 10     10 1 26 my $class = shift;
83 10         17 my $number = shift;
84 10         58 $number =~ s/(^\+679|\D)//g;
85 10         53 my $self = bless({ country_code => '679', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
86 10 100       45 return $self->is_valid() ? $self : undef;
87             }
88             1;