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   1169 use base qw(Number::Phone::StubCountry);
  2         4  
  2         233  
21              
22 2     2   15 use strict;
  2         5  
  2         47  
23 2     2   11 use warnings;
  2         6  
  2         49  
24 2     2   11 use utf8;
  2         6  
  2         13  
25             our $VERSION = 1.20230307181419;
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} = {"42032", "Central\ Bohemian\ Region",
97             "42049", "Hradec\ Králové\ Region",
98             "42031", "Central\ Bohemian\ Region",
99             "42035", "Karlovy\ Vary\ Region",
100             "42058", "Olomouc\ Region",
101             "42041", "Ústí\ nad\ Labem\ Region",
102             "4202", "Prague",
103             "42039", "South\ Bohemian\ Region",
104             "42054", "South\ Moravian\ Region",
105             "42055", "Moravian\-Silesian\ Region",
106             "42038", "South\ Bohemian\ Region",
107             "42051", "South\ Moravian\ Region",
108             "42059", "Moravian\-Silesian\ Region",
109             "42048", "Liberec\ Region",
110             "42046", "Pardubice\ Region",
111             "42037", "Plzeň\ Region",
112             "42047", "Ústí\ nad\ Labem\ Region",
113             "42057", "Zlín\ Region",
114             "42053", "South\ Moravian\ Region",
115             "42056", "Vysočina\ Region",};
116              
117             sub new {
118 25     25 1 60 my $class = shift;
119 25         40 my $number = shift;
120 25         157 $number =~ s/(^\+420|\D)//g;
121 25         150 my $self = bless({ country_code => '420', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
122 25 100       146 return $self->is_valid() ? $self : undef;
123             }
124             1;