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::TH; |
20
|
2
|
|
|
2
|
|
1230
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
230
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
17
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
55
|
|
23
|
2
|
|
|
2
|
|
19
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
77
|
|
24
|
2
|
|
|
2
|
|
14
|
use utf8; |
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
25
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230614174404; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
30
|
|
|
|
|
|
|
'leading_digits' => '2', |
31
|
|
|
|
|
|
|
'national_rule' => '0$1', |
32
|
|
|
|
|
|
|
'pattern' => '(\\d)(\\d{3})(\\d{4})' |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
36
|
|
|
|
|
|
|
'leading_digits' => '[13-9]', |
37
|
|
|
|
|
|
|
'national_rule' => '0$1', |
38
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})' |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
42
|
|
|
|
|
|
|
'leading_digits' => '1', |
43
|
|
|
|
|
|
|
'pattern' => '(\\d{4})(\\d{3})(\\d{3})' |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
]; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $validators = { |
48
|
|
|
|
|
|
|
'fixed_line' => ' |
49
|
|
|
|
|
|
|
(?: |
50
|
|
|
|
|
|
|
1[0689]| |
51
|
|
|
|
|
|
|
2\\d| |
52
|
|
|
|
|
|
|
3[2-9]| |
53
|
|
|
|
|
|
|
4[2-5]| |
54
|
|
|
|
|
|
|
5[2-6]| |
55
|
|
|
|
|
|
|
7[3-7] |
56
|
|
|
|
|
|
|
)\\d{6} |
57
|
|
|
|
|
|
|
', |
58
|
|
|
|
|
|
|
'geographic' => ' |
59
|
|
|
|
|
|
|
(?: |
60
|
|
|
|
|
|
|
1[0689]| |
61
|
|
|
|
|
|
|
2\\d| |
62
|
|
|
|
|
|
|
3[2-9]| |
63
|
|
|
|
|
|
|
4[2-5]| |
64
|
|
|
|
|
|
|
5[2-6]| |
65
|
|
|
|
|
|
|
7[3-7] |
66
|
|
|
|
|
|
|
)\\d{6} |
67
|
|
|
|
|
|
|
', |
68
|
|
|
|
|
|
|
'mobile' => ' |
69
|
|
|
|
|
|
|
671[0-8]\\d{5}| |
70
|
|
|
|
|
|
|
(?: |
71
|
|
|
|
|
|
|
14| |
72
|
|
|
|
|
|
|
6[1-6]| |
73
|
|
|
|
|
|
|
[89]\\d |
74
|
|
|
|
|
|
|
)\\d{7} |
75
|
|
|
|
|
|
|
', |
76
|
|
|
|
|
|
|
'pager' => '', |
77
|
|
|
|
|
|
|
'personal_number' => '', |
78
|
|
|
|
|
|
|
'specialrate' => '(1900\\d{6})', |
79
|
|
|
|
|
|
|
'toll_free' => ' |
80
|
|
|
|
|
|
|
(?: |
81
|
|
|
|
|
|
|
001800\\d| |
82
|
|
|
|
|
|
|
1800 |
83
|
|
|
|
|
|
|
)\\d{6} |
84
|
|
|
|
|
|
|
', |
85
|
|
|
|
|
|
|
'voip' => '6[08]\\d{7}' |
86
|
|
|
|
|
|
|
}; |
87
|
|
|
|
|
|
|
my %areanames = (); |
88
|
|
|
|
|
|
|
$areanames{en} = {"6674", "Phatthalung\/Satun\/Songkhla", |
89
|
|
|
|
|
|
|
"6652", "Chiang\ Mai\/Chiang\ Rai\/Lamphun\/Mae\ Hong\ Son", |
90
|
|
|
|
|
|
|
"6636", "Lop\ Buri\/Saraburi\/Sing\ Buri", |
91
|
|
|
|
|
|
|
"6654", "Lampang\/Nan\/Phayao\/Phrae", |
92
|
|
|
|
|
|
|
"6610", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
93
|
|
|
|
|
|
|
"6633", "Chachoengsao\/Chon\ Buri\/Rayong", |
94
|
|
|
|
|
|
|
"6638", "Chachoengsao\/Chon\ Buri\/Rayong", |
95
|
|
|
|
|
|
|
"6653", "Chiang\ Mai\/Chiang\ Rai\/Lamphun\/Mae\ Hong\ Son", |
96
|
|
|
|
|
|
|
"662", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
97
|
|
|
|
|
|
|
"6676", "Phang\ Nga\/Phuket", |
98
|
|
|
|
|
|
|
"6645", "Amnat\ Charoen\/Si\ Sa\ Ket\/Ubon\ Ratchathani\/Yasothon", |
99
|
|
|
|
|
|
|
"6634", "Kanchanaburi\/Nakhon\ Pathom\/Samut\ Sakhon\/Samut\ Songkhram", |
100
|
|
|
|
|
|
|
"6619", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
101
|
|
|
|
|
|
|
"6632", "Phetchaburi\/Prachuap\ Khiri\ Khan\/Ratchaburi", |
102
|
|
|
|
|
|
|
"6656", "Chai\ Nat\/Nakhon\ Sawan\/Phetchabun\/Phichit\/Uthai\ Thani", |
103
|
|
|
|
|
|
|
"6673", "Narathiwat\/Pattani\/Yala", |
104
|
|
|
|
|
|
|
"6618", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
105
|
|
|
|
|
|
|
"6635", "Ang\ Thong\/Phra\ Nakhon\ Si\ Ayutthaya\/Suphan\ Buri", |
106
|
|
|
|
|
|
|
"6677", "Chumphon\/Ranong\/Surat\ Thani", |
107
|
|
|
|
|
|
|
"6644", "Buri\ Ram\/Chaiyaphum\/Nakhon\ Ratchasima\/Surin", |
108
|
|
|
|
|
|
|
"6642", "Loei\/Mukdahan\/Nakhon\ Phanom\/Nong\ Khai\/Sakon\ Nakhon\/Udon\ Thani", |
109
|
|
|
|
|
|
|
"6616", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
110
|
|
|
|
|
|
|
"6675", "Krabi\/Nakhon\ Si\ Thammarat\/Trang", |
111
|
|
|
|
|
|
|
"6637", "Nakhon\ Nayok\/Prachin\ Buri\/Sa\ Kaeo", |
112
|
|
|
|
|
|
|
"6639", "Chanthaburi\/Trat", |
113
|
|
|
|
|
|
|
"6655", "Kamphaeng\ Phet\/Phitsanulok\/Sukhothai\/Tak\/Uttaradit", |
114
|
|
|
|
|
|
|
"6643", "Kalasin\/Khon\ Kaen\/Maha\ Sarakham\/Roi\ Et",}; |
115
|
|
|
|
|
|
|
$areanames{th} = {"6632", "เพชรบุรี\/ประจวบคีรีขันธ์\/ราชบุรี", |
116
|
|
|
|
|
|
|
"6656", "ชัยนาท\/นครสวรรค์\/เพชรบูรณ์\/พิจิตร\/อุทัยธานี", |
117
|
|
|
|
|
|
|
"6673", "นราธิวาส\/ปัตตานี\/ยะลา", |
118
|
|
|
|
|
|
|
"662", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
119
|
|
|
|
|
|
|
"6653", "เชียงใหม่\/เชียงราย\/ลำพูน\/แม่ฮ่องสอน", |
120
|
|
|
|
|
|
|
"6619", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
121
|
|
|
|
|
|
|
"6634", "กาญจนบุรี\/นครปฐม\/สมุทรสาคร\/สมุทรสงคราม", |
122
|
|
|
|
|
|
|
"6676", "พังงา\/ภูเก็ต", |
123
|
|
|
|
|
|
|
"6645", "อำนาจเจริญ\/ศรีสะเกษ\/อุบลราชธานี\/ยโสธร", |
124
|
|
|
|
|
|
|
"6610", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
125
|
|
|
|
|
|
|
"6654", "ลำปาง\/น่าน\/พะเยา\/แพร่", |
126
|
|
|
|
|
|
|
"6638", "ฉะเชิงเทรา\/ชลบุรี\/ระยอง", |
127
|
|
|
|
|
|
|
"6633", "ฉะเชิงเทรา\/ชลบุรี\/ระยอง", |
128
|
|
|
|
|
|
|
"6652", "เชียงใหม่\/เชียงราย\/ลำพูน\/แม่ฮ่องสอน", |
129
|
|
|
|
|
|
|
"6636", "ลพบุรี\/สระบุรี\/สิงห์บุรี", |
130
|
|
|
|
|
|
|
"6674", "พัทลุง\/สตูล\/สงขลา", |
131
|
|
|
|
|
|
|
"6655", "กำแพงเพชร\/พิษณุโลก\/สุโขทัย\/ตาก\/อุตรดิตถ์", |
132
|
|
|
|
|
|
|
"6639", "จันทบุรี\/ตราด", |
133
|
|
|
|
|
|
|
"6643", "กาฬสินธุ์\/ขอนแก่น\/มหาสารคาม\/ร้อยเอ็ด", |
134
|
|
|
|
|
|
|
"6637", "นครนายก\/ปราจีนบุรี\/สระแก้ว", |
135
|
|
|
|
|
|
|
"6675", "กระบี่\/นครศรีธรรมราช\/ตรัง", |
136
|
|
|
|
|
|
|
"6616", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
137
|
|
|
|
|
|
|
"6642", "เลย\/มุกดาหาร\/นครพนม\/หนองคาย\/สกลนคร\/อุดรธานี", |
138
|
|
|
|
|
|
|
"6618", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
139
|
|
|
|
|
|
|
"6644", "บุรีรัมย์\/ชัยภูมิ\/นครราชสีมา\/สุรินทร์", |
140
|
|
|
|
|
|
|
"6677", "ชุมพร\/ระนอง\/สุราษฎร์ธานี", |
141
|
|
|
|
|
|
|
"6635", "อ่างทอง\/พระนครศรีอยุธยา\/สุพรรณบุรี",}; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub new { |
144
|
16
|
|
|
16
|
1
|
40
|
my $class = shift; |
145
|
16
|
|
|
|
|
32
|
my $number = shift; |
146
|
16
|
|
|
|
|
111
|
$number =~ s/(^\+66|\D)//g; |
147
|
16
|
|
|
|
|
98
|
my $self = bless({ country_code => '66', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
148
|
16
|
100
|
|
|
|
89
|
return $self if ($self->is_valid()); |
149
|
1
|
|
|
|
|
3
|
$number =~ s/^(?:0)//; |
150
|
1
|
|
|
|
|
11
|
$self = bless({ country_code => '66', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
151
|
1
|
50
|
|
|
|
6
|
return $self->is_valid() ? $self : undef; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
1; |