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