File Coverage

blib/lib/Number/Phone/StubCountry/SY.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::SY;
20 2     2   1264 use base qw(Number::Phone::StubCountry);
  2         7  
  2         243  
21              
22 2     2   24 use strict;
  2         8  
  2         62  
23 2     2   13 use warnings;
  2         7  
  2         55  
24 2     2   14 use utf8;
  2         4  
  2         17  
25             our $VERSION = 1.20230307181422;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3',
30             'leading_digits' => '[1-5]',
31             'national_rule' => '0$1',
32             'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})'
33             },
34             {
35             'format' => '$1 $2 $3',
36             'leading_digits' => '9',
37             'national_rule' => '0$1',
38             'pattern' => '(\\d{3})(\\d{3})(\\d{3})'
39             }
40             ];
41              
42             my $validators = {
43             'fixed_line' => '
44             21\\d{6,7}|
45             (?:
46             1(?:
47             [14]\\d|
48             [2356]
49             )|
50             2[235]|
51             3(?:
52             [13]\\d|
53             4
54             )|
55             4[134]|
56             5[1-3]
57             )\\d{6}
58             ',
59             'geographic' => '
60             21\\d{6,7}|
61             (?:
62             1(?:
63             [14]\\d|
64             [2356]
65             )|
66             2[235]|
67             3(?:
68             [13]\\d|
69             4
70             )|
71             4[134]|
72             5[1-3]
73             )\\d{6}
74             ',
75             'mobile' => '9[1-689]\\d{7}',
76             'pager' => '',
77             'personal_number' => '',
78             'specialrate' => '',
79             'toll_free' => '',
80             'voip' => ''
81             };
82             my %areanames = ();
83             $areanames{en} = {"96351", "Deir\ Ezzour",
84             "96352", "Alhasakah",
85             "96316", "Al\-Swedaa",
86             "96313", "Al\-Zabadani",
87             "96334", "Palmyra",
88             "96331", "Homs",
89             "96341", "Lattakia",
90             "96323", "Edleb",
91             "96344", "Hamah",
92             "96353", "Al\-Kameshli",
93             "96311", "Damascus\ and\ rural\ areas",
94             "96312", "Al\-Nebek",
95             "96314", "Al\-Quneitra",
96             "96315", "Dara",
97             "96333", "Hamah",
98             "96343", "Tartous",
99             "96325", "Menbej",
100             "96321", "Aleppo",
101             "96322", "Al\-Rakkah",};
102              
103             sub new {
104 7     7 1 17 my $class = shift;
105 7         11 my $number = shift;
106 7         45 $number =~ s/(^\+963|\D)//g;
107 7         42 my $self = bless({ country_code => '963', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
108 7 100       36 return $self if ($self->is_valid());
109 1         5 $number =~ s/^(?:0)//;
110 1         9 $self = bless({ country_code => '963', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
111 1 50       5 return $self->is_valid() ? $self : undef;
112             }
113             1;