Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| ArticleCountryFeature | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace CirrusSearch\Query; |
| 4 | |
| 5 | class ArticleCountryFeature { |
| 6 | |
| 7 | /** |
| 8 | * Maps ISO 3166 country codes to their full country names. |
| 9 | * |
| 10 | * This constant provides a mapping between three-letter country codes and their |
| 11 | * corresponding full country names in English. Used for display and normalization |
| 12 | * purposes throughout the application. |
| 13 | * |
| 14 | * @var array<string, string> Keys are ISO 3166 codes, values are country names |
| 15 | * |
| 16 | * @example |
| 17 | * 'AFG' => 'Afghanistan' |
| 18 | * 'ALA' => 'Åland' |
| 19 | */ |
| 20 | public const COUNTRY_CODES_TO_LABELS = [ |
| 21 | 'afg' => 'Afghanistan', |
| 22 | 'ala' => 'Åland', |
| 23 | 'alb' => 'Albania', |
| 24 | 'dza' => 'Algeria', |
| 25 | 'asm' => 'American Samoa', |
| 26 | 'and' => 'Andorra', |
| 27 | 'ago' => 'Angola', |
| 28 | 'aia' => 'Anguilla', |
| 29 | 'ata' => 'Antarctica', |
| 30 | 'atg' => 'Antigua and Barbuda', |
| 31 | 'arg' => 'Argentina', |
| 32 | 'arm' => 'Armenia', |
| 33 | 'abw' => 'Aruba', |
| 34 | 'aus' => 'Australia', |
| 35 | 'aut' => 'Austria', |
| 36 | 'aze' => 'Azerbaijan', |
| 37 | 'bhs' => 'Bahamas', |
| 38 | 'bhr' => 'Bahrain', |
| 39 | 'bgd' => 'Bangladesh', |
| 40 | 'brb' => 'Barbados', |
| 41 | 'blr' => 'Belarus', |
| 42 | 'bel' => 'Belgium', |
| 43 | 'blz' => 'Belize', |
| 44 | 'ben' => 'Benin', |
| 45 | 'bmu' => 'Bermuda', |
| 46 | 'btn' => 'Bhutan', |
| 47 | 'bol' => 'Bolivia', |
| 48 | 'bes' => 'Bonaire, Sint Eustatius, and Saba', |
| 49 | 'bih' => 'Bosnia and Herzegovina', |
| 50 | 'bwa' => 'Botswana', |
| 51 | 'bvt' => 'Bouvet Island', |
| 52 | 'bra' => 'Brazil', |
| 53 | 'iot' => 'British Indian Ocean Territory', |
| 54 | 'vgb' => 'British Virgin Islands', |
| 55 | 'brn' => 'Brunei', |
| 56 | 'bgr' => 'Bulgaria', |
| 57 | 'bfa' => 'Burkina Faso', |
| 58 | 'bdi' => 'Burundi', |
| 59 | 'khm' => 'Cambodia', |
| 60 | 'cmr' => 'Cameroon', |
| 61 | 'can' => 'Canada', |
| 62 | 'cpv' => 'Cape Verde', |
| 63 | 'cym' => 'Cayman Islands', |
| 64 | 'caf' => 'Central African Republic', |
| 65 | 'tcd' => 'Chad', |
| 66 | 'chl' => 'Chile', |
| 67 | 'chn' => 'China', |
| 68 | 'cxr' => 'Christmas Island', |
| 69 | 'cck' => 'Cocos (Keeling) Islands', |
| 70 | 'col' => 'Colombia', |
| 71 | 'com' => 'Comoros', |
| 72 | 'cok' => 'Cook Islands', |
| 73 | 'cri' => 'Costa Rica', |
| 74 | 'hrv' => 'Croatia', |
| 75 | 'cub' => 'Cuba', |
| 76 | 'cuw' => 'Curaçao', |
| 77 | 'cyp' => 'Cyprus', |
| 78 | 'cze' => 'Czech Republic', |
| 79 | 'cod' => 'Democratic Republic of the Congo', |
| 80 | 'dnk' => 'Denmark', |
| 81 | 'dji' => 'Djibouti', |
| 82 | 'dma' => 'Dominica', |
| 83 | 'dom' => 'Dominican Republic', |
| 84 | 'tls' => 'East Timor', |
| 85 | 'ecu' => 'Ecuador', |
| 86 | 'egy' => 'Egypt', |
| 87 | 'slv' => 'El Salvador', |
| 88 | 'gnq' => 'Equatorial Guinea', |
| 89 | 'eri' => 'Eritrea', |
| 90 | 'est' => 'Estonia', |
| 91 | 'swz' => 'Eswatini', |
| 92 | 'eth' => 'Ethiopia', |
| 93 | 'flk' => 'Falkland Islands', |
| 94 | 'fro' => 'Faroe Islands', |
| 95 | 'fsm' => 'Federated States of Micronesia', |
| 96 | 'fji' => 'Fiji', |
| 97 | 'fin' => 'Finland', |
| 98 | 'fra' => 'France', |
| 99 | 'guf' => 'French Guiana', |
| 100 | 'pyf' => 'French Polynesia', |
| 101 | 'atf' => 'French Southern and Antarctic Lands', |
| 102 | 'gab' => 'Gabon', |
| 103 | 'gmb' => 'Gambia', |
| 104 | 'geo' => 'Georgia', |
| 105 | 'deu' => 'Germany', |
| 106 | 'gha' => 'Ghana', |
| 107 | 'gib' => 'Gibraltar', |
| 108 | 'grc' => 'Greece', |
| 109 | 'grl' => 'Greenland', |
| 110 | 'grd' => 'Grenada', |
| 111 | 'glp' => 'Guadeloupe', |
| 112 | 'gum' => 'Guam', |
| 113 | 'gtm' => 'Guatemala', |
| 114 | 'ggy' => 'Guernsey', |
| 115 | 'gin' => 'Guinea', |
| 116 | 'gnb' => 'Guinea-Bissau', |
| 117 | 'guy' => 'Guyana', |
| 118 | 'hti' => 'Haiti', |
| 119 | 'hmd' => 'Heard Island and McDonald Islands', |
| 120 | 'hnd' => 'Honduras', |
| 121 | 'hkg' => 'Hong Kong', |
| 122 | 'hun' => 'Hungary', |
| 123 | 'isl' => 'Iceland', |
| 124 | 'ind' => 'India', |
| 125 | 'idn' => 'Indonesia', |
| 126 | 'irn' => 'Iran', |
| 127 | 'irq' => 'Iraq', |
| 128 | 'irl' => 'Ireland', |
| 129 | 'imn' => 'Isle of Man', |
| 130 | 'isr' => 'Israel', |
| 131 | 'ita' => 'Italy', |
| 132 | 'civ' => 'Ivory Coast', |
| 133 | 'jam' => 'Jamaica', |
| 134 | 'jpn' => 'Japan', |
| 135 | 'jey' => 'Jersey', |
| 136 | 'jor' => 'Jordan', |
| 137 | 'kaz' => 'Kazakhstan', |
| 138 | 'ken' => 'Kenya', |
| 139 | 'kir' => 'Kiribati', |
| 140 | 'xkx' => 'Kosovo', |
| 141 | 'kwt' => 'Kuwait', |
| 142 | 'kgz' => 'Kyrgyzstan', |
| 143 | 'lao' => 'Laos', |
| 144 | 'lva' => 'Latvia', |
| 145 | 'lbn' => 'Lebanon', |
| 146 | 'lso' => 'Lesotho', |
| 147 | 'lbr' => 'Liberia', |
| 148 | 'lby' => 'Libya', |
| 149 | 'lie' => 'Liechtenstein', |
| 150 | 'ltu' => 'Lithuania', |
| 151 | 'lux' => 'Luxembourg', |
| 152 | 'mac' => 'Macao', |
| 153 | 'mdg' => 'Madagascar', |
| 154 | 'mwi' => 'Malawi', |
| 155 | 'mys' => 'Malaysia', |
| 156 | 'mdv' => 'Maldives', |
| 157 | 'mli' => 'Mali', |
| 158 | 'mlt' => 'Malta', |
| 159 | 'mhl' => 'Marshall Islands', |
| 160 | 'mtq' => 'Martinique', |
| 161 | 'mrt' => 'Mauritania', |
| 162 | 'mus' => 'Mauritius', |
| 163 | 'myt' => 'Mayotte', |
| 164 | 'mex' => 'Mexico', |
| 165 | 'mda' => 'Moldova', |
| 166 | 'mco' => 'Monaco', |
| 167 | 'mng' => 'Mongolia', |
| 168 | 'mne' => 'Montenegro', |
| 169 | 'msr' => 'Montserrat', |
| 170 | 'mar' => 'Morocco', |
| 171 | 'moz' => 'Mozambique', |
| 172 | 'mmr' => 'Myanmar', |
| 173 | 'nam' => 'Namibia', |
| 174 | 'nru' => 'Nauru', |
| 175 | 'npl' => 'Nepal', |
| 176 | 'nld' => 'Netherlands', |
| 177 | 'ncl' => 'New Caledonia', |
| 178 | 'nzl' => 'New Zealand', |
| 179 | 'nic' => 'Nicaragua', |
| 180 | 'ner' => 'Niger', |
| 181 | 'nga' => 'Nigeria', |
| 182 | 'niu' => 'Niue', |
| 183 | 'nfk' => 'Norfolk Island', |
| 184 | 'prk' => 'North Korea', |
| 185 | 'mkd' => 'North Macedonia', |
| 186 | 'mnp' => 'Northern Mariana Islands', |
| 187 | 'nor' => 'Norway', |
| 188 | 'omn' => 'Oman', |
| 189 | 'pak' => 'Pakistan', |
| 190 | 'plw' => 'Palau', |
| 191 | 'pse' => 'Palestine', |
| 192 | 'pan' => 'Panama', |
| 193 | 'png' => 'Papua New Guinea', |
| 194 | 'pry' => 'Paraguay', |
| 195 | 'per' => 'Peru', |
| 196 | 'phl' => 'Philippines', |
| 197 | 'pcn' => 'Pitcairn Islands', |
| 198 | 'pol' => 'Poland', |
| 199 | 'prt' => 'Portugal', |
| 200 | 'pri' => 'Puerto Rico', |
| 201 | 'qat' => 'Qatar', |
| 202 | 'cog' => 'Republic of the Congo', |
| 203 | 'reu' => 'Réunion', |
| 204 | 'rou' => 'Romania', |
| 205 | 'rus' => 'Russia', |
| 206 | 'rwa' => 'Rwanda', |
| 207 | 'blm' => 'Saint Barthélemy', |
| 208 | 'shn' => 'Saint Helena, Ascension, and Tristan da Cunha', |
| 209 | 'kna' => 'Saint Kitts and Nevis', |
| 210 | 'lca' => 'Saint Lucia', |
| 211 | 'maf' => 'Saint Martin', |
| 212 | 'spm' => 'Saint Pierre and Miquelon', |
| 213 | 'vct' => 'Saint Vincent and the Grenadines', |
| 214 | 'wsm' => 'Samoa', |
| 215 | 'smr' => 'San Marino', |
| 216 | 'stp' => 'São Tomé and Príncipe', |
| 217 | 'sau' => 'Saudi Arabia', |
| 218 | 'sen' => 'Senegal', |
| 219 | 'srb' => 'Serbia', |
| 220 | 'syc' => 'Seychelles', |
| 221 | 'sle' => 'Sierra Leone', |
| 222 | 'sgp' => 'Singapore', |
| 223 | 'sxm' => 'Sint Maarten', |
| 224 | 'svk' => 'Slovakia', |
| 225 | 'svn' => 'Slovenia', |
| 226 | 'slb' => 'Solomon Islands', |
| 227 | 'som' => 'Somalia', |
| 228 | 'zaf' => 'South Africa', |
| 229 | 'sgs' => 'South Georgia and the South Sandwich Islands', |
| 230 | 'kor' => 'South Korea', |
| 231 | 'ssd' => 'South Sudan', |
| 232 | 'esp' => 'Spain', |
| 233 | 'lka' => 'Sri Lanka', |
| 234 | 'sdn' => 'Sudan', |
| 235 | 'sur' => 'Suriname', |
| 236 | 'sjm' => 'Svalbard and Jan Mayen', |
| 237 | 'swe' => 'Sweden', |
| 238 | 'che' => 'Switzerland', |
| 239 | 'syr' => 'Syria', |
| 240 | 'twn' => 'Taiwan', |
| 241 | 'tjk' => 'Tajikistan', |
| 242 | 'tza' => 'Tanzania', |
| 243 | 'tha' => 'Thailand', |
| 244 | 'tgo' => 'Togo', |
| 245 | 'tkl' => 'Tokelau', |
| 246 | 'ton' => 'Tonga', |
| 247 | 'tto' => 'Trinidad and Tobago', |
| 248 | 'tun' => 'Tunisia', |
| 249 | 'tur' => 'Turkey', |
| 250 | 'tkm' => 'Turkmenistan', |
| 251 | 'tca' => 'Turks and Caicos Islands', |
| 252 | 'tuv' => 'Tuvalu', |
| 253 | 'uga' => 'Uganda', |
| 254 | 'ukr' => 'Ukraine', |
| 255 | 'are' => 'United Arab Emirates', |
| 256 | 'gbr' => 'United Kingdom', |
| 257 | 'usa' => 'United States', |
| 258 | 'umi' => 'United States Minor Outlying Islands', |
| 259 | 'vir' => 'United States Virgin Islands', |
| 260 | 'ury' => 'Uruguay', |
| 261 | 'uzb' => 'Uzbekistan', |
| 262 | 'vut' => 'Vanuatu', |
| 263 | 'vat' => 'Vatican City', |
| 264 | 'ven' => 'Venezuela', |
| 265 | 'vnm' => 'Vietnam', |
| 266 | 'wlf' => 'Wallis and Futuna', |
| 267 | 'esh' => 'Western Sahara', |
| 268 | 'yem' => 'Yemen', |
| 269 | 'zmb' => 'Zambia', |
| 270 | 'zwe' => 'Zimbabwe' |
| 271 | ]; |
| 272 | |
| 273 | /** |
| 274 | * Maps area codes to lists of country codes in ISO 3166 format. |
| 275 | * |
| 276 | * This constant defines geographic areas and their constituent countries using |
| 277 | * ISO country codes. It's used for area-based filtering and grouping operations. |
| 278 | * |
| 279 | * Structure: |
| 280 | * - Keys: Area identifiers (e.g. for a specific geographic region) |
| 281 | * - Values: Arrays of ISO country codes belonging to that area |
| 282 | * |
| 283 | * @var array<string, array<string>> |
| 284 | */ |
| 285 | public const AREA_CODES_TO_COUNTRY_CODES = []; |
| 286 | } |