Conditions | 1 |
Paths | 1 |
Total Lines | 254 |
Code Lines | 251 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
2 | function get_country_list() { |
||
3 | $country_list = [ |
||
4 | "AF" => "Afghanistan", |
||
5 | "AX" => "Åland Islands", |
||
6 | "AL" => "Albania", |
||
7 | "DZ" => "Algeria", |
||
8 | "AS" => "American Samoa", |
||
9 | "AD" => "Andorra", |
||
10 | "AO" => "Angola", |
||
11 | "AI" => "Anguilla", |
||
12 | "AQ" => "Antarctica", |
||
13 | "AG" => "Antigua and Barbuda", |
||
14 | "AR" => "Argentina", |
||
15 | "AM" => "Armenia", |
||
16 | "AW" => "Aruba", |
||
17 | "AU" => "Australia", |
||
18 | "AT" => "Austria", |
||
19 | "AZ" => "Azerbaijan", |
||
20 | "BS" => "Bahamas", |
||
21 | "BH" => "Bahrain", |
||
22 | "BD" => "Bangladesh", |
||
23 | "BB" => "Barbados", |
||
24 | "BY" => "Belarus", |
||
25 | "BE" => "Belgium", |
||
26 | "BZ" => "Belize", |
||
27 | "BJ" => "Benin", |
||
28 | "BM" => "Bermuda", |
||
29 | "BT" => "Bhutan", |
||
30 | "BO" => "Bolivia, Plurinational State of", |
||
31 | "BQ" => "Bonaire, Sint Eustatius and Saba", |
||
32 | "BA" => "Bosnia and Herzegovina", |
||
33 | "BW" => "Botswana", |
||
34 | "BV" => "Bouvet Island", |
||
35 | "BR" => "Brazil", |
||
36 | "IO" => "British Indian Ocean Territory", |
||
37 | "BN" => "Brunei Darussalam", |
||
38 | "BG" => "Bulgaria", |
||
39 | "BF" => "Burkina Faso", |
||
40 | "BI" => "Burundi", |
||
41 | "KH" => "Cambodia", |
||
42 | "CM" => "Cameroon", |
||
43 | "CA" => "Canada", |
||
44 | "CV" => "Cape Verde", |
||
45 | "KY" => "Cayman Islands", |
||
46 | "CF" => "Central African Republic", |
||
47 | "TD" => "Chad", |
||
48 | "CL" => "Chile", |
||
49 | "CN" => "China", |
||
50 | "CX" => "Christmas Island", |
||
51 | "CC" => "Cocos (Keeling) Islands", |
||
52 | "CO" => "Colombia", |
||
53 | "KM" => "Comoros", |
||
54 | "CG" => "Congo", |
||
55 | "CD" => "Congo, the Democratic Republic of the", |
||
56 | "CK" => "Cook Islands", |
||
57 | "CR" => "Costa Rica", |
||
58 | "CI" => "Côte d'Ivoire", |
||
59 | "HR" => "Croatia", |
||
60 | "CU" => "Cuba", |
||
61 | "CW" => "Curaçao", |
||
62 | "CY" => "Cyprus", |
||
63 | "CZ" => "Czech Republic", |
||
64 | "DK" => "Denmark", |
||
65 | "DJ" => "Djibouti", |
||
66 | "DM" => "Dominica", |
||
67 | "DO" => "Dominican Republic", |
||
68 | "EC" => "Ecuador", |
||
69 | "EG" => "Egypt", |
||
70 | "SV" => "El Salvador", |
||
71 | "GQ" => "Equatorial Guinea", |
||
72 | "ER" => "Eritrea", |
||
73 | "EE" => "Estonia", |
||
74 | "ET" => "Ethiopia", |
||
75 | "FK" => "Falkland Islands (Malvinas)", |
||
76 | "FO" => "Faroe Islands", |
||
77 | "FJ" => "Fiji", |
||
78 | "FI" => "Finland", |
||
79 | "FR" => "France", |
||
80 | "GF" => "French Guiana", |
||
81 | "PF" => "French Polynesia", |
||
82 | "TF" => "French Southern Territories", |
||
83 | "GA" => "Gabon", |
||
84 | "GM" => "Gambia", |
||
85 | "GE" => "Georgia", |
||
86 | "DE" => "Germany", |
||
87 | "GH" => "Ghana", |
||
88 | "GI" => "Gibraltar", |
||
89 | "GR" => "Greece", |
||
90 | "GL" => "Greenland", |
||
91 | "GD" => "Grenada", |
||
92 | "GP" => "Guadeloupe", |
||
93 | "GU" => "Guam", |
||
94 | "GT" => "Guatemala", |
||
95 | "GG" => "Guernsey", |
||
96 | "GN" => "Guinea", |
||
97 | "GW" => "Guinea-Bissau", |
||
98 | "GY" => "Guyana", |
||
99 | "HT" => "Haiti", |
||
100 | "HM" => "Heard Island and McDonald Islands", |
||
101 | "VA" => "Holy See (Vatican City State)", |
||
102 | "HN" => "Honduras", |
||
103 | "HK" => "Hong Kong", |
||
104 | "HU" => "Hungary", |
||
105 | "IS" => "Iceland", |
||
106 | "IN" => "India", |
||
107 | "ID" => "Indonesia", |
||
108 | "IR" => "Iran, Islamic Republic of", |
||
109 | "IQ" => "Iraq", |
||
110 | "IE" => "Ireland", |
||
111 | "IM" => "Isle of Man", |
||
112 | "IL" => "Israel", |
||
113 | "IT" => "Italy", |
||
114 | "JM" => "Jamaica", |
||
115 | "JP" => "Japan", |
||
116 | "JE" => "Jersey", |
||
117 | "JO" => "Jordan", |
||
118 | "KZ" => "Kazakhstan", |
||
119 | "KE" => "Kenya", |
||
120 | "KI" => "Kiribati", |
||
121 | "KP" => "Korea, Democratic People's Republic of", |
||
122 | "KR" => "Korea, Republic of", |
||
123 | "KW" => "Kuwait", |
||
124 | "KG" => "Kyrgyzstan", |
||
125 | "LA" => "Lao People's Democratic Republic", |
||
126 | "LV" => "Latvia", |
||
127 | "LB" => "Lebanon", |
||
128 | "LS" => "Lesotho", |
||
129 | "LR" => "Liberia", |
||
130 | "LY" => "Libya", |
||
131 | "LI" => "Liechtenstein", |
||
132 | "LT" => "Lithuania", |
||
133 | "LU" => "Luxembourg", |
||
134 | "MO" => "Macao", |
||
135 | "MK" => "Macedonia, the Former Yugoslav Republic of", |
||
136 | "MG" => "Madagascar", |
||
137 | "MW" => "Malawi", |
||
138 | "MY" => "Malaysia", |
||
139 | "MV" => "Maldives", |
||
140 | "ML" => "Mali", |
||
141 | "MT" => "Malta", |
||
142 | "MH" => "Marshall Islands", |
||
143 | "MQ" => "Martinique", |
||
144 | "MR" => "Mauritania", |
||
145 | "MU" => "Mauritius", |
||
146 | "YT" => "Mayotte", |
||
147 | "MX" => "Mexico", |
||
148 | "FM" => "Micronesia, Federated States of", |
||
149 | "MD" => "Moldova, Republic of", |
||
150 | "MC" => "Monaco", |
||
151 | "MN" => "Mongolia", |
||
152 | "ME" => "Montenegro", |
||
153 | "MS" => "Montserrat", |
||
154 | "MA" => "Morocco", |
||
155 | "MZ" => "Mozambique", |
||
156 | "MM" => "Myanmar", |
||
157 | "NA" => "Namibia", |
||
158 | "NR" => "Nauru", |
||
159 | "NP" => "Nepal", |
||
160 | "NL" => "Netherlands", |
||
161 | "NC" => "New Caledonia", |
||
162 | "NZ" => "New Zealand", |
||
163 | "NI" => "Nicaragua", |
||
164 | "NE" => "Niger", |
||
165 | "NG" => "Nigeria", |
||
166 | "NU" => "Niue", |
||
167 | "NF" => "Norfolk Island", |
||
168 | "MP" => "Northern Mariana Islands", |
||
169 | "NO" => "Norway", |
||
170 | "OM" => "Oman", |
||
171 | "PK" => "Pakistan", |
||
172 | "PW" => "Palau", |
||
173 | "PS" => "Palestine, State of", |
||
174 | "PA" => "Panama", |
||
175 | "PG" => "Papua New Guinea", |
||
176 | "PY" => "Paraguay", |
||
177 | "PE" => "Peru", |
||
178 | "PH" => "Philippines", |
||
179 | "PN" => "Pitcairn", |
||
180 | "PL" => "Poland", |
||
181 | "PT" => "Portugal", |
||
182 | "PR" => "Puerto Rico", |
||
183 | "QA" => "Qatar", |
||
184 | "RE" => "Réunion", |
||
185 | "RO" => "Romania", |
||
186 | "RU" => "Russian Federation", |
||
187 | "RW" => "Rwanda", |
||
188 | "BL" => "Saint Barthélemy", |
||
189 | "SH" => "Saint Helena, Ascension and Tristan da Cunha", |
||
190 | "KN" => "Saint Kitts and Nevis", |
||
191 | "LC" => "Saint Lucia", |
||
192 | "MF" => "Saint Martin (French part)", |
||
193 | "PM" => "Saint Pierre and Miquelon", |
||
194 | "VC" => "Saint Vincent and the Grenadines", |
||
195 | "WS" => "Samoa", |
||
196 | "SM" => "San Marino", |
||
197 | "ST" => "Sao Tome and Principe", |
||
198 | "SA" => "Saudi Arabia", |
||
199 | "SN" => "Senegal", |
||
200 | "RS" => "Serbia", |
||
201 | "SC" => "Seychelles", |
||
202 | "SL" => "Sierra Leone", |
||
203 | "SG" => "Singapore", |
||
204 | "SX" => "Sint Maarten (Dutch part)", |
||
205 | "SK" => "Slovakia", |
||
206 | "SI" => "Slovenia", |
||
207 | "SB" => "Solomon Islands", |
||
208 | "SO" => "Somalia", |
||
209 | "ZA" => "South Africa", |
||
210 | "GS" => "South Georgia and the South Sandwich Islands", |
||
211 | "SS" => "South Sudan", |
||
212 | "ES" => "Spain", |
||
213 | "LK" => "Sri Lanka", |
||
214 | "SD" => "Sudan", |
||
215 | "SR" => "Suriname", |
||
216 | "SJ" => "Svalbard and Jan Mayen", |
||
217 | "SZ" => "Swaziland", |
||
218 | "SE" => "Sweden", |
||
219 | "CH" => "Switzerland", |
||
220 | "SY" => "Syrian Arab Republic", |
||
221 | "TW" => "Taiwan, Province of China", |
||
222 | "TJ" => "Tajikistan", |
||
223 | "TZ" => "Tanzania, United Republic of", |
||
224 | "TH" => "Thailand", |
||
225 | "TL" => "Timor-Leste", |
||
226 | "TG" => "Togo", |
||
227 | "TK" => "Tokelau", |
||
228 | "TO" => "Tonga", |
||
229 | "TT" => "Trinidad and Tobago", |
||
230 | "TN" => "Tunisia", |
||
231 | "TR" => "Turkey", |
||
232 | "TM" => "Turkmenistan", |
||
233 | "TC" => "Turks and Caicos Islands", |
||
234 | "TV" => "Tuvalu", |
||
235 | "UG" => "Uganda", |
||
236 | "UA" => "Ukraine", |
||
237 | "AE" => "United Arab Emirates", |
||
238 | "GB" => "United Kingdom", |
||
239 | "US" => "United States", |
||
240 | "UM" => "United States Minor Outlying Islands", |
||
241 | "UY" => "Uruguay", |
||
242 | "UZ" => "Uzbekistan", |
||
243 | "VU" => "Vanuatu", |
||
244 | "VE" => "Venezuela, Bolivarian Republic of", |
||
245 | "VN" => "Viet Nam", |
||
246 | "VG" => "Virgin Islands, British", |
||
247 | "VI" => "Virgin Islands, U.S.", |
||
248 | "WF" => "Wallis and Futuna", |
||
249 | "EH" => "Western Sahara", |
||
250 | "YE" => "Yemen", |
||
251 | "ZM" => "Zambia", |
||
252 | "ZW" => "Zimbabwe" |
||
253 | ]; |
||
254 | |||
255 | return $country_list; |
||
256 | } |
||
257 |