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
|
|
1132
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
235
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
21
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
49
|
|
23
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
49
|
|
24
|
2
|
|
|
2
|
|
15
|
use utf8; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
13
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230903131448; |
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} = {"6656", "Chai\ Nat\/Nakhon\ Sawan\/Phetchabun\/Phichit\/Uthai\ Thani", |
89
|
|
|
|
|
|
|
"6633", "Chachoengsao\/Chon\ Buri\/Rayong", |
90
|
|
|
|
|
|
|
"6643", "Kalasin\/Khon\ Kaen\/Maha\ Sarakham\/Roi\ Et", |
91
|
|
|
|
|
|
|
"6616", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
92
|
|
|
|
|
|
|
"6677", "Chumphon\/Ranong\/Surat\ Thani", |
93
|
|
|
|
|
|
|
"6636", "Lop\ Buri\/Saraburi\/Sing\ Buri", |
94
|
|
|
|
|
|
|
"6674", "Phatthalung\/Satun\/Songkhla", |
95
|
|
|
|
|
|
|
"6639", "Chanthaburi\/Trat", |
96
|
|
|
|
|
|
|
"6653", "Chiang\ Mai\/Chiang\ Rai\/Lamphun\/Mae\ Hong\ Son", |
97
|
|
|
|
|
|
|
"6619", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
98
|
|
|
|
|
|
|
"6675", "Krabi\/Nakhon\ Si\ Thammarat\/Trang", |
99
|
|
|
|
|
|
|
"6645", "Amnat\ Charoen\/Si\ Sa\ Ket\/Ubon\ Ratchathani\/Yasothon", |
100
|
|
|
|
|
|
|
"6610", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
101
|
|
|
|
|
|
|
"6632", "Phetchaburi\/Prachuap\ Khiri\ Khan\/Ratchaburi", |
102
|
|
|
|
|
|
|
"6676", "Phang\ Nga\/Phuket", |
103
|
|
|
|
|
|
|
"6637", "Nakhon\ Nayok\/Prachin\ Buri\/Sa\ Kaeo", |
104
|
|
|
|
|
|
|
"6634", "Kanchanaburi\/Nakhon\ Pathom\/Samut\ Sakhon\/Samut\ Songkhram", |
105
|
|
|
|
|
|
|
"6635", "Ang\ Thong\/Phra\ Nakhon\ Si\ Ayutthaya\/Suphan\ Buri", |
106
|
|
|
|
|
|
|
"6644", "Buri\ Ram\/Chaiyaphum\/Nakhon\ Ratchasima\/Surin", |
107
|
|
|
|
|
|
|
"6642", "Loei\/Mukdahan\/Nakhon\ Phanom\/Nong\ Khai\/Sakon\ Nakhon\/Udon\ Thani", |
108
|
|
|
|
|
|
|
"662", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
109
|
|
|
|
|
|
|
"6673", "Narathiwat\/Pattani\/Yala", |
110
|
|
|
|
|
|
|
"6654", "Lampang\/Nan\/Phayao\/Phrae", |
111
|
|
|
|
|
|
|
"6618", "Bangkok\/Nonthaburi\/Pathum\ Thani\/Samut\ Prakan", |
112
|
|
|
|
|
|
|
"6638", "Chachoengsao\/Chon\ Buri\/Rayong", |
113
|
|
|
|
|
|
|
"6652", "Chiang\ Mai\/Chiang\ Rai\/Lamphun\/Mae\ Hong\ Son", |
114
|
|
|
|
|
|
|
"6655", "Kamphaeng\ Phet\/Phitsanulok\/Sukhothai\/Tak\/Uttaradit",}; |
115
|
|
|
|
|
|
|
$areanames{th} = {"6633", "ฉะเชิงเทรา\/ชลบุรี\/ระยอง", |
116
|
|
|
|
|
|
|
"6656", "ชัยนาท\/นครสวรรค์\/เพชรบูรณ์\/พิจิตร\/อุทัยธานี", |
117
|
|
|
|
|
|
|
"6643", "กาฬสินธุ์\/ขอนแก่น\/มหาสารคาม\/ร้อยเอ็ด", |
118
|
|
|
|
|
|
|
"6639", "จันทบุรี\/ตราด", |
119
|
|
|
|
|
|
|
"6653", "เชียงใหม่\/เชียงราย\/ลำพูน\/แม่ฮ่องสอน", |
120
|
|
|
|
|
|
|
"6619", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
121
|
|
|
|
|
|
|
"6616", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
122
|
|
|
|
|
|
|
"6674", "พัทลุง\/สตูล\/สงขลา", |
123
|
|
|
|
|
|
|
"6677", "ชุมพร\/ระนอง\/สุราษฎร์ธานี", |
124
|
|
|
|
|
|
|
"6636", "ลพบุรี\/สระบุรี\/สิงห์บุรี", |
125
|
|
|
|
|
|
|
"6675", "กระบี่\/นครศรีธรรมราช\/ตรัง", |
126
|
|
|
|
|
|
|
"6632", "เพชรบุรี\/ประจวบคีรีขันธ์\/ราชบุรี", |
127
|
|
|
|
|
|
|
"6634", "กาญจนบุรี\/นครปฐม\/สมุทรสาคร\/สมุทรสงคราม", |
128
|
|
|
|
|
|
|
"6637", "นครนายก\/ปราจีนบุรี\/สระแก้ว", |
129
|
|
|
|
|
|
|
"6676", "พังงา\/ภูเก็ต", |
130
|
|
|
|
|
|
|
"6645", "อำนาจเจริญ\/ศรีสะเกษ\/อุบลราชธานี\/ยโสธร", |
131
|
|
|
|
|
|
|
"6610", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
132
|
|
|
|
|
|
|
"6644", "บุรีรัมย์\/ชัยภูมิ\/นครราชสีมา\/สุรินทร์", |
133
|
|
|
|
|
|
|
"662", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
134
|
|
|
|
|
|
|
"6642", "เลย\/มุกดาหาร\/นครพนม\/หนองคาย\/สกลนคร\/อุดรธานี", |
135
|
|
|
|
|
|
|
"6635", "อ่างทอง\/พระนครศรีอยุธยา\/สุพรรณบุรี", |
136
|
|
|
|
|
|
|
"6618", "กรุงเทพ\/นนทบุรี\/ปทุมธานี\/สมุทรปราการ", |
137
|
|
|
|
|
|
|
"6654", "ลำปาง\/น่าน\/พะเยา\/แพร่", |
138
|
|
|
|
|
|
|
"6652", "เชียงใหม่\/เชียงราย\/ลำพูน\/แม่ฮ่องสอน", |
139
|
|
|
|
|
|
|
"6638", "ฉะเชิงเทรา\/ชลบุรี\/ระยอง", |
140
|
|
|
|
|
|
|
"6673", "นราธิวาส\/ปัตตานี\/ยะลา", |
141
|
|
|
|
|
|
|
"6655", "กำแพงเพชร\/พิษณุโลก\/สุโขทัย\/ตาก\/อุตรดิตถ์",}; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub new { |
144
|
16
|
|
|
16
|
1
|
45
|
my $class = shift; |
145
|
16
|
|
|
|
|
29
|
my $number = shift; |
146
|
16
|
|
|
|
|
107
|
$number =~ s/(^\+66|\D)//g; |
147
|
16
|
|
|
|
|
85
|
my $self = bless({ country_code => '66', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
148
|
16
|
100
|
|
|
|
94
|
return $self if ($self->is_valid()); |
149
|
1
|
|
|
|
|
6
|
$number =~ s/^(?:0)//; |
150
|
1
|
|
|
|
|
13
|
$self = bless({ country_code => '66', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
151
|
1
|
50
|
|
|
|
8
|
return $self->is_valid() ? $self : undef; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
1; |