Dropdowns   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 1313
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 17
eloc 1144
dl 0
loc 1313
rs 9.0239
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A selectCountry() 0 3 1
A selectState() 0 3 1
B selectCountryAlpha2() 0 251 1
A selectStateUSArmedForces() 0 10 1
B selectCountryAlpha() 0 256 1
A selectStateMexico() 0 39 1
A formatOffset() 0 13 4
B selectCountryNumeric() 0 256 1
A selectStateUSOutlyingTerritories() 0 13 1
A selectTimezone() 0 16 2
B selectCountryAlpha3() 0 256 1
A selectStateUS() 0 58 1
A selectCanadaTerritories() 0 20 1
1
<?php
2
3
namespace App\Services\Macros;
4
5
/**
6
 * Class Dropdowns.
7
 */
8
trait Dropdowns
9
{
10
    /**
11
     * Use this to set the default country state type for the shorthand method.
12
     *
13
     * @param  $name
14
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
15
     * @param  array $options
16
     *
17
     * @return string
18
     */
19
    public function selectState($name, $selected = null, $options = [])
20
    {
21
        return $this->selectStateUS($name, $selected, $options);
22
    }
23
24
    /**
25
     * @param  $name
26
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
27
     * @param  array $options
28
     *
29
     * @return string
30
     */
31
    public function selectStateUS($name, $selected = null, $options = [])
32
    {
33
        $list = [
34
        ''   => 'Select One...',
35
        'AL' => 'Alabama',
36
        'AK' => 'Alaska',
37
        'AZ' => 'Arizona',
38
        'AR' => 'Arkansas',
39
        'CA' => 'California',
40
        'CO' => 'Colorado',
41
        'CT' => 'Connecticut',
42
        'DE' => 'Delaware',
43
        'DC' => 'District of Columbia',
44
        'FL' => 'Florida',
45
        'GA' => 'Georgia',
46
        'HI' => 'Hawaii',
47
        'ID' => 'Idaho',
48
        'IL' => 'Illinois',
49
        'IN' => 'Indiana',
50
        'IA' => 'Iowa',
51
        'KS' => 'Kansas',
52
        'KY' => 'Kentucky',
53
        'LA' => 'Louisiana',
54
        'ME' => 'Maine',
55
        'MD' => 'Maryland',
56
        'MA' => 'Massachusetts',
57
        'MI' => 'Michigan',
58
        'MN' => 'Minnesota',
59
        'MS' => 'Mississippi',
60
        'MO' => 'Missouri',
61
        'MT' => 'Montana',
62
        'NE' => 'Nebraska',
63
        'NV' => 'Nevada',
64
        'NH' => 'New Hampshire',
65
        'NJ' => 'New Jersey',
66
        'NM' => 'New Mexico',
67
        'NY' => 'New York',
68
        'NC' => 'North Carolina',
69
        'ND' => 'North Dakota',
70
        'OH' => 'Ohio',
71
        'OK' => 'Oklahoma',
72
        'OR' => 'Oregon',
73
        'PA' => 'Pennsylvania',
74
        'RI' => 'Rhode Island',
75
        'SC' => 'South Carolina',
76
        'SD' => 'South Dakota',
77
        'TN' => 'Tennessee',
78
        'TX' => 'Texas',
79
        'UT' => 'Utah',
80
        'VT' => 'Vermont',
81
        'VA' => 'Virginia',
82
        'WA' => 'Washington',
83
        'WV' => 'West Virginia',
84
        'WI' => 'Wisconsin',
85
        'WY' => 'Wyoming',
86
    ];
87
88
        return $this->select($name, $list, $selected, $options);
0 ignored issues
show
Bug introduced by
The method select() does not exist on App\Services\Macros\Dropdowns. Did you maybe mean selectCountryAlpha()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

88
        return $this->/** @scrutinizer ignore-call */ select($name, $list, $selected, $options);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
89
    }
90
91
    /**
92
     * @param  $name
93
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
94
     * @param  array $options
95
     *
96
     * @return mixed
97
     */
98
    public function selectStateUSOutlyingTerritories($name, $selected = null, $options = [])
99
    {
100
        $list = [
101
        ''   => 'Select One...',
102
        'AS' => 'American Samoa',
103
        'GU' => 'Guam',
104
        'MP' => 'Northern Mariana Islands',
105
        'PR' => 'Puerto Rico',
106
        'UM' => 'United States Minor Outlying Islands',
107
        'VI' => 'Virgin Islands',
108
    ];
109
110
        return $this->select($name, $list, $selected, $options);
111
    }
112
113
    /**
114
     * @param  $name
115
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
116
     * @param  array $options
117
     *
118
     * @return mixed
119
     */
120
    public function selectStateUSArmedForces($name, $selected = null, $options = [])
121
    {
122
        $list = [
123
        ''   => 'Select One...',
124
        'AA' => 'Armed Forces Americas',
125
        'AP' => 'Armed Forces Pacific',
126
        'AE' => 'Armed Forces Others',
127
    ];
128
129
        return $this->select($name, $list, $selected, $options);
130
    }
131
132
    /**
133
     * @param  $name
134
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
135
     * @param  array $options
136
     *
137
     * @return mixed
138
     */
139
    public function selectCanadaTerritories($name, $selected = null, $options = [])
140
    {
141
        $list = [
142
        ''   => 'Select One...',
143
        'AB' => 'Alberta',
144
        'BC' => 'British Columbia',
145
        'MB' => 'Manitoba',
146
        'NB' => 'New Brunswick',
147
        'NL' => 'Newfoundland and Labrador',
148
        'NS' => 'Nova Scotia',
149
        'ON' => 'Ontario',
150
        'PE' => 'Prince Edward Island',
151
        'QC' => 'Quebec',
152
        'SK' => 'Saskatchewan',
153
        'NT' => 'Northwest Territories',
154
        'NU' => 'Nunavut',
155
        'YT' => 'Yukon',
156
    ];
157
158
        return $this->select($name, $list, $selected, $options);
159
    }
160
161
    /**
162
     * @param  $name
163
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
164
     * @param  array $options
165
     *
166
     * @return mixed
167
     */
168
    public function selectStateMexico($name, $selected = null, $options = [])
169
    {
170
        $list = [
171
        ''    => 'Select One...',
172
        'DIF' => 'Distrito Federal',
173
        'AGS' => 'Aguascalientes',
174
        'BCN' => 'Baja California',
175
        'BCS' => 'Baja California Sur',
176
        'CAM' => 'Campeche',
177
        'CHP' => 'Chiapas',
178
        'CHI' => 'Chihuahua',
179
        'COA' => 'Coahuila',
180
        'COL' => 'Colima',
181
        'DUR' => 'Durango',
182
        'GTO' => 'Guanajuato',
183
        'GRO' => 'Guerrero',
184
        'HGO' => 'Hidalgo',
185
        'JAL' => 'Jalisco',
186
        'MEX' => 'Mexico',
187
        'MIC' => 'Michoacan',
188
        'MOR' => 'Morelos',
189
        'NAY' => 'Nayarit',
190
        'NLE' => 'Nuevo Le&oacute;n',
191
        'OAX' => 'Oaxaca',
192
        'PUE' => 'Puebla',
193
        'QRO' => 'Queretaro',
194
        'ROO' => 'Quintana Roo',
195
        'SLP' => 'San Luis Potos&iacute;',
196
        'SIN' => 'Sinaloa',
197
        'SON' => 'Sonora',
198
        'TAB' => 'Tabasco',
199
        'TAM' => 'Tamaulipas',
200
        'TLX' => 'Tlaxcala',
201
        'VER' => 'Veracruz',
202
        'YUC' => 'Yucatan',
203
        'ZAC' => 'Zacatecas',
204
    ];
205
206
        return $this->select($name, $list, $selected, $options);
207
    }
208
209
    /**
210
     * Use this to set the default country dropdown type for the shorthand method.
211
     *
212
     * @param  $name
213
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
214
     * @param  array $options
215
     *
216
     * @return string
217
     */
218
    public function selectCountry($name, $selected = null, $options = [])
219
    {
220
        return $this->selectCountryAlpha2($name, $selected, $options);
221
    }
222
223
    /**
224
     * @param  $name
225
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
226
     * @param  array $options
227
     *
228
     * @return mixed
229
     */
230
    public function selectCountryAlpha($name, $selected = null, $options = [])
231
    {
232
        $list = [
233
        ''              => 'Select One...',
234
        'ISO 3166-2:AF' => 'Afghanistan',
235
        'ISO 3166-2:AX' => 'Åland Islands',
236
        'ISO 3166-2:AL' => 'Albania',
237
        'ISO 3166-2:DZ' => 'Algeria',
238
        'ISO 3166-2:AS' => 'American Samoa',
239
        'ISO 3166-2:AD' => 'Andorra',
240
        'ISO 3166-2:AO' => 'Angola',
241
        'ISO 3166-2:AI' => 'Anguilla',
242
        'ISO 3166-2:AQ' => 'Antarctica',
243
        'ISO 3166-2:AG' => 'Antigua and Barbuda',
244
        'ISO 3166-2:AR' => 'Argentina',
245
        'ISO 3166-2:AM' => 'Armenia',
246
        'ISO 3166-2:AW' => 'Aruba',
247
        'ISO 3166-2:AU' => 'Australia',
248
        'ISO 3166-2:AT' => 'Austria',
249
        'ISO 3166-2:AZ' => 'Azerbaijan',
250
        'ISO 3166-2:BS' => 'Bahamas',
251
        'ISO 3166-2:BH' => 'Bahrain',
252
        'ISO 3166-2:BD' => 'Bangladesh',
253
        'ISO 3166-2:BB' => 'Barbados',
254
        'ISO 3166-2:BY' => 'Belarus',
255
        'ISO 3166-2:BE' => 'Belgium',
256
        'ISO 3166-2:BZ' => 'Belize',
257
        'ISO 3166-2:BJ' => 'Benin',
258
        'ISO 3166-2:BM' => 'Bermuda',
259
        'ISO 3166-2:BT' => 'Bhutan',
260
        'ISO 3166-2:BO' => 'Bolivia, Plurinational State of',
261
        'ISO 3166-2:BQ' => 'Bonaire, Sint Eustatius and Saba',
262
        'ISO 3166-2:BA' => 'Bosnia and Herzegovina',
263
        'ISO 3166-2:BW' => 'Botswana',
264
        'ISO 3166-2:BV' => 'Bouvet Island',
265
        'ISO 3166-2:BR' => 'Brazil',
266
        'ISO 3166-2:IO' => 'British Indian Ocean Territory',
267
        'ISO 3166-2:BN' => 'Brunei Darussalam',
268
        'ISO 3166-2:BG' => 'Bulgaria',
269
        'ISO 3166-2:BF' => 'Burkina Faso',
270
        'ISO 3166-2:BI' => 'Burundi',
271
        'ISO 3166-2:KH' => 'Cambodia',
272
        'ISO 3166-2:CM' => 'Cameroon',
273
        'ISO 3166-2:CA' => 'Canada',
274
        'ISO 3166-2:CV' => 'Cape Verde',
275
        'ISO 3166-2:KY' => 'Cayman Islands',
276
        'ISO 3166-2:CF' => 'Central African Republic',
277
        'ISO 3166-2:TD' => 'Chad',
278
        'ISO 3166-2:CL' => 'Chile',
279
        'ISO 3166-2:CN' => 'China',
280
        'ISO 3166-2:CX' => 'Christmas Island',
281
        'ISO 3166-2:CC' => 'Cocos (Keeling) Islands',
282
        'ISO 3166-2:CO' => 'Colombia',
283
        'ISO 3166-2:KM' => 'Comoros',
284
        'ISO 3166-2:CG' => 'Congo',
285
        'ISO 3166-2:CD' => 'Congo, the Democratic Republic of the',
286
        'ISO 3166-2:CK' => 'Cook Islands',
287
        'ISO 3166-2:CR' => 'Costa Rica',
288
        'ISO 3166-2:CI' => 'Côte d\Ivoire',
289
        'ISO 3166-2:HR' => 'Croatia',
290
        'ISO 3166-2:CU' => 'Cuba',
291
        'ISO 3166-2:CW' => 'Curaçao',
292
        'ISO 3166-2:CY' => 'Cyprus',
293
        'ISO 3166-2:CZ' => 'Czech Republic',
294
        'ISO 3166-2:DK' => 'Denmark',
295
        'ISO 3166-2:DJ' => 'Djibouti',
296
        'ISO 3166-2:DM' => 'Dominica',
297
        'ISO 3166-2:DO' => 'Dominican Republic',
298
        'ISO 3166-2:EC' => 'Ecuador',
299
        'ISO 3166-2:EG' => 'Egypt',
300
        'ISO 3166-2:SV' => 'El Salvador',
301
        'ISO 3166-2:GQ' => 'Equatorial Guinea',
302
        'ISO 3166-2:ER' => 'Eritrea',
303
        'ISO 3166-2:EE' => 'Estonia',
304
        'ISO 3166-2:ET' => 'Ethiopia',
305
        'ISO 3166-2:FK' => 'Falkland Islands (Malvinas)',
306
        'ISO 3166-2:FO' => 'Faroe Islands',
307
        'ISO 3166-2:FJ' => 'Fiji',
308
        'ISO 3166-2:FI' => 'Finland',
309
        'ISO 3166-2:FR' => 'France',
310
        'ISO 3166-2:GF' => 'French Guiana',
311
        'ISO 3166-2:PF' => 'French Polynesia',
312
        'ISO 3166-2:TF' => 'French Southern Territories',
313
        'ISO 3166-2:GA' => 'Gabon',
314
        'ISO 3166-2:GM' => 'Gambia',
315
        'ISO 3166-2:GE' => 'Georgia',
316
        'ISO 3166-2:DE' => 'Germany',
317
        'ISO 3166-2:GH' => 'Ghana',
318
        'ISO 3166-2:GI' => 'Gibraltar',
319
        'ISO 3166-2:GR' => 'Greece',
320
        'ISO 3166-2:GL' => 'Greenland',
321
        'ISO 3166-2:GD' => 'Grenada',
322
        'ISO 3166-2:GP' => 'Guadeloupe',
323
        'ISO 3166-2:GU' => 'Guam',
324
        'ISO 3166-2:GT' => 'Guatemala',
325
        'ISO 3166-2:GG' => 'Guernsey',
326
        'ISO 3166-2:GN' => 'Guinea',
327
        'ISO 3166-2:GW' => 'Guinea-Bissau',
328
        'ISO 3166-2:GY' => 'Guyana',
329
        'ISO 3166-2:HT' => 'Haiti',
330
        'ISO 3166-2:HM' => 'Heard Island and McDonald Islands',
331
        'ISO 3166-2:VA' => 'Holy See (Vatican City State)',
332
        'ISO 3166-2:HN' => 'Honduras',
333
        'ISO 3166-2:HK' => 'Hong Kong',
334
        'ISO 3166-2:HU' => 'Hungary',
335
        'ISO 3166-2:IS' => 'Iceland',
336
        'ISO 3166-2:IN' => 'India',
337
        'ISO 3166-2:ID' => 'Indonesia',
338
        'ISO 3166-2:IR' => 'Iran, Islamic Republic of',
339
        'ISO 3166-2:IQ' => 'Iraq',
340
        'ISO 3166-2:IE' => 'Ireland',
341
        'ISO 3166-2:IM' => 'Isle of Man',
342
        'ISO 3166-2:IL' => 'Israel',
343
        'ISO 3166-2:IT' => 'Italy',
344
        'ISO 3166-2:JM' => 'Jamaica',
345
        'ISO 3166-2:JP' => 'Japan',
346
        'ISO 3166-2:JE' => 'Jersey',
347
        'ISO 3166-2:JO' => 'Jordan',
348
        'ISO 3166-2:KZ' => 'Kazakhstan',
349
        'ISO 3166-2:KE' => 'Kenya',
350
        'ISO 3166-2:KI' => 'Kiribati',
351
        'ISO 3166-2:KP' => 'Korea, Democratic People\'s Republic of',
352
        'ISO 3166-2:KR' => 'Korea, Republic of',
353
        'ISO 3166-2:KW' => 'Kuwait',
354
        'ISO 3166-2:KG' => 'Kyrgyzstan',
355
        'ISO 3166-2:LA' => 'Lao People\'s Democratic Republic',
356
        'ISO 3166-2:LV' => 'Latvia',
357
        'ISO 3166-2:LB' => 'Lebanon',
358
        'ISO 3166-2:LS' => 'Lesotho',
359
        'ISO 3166-2:LR' => 'Liberia',
360
        'ISO 3166-2:LY' => 'Libya',
361
        'ISO 3166-2:LI' => 'Liechtenstein',
362
        'ISO 3166-2:LT' => 'Lithuania',
363
        'ISO 3166-2:LU' => 'Luxembourg',
364
        'ISO 3166-2:MO' => 'Macao',
365
        'ISO 3166-2:MK' => 'Macedonia, the former Yugoslav Republic of',
366
        'ISO 3166-2:MG' => 'Madagascar',
367
        'ISO 3166-2:MW' => 'Malawi',
368
        'ISO 3166-2:MY' => 'Malaysia',
369
        'ISO 3166-2:MV' => 'Maldives',
370
        'ISO 3166-2:ML' => 'Mali',
371
        'ISO 3166-2:MT' => 'Malta',
372
        'ISO 3166-2:MH' => 'Marshall Islands',
373
        'ISO 3166-2:MQ' => 'Martinique',
374
        'ISO 3166-2:MR' => 'Mauritania',
375
        'ISO 3166-2:MU' => 'Mauritius',
376
        'ISO 3166-2:YT' => 'Mayotte',
377
        'ISO 3166-2:MX' => 'Mexico',
378
        'ISO 3166-2:FM' => 'Micronesia, Federated States of',
379
        'ISO 3166-2:MD' => 'Moldova, Republic of',
380
        'ISO 3166-2:MC' => 'Monaco',
381
        'ISO 3166-2:MN' => 'Mongolia',
382
        'ISO 3166-2:ME' => 'Montenegro',
383
        'ISO 3166-2:MS' => 'Montserrat',
384
        'ISO 3166-2:MA' => 'Morocco',
385
        'ISO 3166-2:MZ' => 'Mozambique',
386
        'ISO 3166-2:MM' => 'Myanmar',
387
        'ISO 3166-2:NA' => 'Namibia',
388
        'ISO 3166-2:NR' => 'Nauru',
389
        'ISO 3166-2:NP' => 'Nepal',
390
        'ISO 3166-2:NL' => 'Netherlands',
391
        'ISO 3166-2:NC' => 'New Caledonia',
392
        'ISO 3166-2:NZ' => 'New Zealand',
393
        'ISO 3166-2:NI' => 'Nicaragua',
394
        'ISO 3166-2:NE' => 'Niger',
395
        'ISO 3166-2:NG' => 'Nigeria',
396
        'ISO 3166-2:NU' => 'Niue',
397
        'ISO 3166-2:NF' => 'Norfolk Island',
398
        'ISO 3166-2:MP' => 'Northern Mariana Islands',
399
        'ISO 3166-2:NO' => 'Norway',
400
        'ISO 3166-2:OM' => 'Oman',
401
        'ISO 3166-2:PK' => 'Pakistan',
402
        'ISO 3166-2:PW' => 'Palau',
403
        'ISO 3166-2:PS' => 'Palestinian Territory, Occupied',
404
        'ISO 3166-2:PA' => 'Panama',
405
        'ISO 3166-2:PG' => 'Papua New Guinea',
406
        'ISO 3166-2:PY' => 'Paraguay',
407
        'ISO 3166-2:PE' => 'Peru',
408
        'ISO 3166-2:PH' => 'Philippines',
409
        'ISO 3166-2:PN' => 'Pitcairn',
410
        'ISO 3166-2:PL' => 'Poland',
411
        'ISO 3166-2:PT' => 'Portugal',
412
        'ISO 3166-2:PR' => 'Puerto Rico',
413
        'ISO 3166-2:QA' => 'Qatar',
414
        'ISO 3166-2:RE' => 'Réunion',
415
        'ISO 3166-2:RO' => 'Romania',
416
        'ISO 3166-2:RU' => 'Russian Federation',
417
        'ISO 3166-2:RW' => 'Rwanda',
418
        'ISO 3166-2:BL' => 'Saint Barthélemy',
419
        'ISO 3166-2:SH' => 'Saint Helena, Ascension and Tristan da Cunha',
420
        'ISO 3166-2:KN' => 'Saint Kitts and Nevis',
421
        'ISO 3166-2:LC' => 'Saint Lucia',
422
        'ISO 3166-2:MF' => 'Saint Martin (French part)',
423
        'ISO 3166-2:PM' => 'Saint Pierre and Miquelon',
424
        'ISO 3166-2:VC' => 'Saint Vincent and the Grenadines',
425
        'ISO 3166-2:WS' => 'Samoa',
426
        'ISO 3166-2:SM' => 'San Marino',
427
        'ISO 3166-2:ST' => 'Sao Tome and Principe',
428
        'ISO 3166-2:SA' => 'Saudi Arabia',
429
        'ISO 3166-2:SN' => 'Senegal',
430
        'ISO 3166-2:RS' => 'Serbia',
431
        'ISO 3166-2:SC' => 'Seychelles',
432
        'ISO 3166-2:SL' => 'Sierra Leone',
433
        'ISO 3166-2:SG' => 'Singapore',
434
        'ISO 3166-2:SX' => 'Sint Maarten (Dutch part)',
435
        'ISO 3166-2:SK' => 'Slovakia',
436
        'ISO 3166-2:SI' => 'Slovenia',
437
        'ISO 3166-2:SB' => 'Solomon Islands',
438
        'ISO 3166-2:SO' => 'Somalia',
439
        'ISO 3166-2:ZA' => 'South Africa',
440
        'ISO 3166-2:GS' => 'South Georgia and the South Sandwich Islands',
441
        'ISO 3166-2:SS' => 'South Sudan',
442
        'ISO 3166-2:ES' => 'Spain',
443
        'ISO 3166-2:LK' => 'Sri Lanka',
444
        'ISO 3166-2:SD' => 'Sudan',
445
        'ISO 3166-2:SR' => 'Suriname',
446
        'ISO 3166-2:SJ' => 'Svalbard and Jan Mayen',
447
        'ISO 3166-2:SZ' => 'Swaziland',
448
        'ISO 3166-2:SE' => 'Sweden',
449
        'ISO 3166-2:CH' => 'Switzerland',
450
        'ISO 3166-2:SY' => 'Syrian Arab Republic',
451
        'ISO 3166-2:TW' => 'Taiwan, Province of China',
452
        'ISO 3166-2:TJ' => 'Tajikistan',
453
        'ISO 3166-2:TZ' => 'Tanzania, United Republic of',
454
        'ISO 3166-2:TH' => 'Thailand',
455
        'ISO 3166-2:TL' => 'Timor-Leste',
456
        'ISO 3166-2:TG' => 'Togo',
457
        'ISO 3166-2:TK' => 'Tokelau',
458
        'ISO 3166-2:TO' => 'Tonga',
459
        'ISO 3166-2:TT' => 'Trinidad and Tobago',
460
        'ISO 3166-2:TN' => 'Tunisia',
461
        'ISO 3166-2:TR' => 'Turkey',
462
        'ISO 3166-2:TM' => 'Turkmenistan',
463
        'ISO 3166-2:TC' => 'Turks and Caicos Islands',
464
        'ISO 3166-2:TV' => 'Tuvalu',
465
        'ISO 3166-2:UG' => 'Uganda',
466
        'ISO 3166-2:UA' => 'Ukraine',
467
        'ISO 3166-2:AE' => 'United Arab Emirates',
468
        'ISO 3166-2:GB' => 'United Kingdom',
469
        'ISO 3166-2:US' => 'United States',
470
        'ISO 3166-2:UM' => 'United States Minor Outlying Islands',
471
        'ISO 3166-2:UY' => 'Uruguay',
472
        'ISO 3166-2:UZ' => 'Uzbekistan',
473
        'ISO 3166-2:VU' => 'Vanuatu',
474
        'ISO 3166-2:VE' => 'Venezuela, Bolivarian Republic of',
475
        'ISO 3166-2:VN' => 'Viet Nam',
476
        'ISO 3166-2:VG' => 'Virgin Islands, British',
477
        'ISO 3166-2:VI' => 'Virgin Islands, U.S.',
478
        'ISO 3166-2:WF' => 'Wallis and Futuna',
479
        'ISO 3166-2:EH' => 'Western Sahara',
480
        'ISO 3166-2:YE' => 'Yemen',
481
        'ISO 3166-2:ZM' => 'Zambia',
482
        'ISO 3166-2:ZW' => 'Zimbabwe',
483
    ];
484
485
        return $this->select($name, $list, $selected, $options);
486
    }
487
488
    /**
489
     * @param  $name
490
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
491
     * @param  array $options
492
     *
493
     * @return string
494
     */
495
    public function selectCountryAlpha2($name, $selected = null, $options = [])
496
    {
497
        $list = [
498
        ''   => 'Select One...',
499
        'AF' => 'Afghanistan',
500
        'AX' => 'Aland Islands',
501
        'AL' => 'Albania',
502
        'DZ' => 'Algeria',
503
        'AS' => 'American Samoa',
504
        'AD' => 'Andorra',
505
        'AO' => 'Angola',
506
        'AI' => 'Anguilla',
507
        'AQ' => 'Antarctica',
508
        'AG' => 'Antigua and Barbuda',
509
        'AR' => 'Argentina',
510
        'AM' => 'Armenia',
511
        'AW' => 'Aruba',
512
        'AU' => 'Australia',
513
        'AT' => 'Austria',
514
        'AZ' => 'Azerbaijan',
515
        'BS' => 'Bahamas',
516
        'BH' => 'Bahrain',
517
        'BD' => 'Bangladesh',
518
        'BB' => 'Barbados',
519
        'BY' => 'Belarus',
520
        'BE' => 'Belgium',
521
        'BZ' => 'Belize',
522
        'BJ' => 'Benin',
523
        'BM' => 'Bermuda',
524
        'BT' => 'Bhutan',
525
        'BO' => 'Bolivia',
526
        'BA' => 'Bosnia and Herzegovina',
527
        'BW' => 'Botswana',
528
        'BV' => 'Bouvet Island',
529
        'BR' => 'Brazil',
530
        'IO' => 'British Indian Ocean Territory',
531
        'BN' => 'Brunei Darussalam',
532
        'BG' => 'Bulgaria',
533
        'BF' => 'Burkina Faso',
534
        'BI' => 'Burundi',
535
        'KH' => 'Cambodia',
536
        'CM' => 'Cameroon',
537
        'CA' => 'Canada',
538
        'CV' => 'Cape Verde',
539
        'KY' => 'Cayman Islands',
540
        'CF' => 'Central African Republic',
541
        'TD' => 'Chad',
542
        'CL' => 'Chile',
543
        'CN' => 'China',
544
        'CX' => 'Christmas Island',
545
        'CC' => 'Cocos (Keeling) Islands',
546
        'CO' => 'Colombia',
547
        'KM' => 'Comoros',
548
        'CG' => 'Congo',
549
        'CD' => 'Congo, The Democratic Republic of The',
550
        'CK' => 'Cook Islands',
551
        'CR' => 'Costa Rica',
552
        'CI' => 'Cote D\'ivoire',
553
        'HR' => 'Croatia',
554
        'CU' => 'Cuba',
555
        'CY' => 'Cyprus',
556
        'CZ' => 'Czech Republic',
557
        'DK' => 'Denmark',
558
        'DJ' => 'Djibouti',
559
        'DM' => 'Dominica',
560
        'DO' => 'Dominican Republic',
561
        'EC' => 'Ecuador',
562
        'EG' => 'Egypt',
563
        'SV' => 'El Salvador',
564
        'GQ' => 'Equatorial Guinea',
565
        'ER' => 'Eritrea',
566
        'EE' => 'Estonia',
567
        'ET' => 'Ethiopia',
568
        'FK' => 'Falkland Islands (Malvinas)',
569
        'FO' => 'Faroe Islands',
570
        'FJ' => 'Fiji',
571
        'FI' => 'Finland',
572
        'FR' => 'France',
573
        'GF' => 'French Guiana',
574
        'PF' => 'French Polynesia',
575
        'TF' => 'French Southern Territories',
576
        'GA' => 'Gabon',
577
        'GM' => 'Gambia',
578
        'GE' => 'Georgia',
579
        'DE' => 'Germany',
580
        'GH' => 'Ghana',
581
        'GI' => 'Gibraltar',
582
        'GR' => 'Greece',
583
        'GL' => 'Greenland',
584
        'GD' => 'Grenada',
585
        'GP' => 'Guadeloupe',
586
        'GU' => 'Guam',
587
        'GT' => 'Guatemala',
588
        'GG' => 'Guernsey',
589
        'GN' => 'Guinea',
590
        'GW' => 'Guinea-bissau',
591
        'GY' => 'Guyana',
592
        'HT' => 'Haiti',
593
        'HM' => 'Heard Island and Mcdonald Islands',
594
        'VA' => 'Holy See (Vatican City State)',
595
        'HN' => 'Honduras',
596
        'HK' => 'Hong Kong',
597
        'HU' => 'Hungary',
598
        'IS' => 'Iceland',
599
        'IN' => 'India',
600
        'ID' => 'Indonesia',
601
        'IR' => 'Iran, Islamic Republic of',
602
        'IQ' => 'Iraq',
603
        'IE' => 'Ireland',
604
        'IM' => 'Isle of Man',
605
        'IL' => 'Israel',
606
        'IT' => 'Italy',
607
        'JM' => 'Jamaica',
608
        'JP' => 'Japan',
609
        'JE' => 'Jersey',
610
        'JO' => 'Jordan',
611
        'KZ' => 'Kazakhstan',
612
        'KE' => 'Kenya',
613
        'KI' => 'Kiribati',
614
        'KP' => 'Korea, Democratic People\'s Republic of',
615
        'KR' => 'Korea, Republic of',
616
        'KW' => 'Kuwait',
617
        'KG' => 'Kyrgyzstan',
618
        'LA' => 'Lao People\'s Democratic Republic',
619
        'LV' => 'Latvia',
620
        'LB' => 'Lebanon',
621
        'LS' => 'Lesotho',
622
        'LR' => 'Liberia',
623
        'LY' => 'Libyan Arab Jamahiriya',
624
        'LI' => 'Liechtenstein',
625
        'LT' => 'Lithuania',
626
        'LU' => 'Luxembourg',
627
        'MO' => 'Macao',
628
        'MK' => 'Macedonia, The Former Yugoslav Republic of',
629
        'MG' => 'Madagascar',
630
        'MW' => 'Malawi',
631
        'MY' => 'Malaysia',
632
        'MV' => 'Maldives',
633
        'ML' => 'Mali',
634
        'MT' => 'Malta',
635
        'MH' => 'Marshall Islands',
636
        'MQ' => 'Martinique',
637
        'MR' => 'Mauritania',
638
        'MU' => 'Mauritius',
639
        'YT' => 'Mayotte',
640
        'MX' => 'Mexico',
641
        'FM' => 'Micronesia, Federated States of',
642
        'MD' => 'Moldova, Republic of',
643
        'MC' => 'Monaco',
644
        'MN' => 'Mongolia',
645
        'ME' => 'Montenegro',
646
        'MS' => 'Montserrat',
647
        'MA' => 'Morocco',
648
        'MZ' => 'Mozambique',
649
        'MM' => 'Myanmar',
650
        'NA' => 'Namibia',
651
        'NR' => 'Nauru',
652
        'NP' => 'Nepal',
653
        'NL' => 'Netherlands',
654
        'AN' => 'Netherlands Antilles',
655
        'NC' => 'New Caledonia',
656
        'NZ' => 'New Zealand',
657
        'NI' => 'Nicaragua',
658
        'NE' => 'Niger',
659
        'NG' => 'Nigeria',
660
        'NU' => 'Niue',
661
        'NF' => 'Norfolk Island',
662
        'MP' => 'Northern Mariana Islands',
663
        'NO' => 'Norway',
664
        'OM' => 'Oman',
665
        'PK' => 'Pakistan',
666
        'PW' => 'Palau',
667
        'PS' => 'Palestinian Territory, Occupied',
668
        'PA' => 'Panama',
669
        'PG' => 'Papua New Guinea',
670
        'PY' => 'Paraguay',
671
        'PE' => 'Peru',
672
        'PH' => 'Philippines',
673
        'PN' => 'Pitcairn',
674
        'PL' => 'Poland',
675
        'PT' => 'Portugal',
676
        'PR' => 'Puerto Rico',
677
        'QA' => 'Qatar',
678
        'RE' => 'Reunion',
679
        'RO' => 'Romania',
680
        'RU' => 'Russian Federation',
681
        'RW' => 'Rwanda',
682
        'SH' => 'Saint Helena',
683
        'KN' => 'Saint Kitts and Nevis',
684
        'LC' => 'Saint Lucia',
685
        'PM' => 'Saint Pierre and Miquelon',
686
        'VC' => 'Saint Vincent and The Grenadines',
687
        'WS' => 'Samoa',
688
        'SM' => 'San Marino',
689
        'ST' => 'Sao Tome and Principe',
690
        'SA' => 'Saudi Arabia',
691
        'SN' => 'Senegal',
692
        'RS' => 'Serbia',
693
        'SC' => 'Seychelles',
694
        'SL' => 'Sierra Leone',
695
        'SG' => 'Singapore',
696
        'SK' => 'Slovakia',
697
        'SI' => 'Slovenia',
698
        'SB' => 'Solomon Islands',
699
        'SO' => 'Somalia',
700
        'ZA' => 'South Africa',
701
        'GS' => 'South Georgia and The South Sandwich Islands',
702
        'ES' => 'Spain',
703
        'LK' => 'Sri Lanka',
704
        'SD' => 'Sudan',
705
        'SR' => 'Suriname',
706
        'SJ' => 'Svalbard and Jan Mayen',
707
        'SZ' => 'Swaziland',
708
        'SE' => 'Sweden',
709
        'CH' => 'Switzerland',
710
        'SY' => 'Syrian Arab Republic',
711
        'TW' => 'Taiwan, Province of China',
712
        'TJ' => 'Tajikistan',
713
        'TZ' => 'Tanzania, United Republic of',
714
        'TH' => 'Thailand',
715
        'TL' => 'Timor-leste',
716
        'TG' => 'Togo',
717
        'TK' => 'Tokelau',
718
        'TO' => 'Tonga',
719
        'TT' => 'Trinidad and Tobago',
720
        'TN' => 'Tunisia',
721
        'TR' => 'Turkey',
722
        'TM' => 'Turkmenistan',
723
        'TC' => 'Turks and Caicos Islands',
724
        'TV' => 'Tuvalu',
725
        'UG' => 'Uganda',
726
        'UA' => 'Ukraine',
727
        'AE' => 'United Arab Emirates',
728
        'GB' => 'United Kingdom',
729
        'US' => 'United States',
730
        'UM' => 'United States Minor Outlying Islands',
731
        'UY' => 'Uruguay',
732
        'UZ' => 'Uzbekistan',
733
        'VU' => 'Vanuatu',
734
        'VE' => 'Venezuela',
735
        'VN' => 'Viet Nam',
736
        'VG' => 'Virgin Islands, British',
737
        'VI' => 'Virgin Islands, U.S.',
738
        'WF' => 'Wallis and Futuna',
739
        'EH' => 'Western Sahara',
740
        'YE' => 'Yemen',
741
        'ZM' => 'Zambia',
742
        'ZW' => 'Zimbabwe',
743
    ];
744
745
        return $this->select($name, $list, $selected, $options);
746
    }
747
748
    /**
749
     * @param  $name
750
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
751
     * @param  array $options
752
     *
753
     * @return string
754
     */
755
    public function selectCountryAlpha3($name, $selected = null, $options = [])
756
    {
757
        $list = [
758
        ''    => 'Select One...',
759
        'AFG' => 'Afghanistan',
760
        'ALA' => 'Åland Islands',
761
        'ALB' => 'Albania',
762
        'DZA' => 'Algeria',
763
        'ASM' => 'American Samoa',
764
        'AND' => 'Andorra',
765
        'AGO' => 'Angola',
766
        'AIA' => 'Anguilla',
767
        'ATA' => 'Antarctica',
768
        'ATG' => 'Antigua and Barbuda',
769
        'ARG' => 'Argentina',
770
        'ARM' => 'Armenia',
771
        'ABW' => 'Aruba',
772
        'AUS' => 'Australia',
773
        'AUT' => 'Austria',
774
        'AZE' => 'Azerbaijan',
775
        'BHS' => 'Bahamas',
776
        'BHR' => 'Bahrain',
777
        'BGD' => 'Bangladesh',
778
        'BRB' => 'Barbados',
779
        'BLR' => 'Belarus',
780
        'BEL' => 'Belgium',
781
        'BLZ' => 'Belize',
782
        'BEN' => 'Benin',
783
        'BMU' => 'Bermuda',
784
        'BTN' => 'Bhutan',
785
        'BOL' => 'Bolivia, Plurinational State of',
786
        'BES' => 'Bonaire, Sint Eustatius and Saba',
787
        'BIH' => 'Bosnia and Herzegovina',
788
        'BWA' => 'Botswana',
789
        'BVT' => 'Bouvet Island',
790
        'BRA' => 'Brazil',
791
        'IOT' => 'British Indian Ocean Territory',
792
        'BRN' => 'Brunei Darussalam',
793
        'BGR' => 'Bulgaria',
794
        'BFA' => 'Burkina Faso',
795
        'BDI' => 'Burundi',
796
        'KHM' => 'Cambodia',
797
        'CMR' => 'Cameroon',
798
        'CAN' => 'Canada',
799
        'CPV' => 'Cape Verde',
800
        'CYM' => 'Cayman Islands',
801
        'CAF' => 'Central African Republic',
802
        'TCD' => 'Chad',
803
        'CHL' => 'Chile',
804
        'CHN' => 'China',
805
        'CXR' => 'Christmas Island',
806
        'CCK' => 'Cocos (Keeling) Islands',
807
        'COL' => 'Colombia',
808
        'COM' => 'Comoros',
809
        'COG' => 'Congo',
810
        'COD' => 'Congo, the Democratic Republic of the',
811
        'COK' => 'Cook Islands',
812
        'CRI' => 'Costa Rica',
813
        'CIV' => 'Côte d\'Ivoire',
814
        'HRV' => 'Croatia',
815
        'CUB' => 'Cuba',
816
        'CUW' => 'Curaçao',
817
        'CYP' => 'Cyprus',
818
        'CZE' => 'Czech Republic',
819
        'DNK' => 'Denmark',
820
        'DJI' => 'Djibouti',
821
        'DMA' => 'Dominica',
822
        'DOM' => 'Dominican Republic',
823
        'ECU' => 'Ecuador',
824
        'EGY' => 'Egypt',
825
        'SLV' => 'El Salvador',
826
        'GNQ' => 'Equatorial Guinea',
827
        'ERI' => 'Eritrea',
828
        'EST' => 'Estonia',
829
        'ETH' => 'Ethiopia',
830
        'FLK' => 'Falkland Islands (Malvinas)',
831
        'FRO' => 'Faroe Islands',
832
        'FJI' => 'Fiji',
833
        'FIN' => 'Finland',
834
        'FRA' => 'France',
835
        'GUF' => 'French Guiana',
836
        'PYF' => 'French Polynesia',
837
        'ATF' => 'French Southern Territories',
838
        'GAB' => 'Gabon',
839
        'GMB' => 'Gambia',
840
        'GEO' => 'Georgia',
841
        'DEU' => 'Germany',
842
        'GHA' => 'Ghana',
843
        'GIB' => 'Gibraltar',
844
        'GRC' => 'Greece',
845
        'GRL' => 'Greenland',
846
        'GRD' => 'Grenada',
847
        'GLP' => 'Guadeloupe',
848
        'GUM' => 'Guam',
849
        'GTM' => 'Guatemala',
850
        'GGY' => 'Guernsey',
851
        'GIN' => 'Guinea',
852
        'GNB' => 'Guinea-Bissau',
853
        'GUY' => 'Guyana',
854
        'HTI' => 'Haiti',
855
        'HMD' => 'Heard Island and McDonald Islands',
856
        'VAT' => 'Holy See (Vatican City State)',
857
        'HND' => 'Honduras',
858
        'HKG' => 'Hong Kong',
859
        'HUN' => 'Hungary',
860
        'ISL' => 'Iceland',
861
        'IND' => 'India',
862
        'IDN' => 'Indonesia',
863
        'IRN' => 'Iran, Islamic Republic of',
864
        'IRQ' => 'Iraq',
865
        'IRL' => 'Ireland',
866
        'IMN' => 'Isle of Man',
867
        'ISR' => 'Israel',
868
        'ITA' => 'Italy',
869
        'JAM' => 'Jamaica',
870
        'JPN' => 'Japan',
871
        'JEY' => 'Jersey',
872
        'JOR' => 'Jordan',
873
        'KAZ' => 'Kazakhstan',
874
        'KEN' => 'Kenya',
875
        'KIR' => 'Kiribati',
876
        'PRK' => 'Korea, Democratic People\'s Republic of',
877
        'KOR' => 'Korea, Republic of',
878
        'KWT' => 'Kuwait',
879
        'KGZ' => 'Kyrgyzstan',
880
        'LAO' => 'Lao People\'s Democratic Republic',
881
        'LVA' => 'Latvia',
882
        'LBN' => 'Lebanon',
883
        'LSO' => 'Lesotho',
884
        'LBR' => 'Liberia',
885
        'LBY' => 'Libya',
886
        'LIE' => 'Liechtenstein',
887
        'LTU' => 'Lithuania',
888
        'LUX' => 'Luxembourg',
889
        'MAC' => 'Macao',
890
        'MKD' => 'Macedonia, the former Yugoslav Republic of',
891
        'MDG' => 'Madagascar',
892
        'MWI' => 'Malawi',
893
        'MYS' => 'Malaysia',
894
        'MDV' => 'Maldives',
895
        'MLI' => 'Mali',
896
        'MLT' => 'Malta',
897
        'MHL' => 'Marshall Islands',
898
        'MTQ' => 'Martinique',
899
        'MRT' => 'Mauritania',
900
        'MUS' => 'Mauritius',
901
        'MYT' => 'Mayotte',
902
        'MEX' => 'Mexico',
903
        'FSM' => 'Micronesia, Federated States of',
904
        'MDA' => 'Moldova, Republic of',
905
        'MCO' => 'Monaco',
906
        'MNG' => 'Mongolia',
907
        'MNE' => 'Montenegro',
908
        'MSR' => 'Montserrat',
909
        'MAR' => 'Morocco',
910
        'MOZ' => 'Mozambique',
911
        'MMR' => 'Myanmar',
912
        'NAM' => 'Namibia',
913
        'NRU' => 'Nauru',
914
        'NPL' => 'Nepal',
915
        'NLD' => 'Netherlands',
916
        'NCL' => 'New Caledonia',
917
        'NZL' => 'New Zealand',
918
        'NIC' => 'Nicaragua',
919
        'NER' => 'Niger',
920
        'NGA' => 'Nigeria',
921
        'NIU' => 'Niue',
922
        'NFK' => 'Norfolk Island',
923
        'MNP' => 'Northern Mariana Islands',
924
        'NOR' => 'Norway',
925
        'OMN' => 'Oman',
926
        'PAK' => 'Pakistan',
927
        'PLW' => 'Palau',
928
        'PSE' => 'Palestinian Territory, Occupied',
929
        'PAN' => 'Panama',
930
        'PNG' => 'Papua New Guinea',
931
        'PRY' => 'Paraguay',
932
        'PER' => 'Peru',
933
        'PHL' => 'Philippines',
934
        'PCN' => 'Pitcairn',
935
        'POL' => 'Poland',
936
        'PRT' => 'Portugal',
937
        'PRI' => 'Puerto Rico',
938
        'QAT' => 'Qatar',
939
        'REU' => 'Réunion',
940
        'ROU' => 'Romania',
941
        'RUS' => 'Russian Federation',
942
        'RWA' => 'Rwanda',
943
        'BLM' => 'Saint Barthélemy',
944
        'SHN' => 'Saint Helena, Ascension and Tristan da Cunha',
945
        'KNA' => 'Saint Kitts and Nevis',
946
        'LCA' => 'Saint Lucia',
947
        'MAF' => 'Saint Martin (French part)',
948
        'SPM' => 'Saint Pierre and Miquelon',
949
        'VCT' => 'Saint Vincent and the Grenadines',
950
        'WSM' => 'Samoa',
951
        'SMR' => 'San Marino',
952
        'STP' => 'Sao Tome and Principe',
953
        'SAU' => 'Saudi Arabia',
954
        'SEN' => 'Senegal',
955
        'SRB' => 'Serbia',
956
        'SYC' => 'Seychelles',
957
        'SLE' => 'Sierra Leone',
958
        'SGP' => 'Singapore',
959
        'SXM' => 'Sint Maarten (Dutch part)',
960
        'SVK' => 'Slovakia',
961
        'SVN' => 'Slovenia',
962
        'SLB' => 'Solomon Islands',
963
        'SOM' => 'Somalia',
964
        'ZAF' => 'South Africa',
965
        'SGS' => 'South Georgia and the South Sandwich Islands',
966
        'SSD' => 'South Sudan',
967
        'ESP' => 'Spain',
968
        'LKA' => 'Sri Lanka',
969
        'SDN' => 'Sudan',
970
        'SUR' => 'Suriname',
971
        'SJM' => 'Svalbard and Jan Mayen',
972
        'SWZ' => 'Swaziland',
973
        'SWE' => 'Sweden',
974
        'CHE' => 'Switzerland',
975
        'SYR' => 'Syrian Arab Republic',
976
        'TWN' => 'Taiwan, Province of China',
977
        'TJK' => 'Tajikistan',
978
        'TZA' => 'Tanzania, United Republic of',
979
        'THA' => 'Thailand',
980
        'TLS' => 'Timor-Leste',
981
        'TGO' => 'Togo',
982
        'TKL' => 'Tokelau',
983
        'TON' => 'Tonga',
984
        'TTO' => 'Trinidad and Tobago',
985
        'TUN' => 'Tunisia',
986
        'TUR' => 'Turkey',
987
        'TKM' => 'Turkmenistan',
988
        'TCA' => 'Turks and Caicos Islands',
989
        'TUV' => 'Tuvalu',
990
        'UGA' => 'Uganda',
991
        'UKR' => 'Ukraine',
992
        'ARE' => 'United Arab Emirates',
993
        'GBR' => 'United Kingdom',
994
        'USA' => 'United States',
995
        'UMI' => 'United States Minor Outlying Islands',
996
        'URY' => 'Uruguay',
997
        'UZB' => 'Uzbekistan',
998
        'VUT' => 'Vanuatu',
999
        'VEN' => 'Venezuela, Bolivarian Republic of',
1000
        'VNM' => 'Viet Nam',
1001
        'VGB' => 'Virgin Islands, British',
1002
        'VIR' => 'Virgin Islands, U.S.',
1003
        'WLF' => 'Wallis and Futuna',
1004
        'ESH' => 'Western Sahara',
1005
        'YEM' => 'Yemen',
1006
        'ZMB' => 'Zambia',
1007
        'ZWE' => 'Zimbabwe',
1008
    ];
1009
1010
        return $this->select($name, $list, $selected, $options);
1011
    }
1012
1013
    /**
1014
     * @param  $name
1015
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
1016
     * @param  array $options
1017
     *
1018
     * @return string
1019
     */
1020
    public function selectCountryNumeric($name, $selected = null, $options = [])
1021
    {
1022
        $list = [
1023
        ''    => 'Select One...',
1024
        '4'   => 'Afghanistan',
1025
        '248' => 'Åland Islands',
1026
        '8'   => 'Albania',
1027
        '12'  => 'Algeria',
1028
        '16'  => 'American Samoa',
1029
        '20'  => 'Andorra',
1030
        '24'  => 'Angola',
1031
        '660' => 'Anguilla',
1032
        '10'  => 'Antarctica',
1033
        '28'  => 'Antigua and Barbuda',
1034
        '32'  => 'Argentina',
1035
        '51'  => 'Armenia',
1036
        '533' => 'Aruba',
1037
        '36'  => 'Australia',
1038
        '40'  => 'Austria',
1039
        '31'  => 'Azerbaijan',
1040
        '44'  => 'Bahamas',
1041
        '48'  => 'Bahrain',
1042
        '50'  => 'Bangladesh',
1043
        '52'  => 'Barbados',
1044
        '112' => 'Belarus',
1045
        '56'  => 'Belgium',
1046
        '84'  => 'Belize',
1047
        '204' => 'Benin',
1048
        '60'  => 'Bermuda',
1049
        '64'  => 'Bhutan',
1050
        '68'  => 'Bolivia, Plurinational State of',
1051
        '535' => 'Bonaire, Sint Eustatius and Saba',
1052
        '70'  => 'Bosnia and Herzegovina',
1053
        '72'  => 'Botswana',
1054
        '74'  => 'Bouvet Island',
1055
        '76'  => 'Brazil',
1056
        '86'  => 'British Indian Ocean Territory',
1057
        '96'  => 'Brunei Darussalam',
1058
        '100' => 'Bulgaria',
1059
        '854' => 'Burkina Faso',
1060
        '108' => 'Burundi',
1061
        '116' => 'Cambodia',
1062
        '120' => 'Cameroon',
1063
        '124' => 'Canada',
1064
        '132' => 'Cape Verde',
1065
        '136' => 'Cayman Islands',
1066
        '140' => 'Central African Republic',
1067
        '148' => 'Chad',
1068
        '152' => 'Chile',
1069
        '156' => 'China',
1070
        '162' => 'Christmas Island',
1071
        '166' => 'Cocos (Keeling) Islands',
1072
        '170' => 'Colombia',
1073
        '174' => 'Comoros',
1074
        '178' => 'Congo',
1075
        '180' => 'Congo, the Democratic Republic of the',
1076
        '184' => 'Cook Islands',
1077
        '188' => 'Costa Rica',
1078
        '384' => 'Côte d\'Ivoire',
1079
        '191' => 'Croatia',
1080
        '192' => 'Cuba',
1081
        '531' => 'Curaçao',
1082
        '196' => 'Cyprus',
1083
        '203' => 'Czech Republic',
1084
        '208' => 'Denmark',
1085
        '262' => 'Djibouti',
1086
        '212' => 'Dominica',
1087
        '214' => 'Dominican Republic',
1088
        '218' => 'Ecuador',
1089
        '818' => 'Egypt',
1090
        '222' => 'El Salvador',
1091
        '226' => 'Equatorial Guinea',
1092
        '232' => 'Eritrea',
1093
        '233' => 'Estonia',
1094
        '231' => 'Ethiopia',
1095
        '238' => 'Falkland Islands (Malvinas)',
1096
        '234' => 'Faroe Islands',
1097
        '242' => 'Fiji',
1098
        '246' => 'Finland',
1099
        '250' => 'France',
1100
        '254' => 'French Guiana',
1101
        '258' => 'French Polynesia',
1102
        '260' => 'French Southern Territories',
1103
        '266' => 'Gabon',
1104
        '270' => 'Gambia',
1105
        '268' => 'Georgia',
1106
        '276' => 'Germany',
1107
        '288' => 'Ghana',
1108
        '292' => 'Gibraltar',
1109
        '300' => 'Greece',
1110
        '304' => 'Greenland',
1111
        '308' => 'Grenada',
1112
        '312' => 'Guadeloupe',
1113
        '316' => 'Guam',
1114
        '320' => 'Guatemala',
1115
        '831' => 'Guernsey',
1116
        '324' => 'Guinea',
1117
        '624' => 'Guinea-Bissau',
1118
        '328' => 'Guyana',
1119
        '332' => 'Haiti',
1120
        '334' => 'Heard Island and McDonald Islands',
1121
        '336' => 'Holy See (Vatican City State)',
1122
        '340' => 'Honduras',
1123
        '344' => 'Hong Kong',
1124
        '348' => 'Hungary',
1125
        '352' => 'Iceland',
1126
        '356' => 'India',
1127
        '360' => 'Indonesia',
1128
        '364' => 'Iran, Islamic Republic of',
1129
        '368' => 'Iraq',
1130
        '372' => 'Ireland',
1131
        '833' => 'Isle of Man',
1132
        '376' => 'Israel',
1133
        '380' => 'Italy',
1134
        '388' => 'Jamaica',
1135
        '392' => 'Japan',
1136
        '832' => 'Jersey',
1137
        '400' => 'Jordan',
1138
        '398' => 'Kazakhstan',
1139
        '404' => 'Kenya',
1140
        '296' => 'Kiribati',
1141
        '408' => 'Korea, Democratic People\'s Republic of',
1142
        '410' => 'Korea, Republic of',
1143
        '414' => 'Kuwait',
1144
        '417' => 'Kyrgyzstan',
1145
        '418' => 'Lao People\'s Democratic Republic',
1146
        '428' => 'Latvia',
1147
        '422' => 'Lebanon',
1148
        '426' => 'Lesotho',
1149
        '430' => 'Liberia',
1150
        '434' => 'Libya',
1151
        '438' => 'Liechtenstein',
1152
        '440' => 'Lithuania',
1153
        '442' => 'Luxembourg',
1154
        '446' => 'Macao',
1155
        '807' => 'Macedonia, the former Yugoslav Republic of',
1156
        '450' => 'Madagascar',
1157
        '454' => 'Malawi',
1158
        '458' => 'Malaysia',
1159
        '462' => 'Maldives',
1160
        '466' => 'Mali',
1161
        '470' => 'Malta',
1162
        '584' => 'Marshall Islands',
1163
        '474' => 'Martinique',
1164
        '478' => 'Mauritania',
1165
        '480' => 'Mauritius',
1166
        '175' => 'Mayotte',
1167
        '484' => 'Mexico',
1168
        '583' => 'Micronesia, Federated States of',
1169
        '498' => 'Moldova, Republic of',
1170
        '492' => 'Monaco',
1171
        '496' => 'Mongolia',
1172
        '499' => 'Montenegro',
1173
        '500' => 'Montserrat',
1174
        '504' => 'Morocco',
1175
        '508' => 'Mozambique',
1176
        '104' => 'Myanmar',
1177
        '516' => 'Namibia',
1178
        '520' => 'Nauru',
1179
        '524' => 'Nepal',
1180
        '528' => 'Netherlands',
1181
        '540' => 'New Caledonia',
1182
        '554' => 'New Zealand',
1183
        '558' => 'Nicaragua',
1184
        '562' => 'Niger',
1185
        '566' => 'Nigeria',
1186
        '570' => 'Niue',
1187
        '574' => 'Norfolk Island',
1188
        '580' => 'Northern Mariana Islands',
1189
        '578' => 'Norway',
1190
        '512' => 'Oman',
1191
        '586' => 'Pakistan',
1192
        '585' => 'Palau',
1193
        '275' => 'Palestinian Territory, Occupied',
1194
        '591' => 'Panama',
1195
        '598' => 'Papua New Guinea',
1196
        '600' => 'Paraguay',
1197
        '604' => 'Peru',
1198
        '608' => 'Philippines',
1199
        '612' => 'Pitcairn',
1200
        '616' => 'Poland',
1201
        '620' => 'Portugal',
1202
        '630' => 'Puerto Rico',
1203
        '634' => 'Qatar',
1204
        '638' => 'Réunion',
1205
        '642' => 'Romania',
1206
        '643' => 'Russian Federation',
1207
        '646' => 'Rwanda',
1208
        '652' => 'Saint Barthélemy',
1209
        '654' => 'Saint Helena, Ascension and Tristan da Cunha',
1210
        '659' => 'Saint Kitts and Nevis',
1211
        '662' => 'Saint Lucia',
1212
        '663' => 'Saint Martin (French part)',
1213
        '666' => 'Saint Pierre and Miquelon',
1214
        '670' => 'Saint Vincent and the Grenadines',
1215
        '882' => 'Samoa',
1216
        '674' => 'San Marino',
1217
        '678' => 'Sao Tome and Principe',
1218
        '682' => 'Saudi Arabia',
1219
        '686' => 'Senegal',
1220
        '688' => 'Serbia',
1221
        '690' => 'Seychelles',
1222
        '694' => 'Sierra Leone',
1223
        '702' => 'Singapore',
1224
        '534' => 'Sint Maarten (Dutch part)',
1225
        '703' => 'Slovakia',
1226
        '705' => 'Slovenia',
1227
        '90'  => 'Solomon Islands',
1228
        '706' => 'Somalia',
1229
        '710' => 'South Africa',
1230
        '239' => 'South Georgia and the South Sandwich Islands',
1231
        '728' => 'South Sudan',
1232
        '724' => 'Spain',
1233
        '144' => 'Sri Lanka',
1234
        '729' => 'Sudan',
1235
        '740' => 'Suriname',
1236
        '744' => 'Svalbard and Jan Mayen',
1237
        '748' => 'Swaziland',
1238
        '752' => 'Sweden',
1239
        '756' => 'Switzerland',
1240
        '760' => 'Syrian Arab Republic',
1241
        '158' => 'Taiwan, Province of China',
1242
        '762' => 'Tajikistan',
1243
        '834' => 'Tanzania, United Republic of',
1244
        '764' => 'Thailand',
1245
        '626' => 'Timor-Leste',
1246
        '768' => 'Togo',
1247
        '772' => 'Tokelau',
1248
        '776' => 'Tonga',
1249
        '780' => 'Trinidad and Tobago',
1250
        '788' => 'Tunisia',
1251
        '792' => 'Turkey',
1252
        '795' => 'Turkmenistan',
1253
        '796' => 'Turks and Caicos Islands',
1254
        '798' => 'Tuvalu',
1255
        '800' => 'Uganda',
1256
        '804' => 'Ukraine',
1257
        '784' => 'United Arab Emirates',
1258
        '826' => 'United Kingdom',
1259
        '840' => 'United States',
1260
        '581' => 'United States Minor Outlying Islands',
1261
        '858' => 'Uruguay',
1262
        '860' => 'Uzbekistan',
1263
        '548' => 'Vanuatu',
1264
        '862' => 'Venezuela, Bolivarian Republic of',
1265
        '704' => 'Viet Nam',
1266
        '92'  => 'Virgin Islands, British',
1267
        '850' => 'Virgin Islands, U.S.',
1268
        '876' => 'Wallis and Futuna',
1269
        '732' => 'Western Sahara',
1270
        '887' => 'Yemen',
1271
        '894' => 'Zambia',
1272
        '716' => 'Zimbabwe',
1273
    ];
1274
1275
        return $this->select($name, $list, $selected, $options);
1276
    }
1277
1278
    /**
1279
     * @param  $name
1280
     * @param  null $selected
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $selected is correct as it would always require null to be passed?
Loading history...
1281
     * @param  array $options
1282
     *
1283
     * @return mixed
1284
     */
1285
    public function selectTimezone($name, $selected = null, $options = [])
1286
    {
1287
        $list = [];
1288
        $utc  = new \DateTimeZone('UTC');
1289
        $dt   = new \DateTime('now', $utc);
1290
1291
        foreach (\DateTimeZone::listIdentifiers() as $tz) {
1292
            $current_tz = new \DateTimeZone($tz);
1293
            $offset     = $current_tz->getOffset($dt);
1294
            $transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp());
1295
            $abbr       = $transition[0]['abbr'];
1296
1297
            $list[$tz] = $tz . ' [' . $abbr . ' ' . $this->formatOffset($offset) . ']';
1298
        }
1299
1300
        return $this->select($name, $list, $selected, $options);
1301
    }
1302
1303
    /**
1304
     * @param  $offset
1305
     *
1306
     * @return string
1307
     */
1308
    private function formatOffset($offset)
1309
    {
1310
        $hours     = $offset / 3600;
1311
        $remainder = $offset % 3600;
1312
        $sign      = $hours > 0 ? '+' : '-';
1313
        $hour      = (int) abs($hours);
1314
        $minutes   = (int) abs($remainder / 60);
1315
1316
        if ($hour == 0 && $minutes == 0) {
1317
            $sign = ' ';
1318
        }
1319
1320
        return $sign . str_pad($hour, 2, '0', STR_PAD_LEFT) . ':' . str_pad($minutes, 2, '0');
1321
    }
1322
}
1323