File Coverage

blib/lib/Number/Phone/StubCountry/YE.pm
Criterion Covered Total %
statement 20 20 100.0
branch 3 4 75.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 29 30 96.6


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::YE;
20 2     2   1260 use base qw(Number::Phone::StubCountry);
  2         6  
  2         267  
21              
22 2     2   36 use strict;
  2         12  
  2         52  
23 2     2   14 use warnings;
  2         6  
  2         58  
24 2     2   13 use utf8;
  2         6  
  2         17  
25             our $VERSION = 1.20230307181423;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3',
30             'leading_digits' => '
31             [1-6]|
32             7(?:
33             [24-6]|
34             8[0-7]
35             )
36             ',
37             'national_rule' => '0$1',
38             'pattern' => '(\\d)(\\d{3})(\\d{3,4})'
39             },
40             {
41             'format' => '$1 $2 $3',
42             'leading_digits' => '7',
43             'national_rule' => '0$1',
44             'pattern' => '(\\d{3})(\\d{3})(\\d{3})'
45             }
46             ];
47              
48             my $validators = {
49             'fixed_line' => '
50             78[0-7]\\d{4}|
51             17\\d{6}|
52             (?:
53             [12][2-68]|
54             3[2358]|
55             4[2-58]|
56             5[2-6]|
57             6[3-58]|
58             7[24-6]
59             )\\d{5}
60             ',
61             'geographic' => '
62             78[0-7]\\d{4}|
63             17\\d{6}|
64             (?:
65             [12][2-68]|
66             3[2358]|
67             4[2-58]|
68             5[2-6]|
69             6[3-58]|
70             7[24-6]
71             )\\d{5}
72             ',
73             'mobile' => '7[01378]\\d{7}',
74             'pager' => '',
75             'personal_number' => '',
76             'specialrate' => '',
77             'toll_free' => '',
78             'voip' => ''
79             };
80             my %areanames = ();
81             $areanames{en} = {"967653", "Al\ Baidha",
82             "9676867", "Dhamar",
83             "967636", "Maareb",
84             "9676850", "Al\ Baidha",
85             "9677877", "Amran",
86             "96743", "Taiz",
87             "96725", "Lahj",
88             "967683", "Maareb",
89             "967630", "Maareb",
90             "96764", "Dhamar",
91             "96754", "Hadhrmout",
92             "96775", "Saadah",
93             "9676865", "Dhamar",
94             "967284", "Dhalea",
95             "9677875", "Saadah",
96             "967485", "Ibb",
97             "9671", "Sanaa",
98             "967651", "Dhamar",
99             "967285", "Lahj",
100             "967484", "Ibb",
101             "967282", "Aden",
102             "9677845", "Al\ Mahweet",
103             "9674843", "Taiz",
104             "96752", "Shabwah",
105             "9676868", "Al\ Baidha",
106             "9677878", "Saadah",
107             "967633", "Maareb",
108             "9676863", "Maareb",
109             "967656", "Al\ Baidha",
110             "967785", "Saadah",
111             "9677873", "Hajjah",
112             "967650", "Dhamar",
113             "96723", "Aden",
114             "96745", "Ibb",
115             "9676861", "Dhamar",
116             "96753", "Hadhrmout",
117             "967652", "Al\ Baidha",
118             "967657", "Al\ Baidha",
119             "9677871", "Hajjah",
120             "967682", "Dhamar",
121             "9676862", "Al\ Baidha",
122             "9677879", "Al\ Mahweet",
123             "9677872", "Hajjah",
124             "967786", "Amran",
125             "967634", "Aljawf",
126             "967655", "Al\ Baidha",
127             "9676869", "Al\ Baidha",
128             "96722", "Aden",
129             "9676853", "Al\ Baidha",
130             "96772", "Hajjah",
131             "967286", "Abyan",
132             "967566", "Soqatrah",
133             "9674841", "Taiz",
134             "967280", "Aden",
135             "9672840", "Aden",
136             "967483", "Taiz",
137             "9674842", "Taiz",
138             "96744", "Ibb",
139             "967433", "Ibb",
140             "96776", "Amran",
141             "9674840", "Taiz",
142             "9673", "Hodaidah",
143             "967639", "Dhamar",
144             "96724", "Dhalea",
145             "967283", "Aden",
146             "9676864", "Dhamar",
147             "967281", "Aden",
148             "96774", "Al\ Mahweet",
149             "96755", "Hadhrmout",
150             "967638", "Maareb",
151             "967684", "Dhamar",
152             "9677874", "Al\ Mahweet",
153             "9677870", "Hajjah",
154             "96726", "Abyan",
155             "9676866", "Dhamar",
156             "9676860", "Al\ Baidha",
157             "96742", "Taiz",
158             "967654", "Al\ Baidha",
159             "9677876", "Amran",};
160              
161             sub new {
162 7     7 1 26 my $class = shift;
163 7         15 my $number = shift;
164 7         46 $number =~ s/(^\+967|\D)//g;
165 7         39 my $self = bless({ country_code => '967', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
166 7 100       34 return $self if ($self->is_valid());
167 1         19 $number =~ s/^(?:0)//;
168 1         12 $self = bless({ country_code => '967', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
169 1 50       5 return $self->is_valid() ? $self : undef;
170             }
171             1;