|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Respect/Validation. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Alexandre Gomes Gaigalas <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the "LICENSE.md" |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace Respect\Validation\Rules\Locale; |
|
15
|
|
|
|
|
16
|
|
|
use Respect\Validation\Rules\AbstractSearcher; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Validates whether an input is subdivision code of Philippines or not. |
|
20
|
|
|
* |
|
21
|
|
|
* ISO 3166-1 alpha-2: PH |
|
22
|
|
|
* |
|
23
|
|
|
* @see http://www.geonames.org/PH/administrative-division-philippines.html |
|
24
|
|
|
* |
|
25
|
|
|
* @author Henrique Moody <[email protected]> |
|
26
|
|
|
*/ |
|
27
|
|
|
final class PhSubdivisionCode extends AbstractSearcher |
|
28
|
|
|
{ |
|
29
|
|
|
private const DATA = [ |
|
30
|
|
|
'00', // National Capital Region |
|
31
|
|
|
'01', // Ilocos |
|
32
|
|
|
'02', // Cagayan Valley |
|
33
|
|
|
'03', // Central Luzon |
|
34
|
|
|
'05', // Bicol |
|
35
|
|
|
'06', // Western Visayas |
|
36
|
|
|
'07', // Central Visayas |
|
37
|
|
|
'08', // Eastern Visayas |
|
38
|
|
|
'09', // Zamboanga Peninsula |
|
39
|
|
|
'10', // Northern Mindanao |
|
40
|
|
|
'11', // Davao |
|
41
|
|
|
'12', // Soccsksargen |
|
42
|
|
|
'13', // Caraga |
|
43
|
|
|
'14', // Autonomous Region in Muslim Mindanao, |
|
44
|
|
|
'15', // Cordillera Administrative Region |
|
45
|
|
|
'40', // Calabarzon |
|
46
|
|
|
'41', // Mimaropa |
|
47
|
|
|
'ABR', // Abra |
|
48
|
|
|
'AGN', // Agusan del Norte |
|
49
|
|
|
'AGS', // Agusan del Sur |
|
50
|
|
|
'AKL', // Aklan |
|
51
|
|
|
'ALB', // Albay |
|
52
|
|
|
'ANT', // Antique |
|
53
|
|
|
'APA', // Apayao |
|
54
|
|
|
'AUR', // Aurora |
|
55
|
|
|
'BAN', // Bataan |
|
56
|
|
|
'BAS', // Basilan |
|
57
|
|
|
'BEN', // Benguet |
|
58
|
|
|
'BIL', // Biliran |
|
59
|
|
|
'BOH', // Bohol |
|
60
|
|
|
'BTG', // Batangas |
|
61
|
|
|
'BTN', // Batanes |
|
62
|
|
|
'BUK', // Bukidnon |
|
63
|
|
|
'BUL', // Bulacan |
|
64
|
|
|
'CAG', // Cagayan |
|
65
|
|
|
'CAM', // Camiguin |
|
66
|
|
|
'CAN', // Camarines Norte |
|
67
|
|
|
'CAP', // Capiz |
|
68
|
|
|
'CAS', // Camarines Sur |
|
69
|
|
|
'CAT', // Catanduanes |
|
70
|
|
|
'CAV', // Cavite |
|
71
|
|
|
'CEB', // Cebu |
|
72
|
|
|
'COM', // Compostela Valley |
|
73
|
|
|
'DAO', // Davao Oriental |
|
74
|
|
|
'DAS', // Davao del Sur |
|
75
|
|
|
'DAV', // Davao del Norte |
|
76
|
|
|
'DIN', // Dinagat Islands |
|
77
|
|
|
'DVO', // Davao Occidental |
|
78
|
|
|
'EAS', // Eastern Samar |
|
79
|
|
|
'GUI', // Guimaras |
|
80
|
|
|
'IFU', // Ifugao |
|
81
|
|
|
'ILI', // Iloilo |
|
82
|
|
|
'ILN', // Ilocos Norte |
|
83
|
|
|
'ILS', // Ilocos Sur |
|
84
|
|
|
'ISA', // Isabela |
|
85
|
|
|
'KAL', // Kalinga |
|
86
|
|
|
'LAG', // Laguna |
|
87
|
|
|
'LAN', // Lanao del Norte |
|
88
|
|
|
'LAS', // Lanao del Sur |
|
89
|
|
|
'LEY', // Leyte |
|
90
|
|
|
'LUN', // La Union |
|
91
|
|
|
'MAD', // Marinduque |
|
92
|
|
|
'MAG', // Maguindanao |
|
93
|
|
|
'MAS', // Masbate |
|
94
|
|
|
'MDC', // Mindoro Occidental |
|
95
|
|
|
'MDR', // Mindoro Oriental |
|
96
|
|
|
'MOU', // Mountain Province |
|
97
|
|
|
'MSC', // Misamis Occidental |
|
98
|
|
|
'MSR', // Misamis Oriental |
|
99
|
|
|
'NCO', // North Cotabato |
|
100
|
|
|
'NEC', // Negros Occidental |
|
101
|
|
|
'NER', // Negros Oriental |
|
102
|
|
|
'NSA', // Northern Samar |
|
103
|
|
|
'NUE', // Nueva Ecija |
|
104
|
|
|
'NUV', // Nueva Vizcaya |
|
105
|
|
|
'PAM', // Pampanga |
|
106
|
|
|
'PAN', // Pangasinan |
|
107
|
|
|
'PLW', // Palawan |
|
108
|
|
|
'QUE', // Quezon |
|
109
|
|
|
'QUI', // Quirino |
|
110
|
|
|
'RIZ', // Rizal |
|
111
|
|
|
'ROM', // Romblon |
|
112
|
|
|
'SAR', // Sarangani |
|
113
|
|
|
'SCO', // South Cotabato |
|
114
|
|
|
'SIG', // Siquijor |
|
115
|
|
|
'SLE', // Southern Leyte |
|
116
|
|
|
'SLU', // Sulu |
|
117
|
|
|
'SOR', // Sorsogon |
|
118
|
|
|
'SUK', // Sultan Kudarat |
|
119
|
|
|
'SUN', // Surigao del Norte |
|
120
|
|
|
'SUR', // Surigao del Sur |
|
121
|
|
|
'TAR', // Tarlac |
|
122
|
|
|
'TAW', // Tawi-Tawi |
|
123
|
|
|
'WSA', // Western Samar |
|
124
|
|
|
'ZAN', // Zamboanga del Norte |
|
125
|
|
|
'ZAS', // Zamboanga del Sur |
|
126
|
|
|
'ZMB', // Zambales |
|
127
|
|
|
'ZSI', // Zamboanga Sibugay |
|
128
|
|
|
]; |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* {@inheritdoc} |
|
132
|
|
|
*/ |
|
133
|
|
|
protected function getDataSource(): array |
|
134
|
|
|
{ |
|
135
|
|
|
return self::DATA; |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|