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   1240 use base qw(Number::Phone::StubCountry);
  2         9  
  2         234  
21              
22 2     2   15 use strict;
  2         5  
  2         70  
23 2     2   18 use warnings;
  2         7  
  2         63  
24 2     2   16 use utf8;
  2         6  
  2         13  
25             our $VERSION = 1.20230903131449;
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} = {"9676869", "Al\ Baidha",
82             "9677872", "Hajjah",
83             "96725", "Lahj",
84             "9674843", "Taiz",
85             "967652", "Al\ Baidha",
86             "96745", "Ibb",
87             "967282", "Aden",
88             "9677879", "Al\ Mahweet",
89             "96764", "Dhamar",
90             "9676862", "Al\ Baidha",
91             "9673", "Hodaidah",
92             "967657", "Al\ Baidha",
93             "967485", "Ibb",
94             "96774", "Al\ Mahweet",
95             "967285", "Lahj",
96             "9677877", "Amran",
97             "967655", "Al\ Baidha",
98             "9674841", "Taiz",
99             "967281", "Aden",
100             "967654", "Al\ Baidha",
101             "9676860", "Al\ Baidha",
102             "967484", "Ibb",
103             "96754", "Hadhrmout",
104             "967651", "Dhamar",
105             "967284", "Dhalea",
106             "9676867", "Dhamar",
107             "96722", "Aden",
108             "967650", "Dhamar",
109             "96742", "Taiz",
110             "967566", "Soqatrah",
111             "967280", "Aden",
112             "9676850", "Al\ Baidha",
113             "967433", "Ibb",
114             "96726", "Abyan",
115             "967653", "Al\ Baidha",
116             "967656", "Al\ Baidha",
117             "967483", "Taiz",
118             "967286", "Abyan",
119             "9677870", "Hajjah",
120             "967283", "Aden",
121             "96753", "Hadhrmout",
122             "967636", "Maareb",
123             "967633", "Maareb",
124             "96755", "Hadhrmout",
125             "967630", "Maareb",
126             "967683", "Maareb",
127             "967639", "Dhamar",
128             "96775", "Saadah",
129             "9676861", "Dhamar",
130             "967638", "Maareb",
131             "9677878", "Saadah",
132             "9672840", "Aden",
133             "9674840", "Taiz",
134             "967634", "Aljawf",
135             "9677871", "Hajjah",
136             "967684", "Dhamar",
137             "9676868", "Al\ Baidha",
138             "9677845", "Al\ Mahweet",
139             "96744", "Ibb",
140             "967785", "Saadah",
141             "96724", "Dhalea",
142             "9677874", "Al\ Mahweet",
143             "9677876", "Amran",
144             "9671", "Sanaa",
145             "9677875", "Saadah",
146             "9676863", "Maareb",
147             "9676864", "Dhamar",
148             "9676853", "Al\ Baidha",
149             "96723", "Aden",
150             "9674842", "Taiz",
151             "96772", "Hajjah",
152             "96743", "Taiz",
153             "967682", "Dhamar",
154             "9677873", "Hajjah",
155             "9676865", "Dhamar",
156             "96776", "Amran",
157             "967786", "Amran",
158             "96752", "Shabwah",
159             "9676866", "Dhamar",};
160              
161             sub new {
162 7     7 1 51 my $class = shift;
163 7         16 my $number = shift;
164 7         45 $number =~ s/(^\+967|\D)//g;
165 7         49 my $self = bless({ country_code => '967', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
166 7 100       37 return $self if ($self->is_valid());
167 1         2 $number =~ s/^(?:0)//;
168 1         10 $self = bless({ country_code => '967', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
169 1 50       4 return $self->is_valid() ? $self : undef;
170             }
171             1;