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   1287 use base qw(Number::Phone::StubCountry);
  2         6  
  2         258  
21              
22 2     2   26 use strict;
  2         15  
  2         51  
23 2     2   12 use warnings;
  2         7  
  2         64  
24 2     2   15 use utf8;
  2         10  
  2         19  
25             our $VERSION = 1.20230903131448;
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} = {"96316", "Al\-Swedaa",
84             "96325", "Menbej",
85             "96313", "Al\-Zabadani",
86             "96312", "Al\-Nebek",
87             "96344", "Hamah",
88             "96311", "Damascus\ and\ rural\ areas",
89             "96334", "Palmyra",
90             "96315", "Dara",
91             "96352", "Alhasakah",
92             "96353", "Al\-Kameshli",
93             "96351", "Deir\ Ezzour",
94             "96331", "Homs",
95             "96321", "Aleppo",
96             "96341", "Lattakia",
97             "96314", "Al\-Quneitra",
98             "96333", "Hamah",
99             "96323", "Edleb",
100             "96322", "Al\-Rakkah",
101             "96343", "Tartous",};
102              
103             sub new {
104 7     7 1 16 my $class = shift;
105 7         17 my $number = shift;
106 7         50 $number =~ s/(^\+963|\D)//g;
107 7         48 my $self = bless({ country_code => '963', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
108 7 100       39 return $self if ($self->is_valid());
109 1         6 $number =~ s/^(?:0)//;
110 1         22 $self = bless({ country_code => '963', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
111 1 50       14 return $self->is_valid() ? $self : undef;
112             }
113             1;