File Coverage

blib/lib/Number/Phone/StubCountry/CZ.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 25 100.0


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::CZ;
20 2     2   1262 use base qw(Number::Phone::StubCountry);
  2         5  
  2         255  
21              
22 2     2   19 use strict;
  2         5  
  2         55  
23 2     2   23 use warnings;
  2         7  
  2         67  
24 2     2   14 use utf8;
  2         4  
  2         59  
25             our $VERSION = 1.20230614174403;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3',
30             'leading_digits' => '
31             [2-8]|
32             9[015-7]
33             ',
34             'pattern' => '(\\d{3})(\\d{3})(\\d{3})'
35             },
36             {
37             'format' => '$1 $2 $3 $4',
38             'leading_digits' => '96',
39             'pattern' => '(\\d{2})(\\d{3})(\\d{3})(\\d{2})'
40             },
41             {
42             'format' => '$1 $2 $3 $4',
43             'leading_digits' => '9',
44             'pattern' => '(\\d{2})(\\d{3})(\\d{3})(\\d{3})'
45             },
46             {
47             'format' => '$1 $2 $3 $4',
48             'leading_digits' => '9',
49             'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{3})'
50             }
51             ];
52              
53             my $validators = {
54             'fixed_line' => '
55             (?:
56             2\\d|
57             3[1257-9]|
58             4[16-9]|
59             5[13-9]
60             )\\d{7}
61             ',
62             'geographic' => '
63             (?:
64             2\\d|
65             3[1257-9]|
66             4[16-9]|
67             5[13-9]
68             )\\d{7}
69             ',
70             'mobile' => '
71             (?:
72             60[1-8]|
73             7(?:
74             0[2-5]|
75             [2379]\\d
76             )
77             )\\d{6}
78             ',
79             'pager' => '',
80             'personal_number' => '70[01]\\d{6}',
81             'specialrate' => '(8[134]\\d{7})|(
82             9(?:
83             0[05689]|
84             76
85             )\\d{6}
86             )|(
87             9(?:
88             5\\d|
89             7[2-4]
90             )\\d{6}
91             )',
92             'toll_free' => '800\\d{6}',
93             'voip' => '9[17]0\\d{6}'
94             };
95             my %areanames = ();
96             $areanames{en} = {"42046", "Pardubice\ Region",
97             "42039", "South\ Bohemian\ Region",
98             "42038", "South\ Bohemian\ Region",
99             "42057", "Zlín\ Region",
100             "42041", "Ústí\ nad\ Labem\ Region",
101             "42059", "Moravian\-Silesian\ Region",
102             "42058", "Olomouc\ Region",
103             "42037", "Plzeň\ Region",
104             "42031", "Central\ Bohemian\ Region",
105             "4202", "Prague",
106             "42056", "Vysočina\ Region",
107             "42053", "South\ Moravian\ Region",
108             "42047", "Ústí\ nad\ Labem\ Region",
109             "42032", "Central\ Bohemian\ Region",
110             "42055", "Moravian\-Silesian\ Region",
111             "42049", "Hradec\ Králové\ Region",
112             "42051", "South\ Moravian\ Region",
113             "42054", "South\ Moravian\ Region",
114             "42035", "Karlovy\ Vary\ Region",
115             "42048", "Liberec\ Region",};
116              
117             sub new {
118 25     25 1 54 my $class = shift;
119 25         49 my $number = shift;
120 25         159 $number =~ s/(^\+420|\D)//g;
121 25         193 my $self = bless({ country_code => '420', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
122 25 100       130 return $self->is_valid() ? $self : undef;
123             }
124             1;