Import initial de Vivier depuis l'hebergement OVH
This commit is contained in:
commit
839e5e57c5
126 files changed
+22447
No files matched your search
+320
@@ -0,0 +1,320 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Pays et nationalités : codes ISO 3166-1 alpha-2, avec leur nom en français et en anglais.
|
||||
* Liste tirée des données Unicode CLDR. Le Kosovo (XK) y figure, avec son code d'usage.
|
||||
*/
|
||||
|
||||
/** Pays dont les ressortissants travaillent au Luxembourg sans permis : Union européenne, Espace économique européen, Suisse. */
|
||||
const PAYS_LIBRE_CIRCULATION = [
|
||||
// Union européenne
|
||||
'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HR', 'HU',
|
||||
'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK',
|
||||
// Espace économique européen
|
||||
'IS', 'LI', 'NO',
|
||||
// Suisse
|
||||
'CH',
|
||||
];
|
||||
|
||||
const PAYS = [
|
||||
'AD' => ['Andorre', 'Andorra'],
|
||||
'AE' => ['Émirats arabes unis', 'United Arab Emirates'],
|
||||
'AF' => ['Afghanistan', 'Afghanistan'],
|
||||
'AG' => ['Antigua-et-Barbuda', 'Antigua & Barbuda'],
|
||||
'AI' => ['Anguilla', 'Anguilla'],
|
||||
'AL' => ['Albanie', 'Albania'],
|
||||
'AM' => ['Arménie', 'Armenia'],
|
||||
'AO' => ['Angola', 'Angola'],
|
||||
'AQ' => ['Antarctique', 'Antarctica'],
|
||||
'AR' => ['Argentine', 'Argentina'],
|
||||
'AS' => ['Samoa américaines', 'American Samoa'],
|
||||
'AT' => ['Autriche', 'Austria'],
|
||||
'AU' => ['Australie', 'Australia'],
|
||||
'AW' => ['Aruba', 'Aruba'],
|
||||
'AX' => ['Îles Åland', 'Åland Islands'],
|
||||
'AZ' => ['Azerbaïdjan', 'Azerbaijan'],
|
||||
'BA' => ['Bosnie-Herzégovine', 'Bosnia & Herzegovina'],
|
||||
'BB' => ['Barbade', 'Barbados'],
|
||||
'BD' => ['Bangladesh', 'Bangladesh'],
|
||||
'BE' => ['Belgique', 'Belgium'],
|
||||
'BF' => ['Burkina Faso', 'Burkina Faso'],
|
||||
'BG' => ['Bulgarie', 'Bulgaria'],
|
||||
'BH' => ['Bahreïn', 'Bahrain'],
|
||||
'BI' => ['Burundi', 'Burundi'],
|
||||
'BJ' => ['Bénin', 'Benin'],
|
||||
'BL' => ['Saint-Barthélemy', 'St. Barthélemy'],
|
||||
'BM' => ['Bermudes', 'Bermuda'],
|
||||
'BN' => ['Brunei', 'Brunei'],
|
||||
'BO' => ['Bolivie', 'Bolivia'],
|
||||
'BQ' => ['Pays-Bas caribéens', 'Caribbean Netherlands'],
|
||||
'BR' => ['Brésil', 'Brazil'],
|
||||
'BS' => ['Bahamas', 'Bahamas'],
|
||||
'BT' => ['Bhoutan', 'Bhutan'],
|
||||
'BV' => ['Île Bouvet', 'Bouvet Island'],
|
||||
'BW' => ['Botswana', 'Botswana'],
|
||||
'BY' => ['Biélorussie', 'Belarus'],
|
||||
'BZ' => ['Belize', 'Belize'],
|
||||
'CA' => ['Canada', 'Canada'],
|
||||
'CC' => ['Îles Cocos', 'Cocos (Keeling) Islands'],
|
||||
'CD' => ['Congo-Kinshasa', 'Congo - Kinshasa'],
|
||||
'CF' => ['République centrafricaine', 'Central African Republic'],
|
||||
'CG' => ['Congo-Brazzaville', 'Congo - Brazzaville'],
|
||||
'CH' => ['Suisse', 'Switzerland'],
|
||||
'CI' => ['Côte d’Ivoire', 'Côte d’Ivoire'],
|
||||
'CK' => ['Îles Cook', 'Cook Islands'],
|
||||
'CL' => ['Chili', 'Chile'],
|
||||
'CM' => ['Cameroun', 'Cameroon'],
|
||||
'CN' => ['Chine', 'China'],
|
||||
'CO' => ['Colombie', 'Colombia'],
|
||||
'CR' => ['Costa Rica', 'Costa Rica'],
|
||||
'CU' => ['Cuba', 'Cuba'],
|
||||
'CV' => ['Cap-Vert', 'Cape Verde'],
|
||||
'CW' => ['Curaçao', 'Curaçao'],
|
||||
'CX' => ['Île Christmas', 'Christmas Island'],
|
||||
'CY' => ['Chypre', 'Cyprus'],
|
||||
'CZ' => ['Tchéquie', 'Czechia'],
|
||||
'DE' => ['Allemagne', 'Germany'],
|
||||
'DJ' => ['Djibouti', 'Djibouti'],
|
||||
'DK' => ['Danemark', 'Denmark'],
|
||||
'DM' => ['Dominique', 'Dominica'],
|
||||
'DO' => ['République dominicaine', 'Dominican Republic'],
|
||||
'DZ' => ['Algérie', 'Algeria'],
|
||||
'EC' => ['Équateur', 'Ecuador'],
|
||||
'EE' => ['Estonie', 'Estonia'],
|
||||
'EG' => ['Égypte', 'Egypt'],
|
||||
'EH' => ['Sahara occidental', 'Western Sahara'],
|
||||
'ER' => ['Érythrée', 'Eritrea'],
|
||||
'ES' => ['Espagne', 'Spain'],
|
||||
'ET' => ['Éthiopie', 'Ethiopia'],
|
||||
'FI' => ['Finlande', 'Finland'],
|
||||
'FJ' => ['Fidji', 'Fiji'],
|
||||
'FK' => ['Îles Malouines', 'Falkland Islands'],
|
||||
'FM' => ['Micronésie', 'Micronesia'],
|
||||
'FO' => ['Îles Féroé', 'Faroe Islands'],
|
||||
'FR' => ['France', 'France'],
|
||||
'GA' => ['Gabon', 'Gabon'],
|
||||
'GB' => ['Royaume-Uni', 'United Kingdom'],
|
||||
'GD' => ['Grenade', 'Grenada'],
|
||||
'GE' => ['Géorgie', 'Georgia'],
|
||||
'GF' => ['Guyane française', 'French Guiana'],
|
||||
'GG' => ['Guernesey', 'Guernsey'],
|
||||
'GH' => ['Ghana', 'Ghana'],
|
||||
'GI' => ['Gibraltar', 'Gibraltar'],
|
||||
'GL' => ['Groenland', 'Greenland'],
|
||||
'GM' => ['Gambie', 'Gambia'],
|
||||
'GN' => ['Guinée', 'Guinea'],
|
||||
'GP' => ['Guadeloupe', 'Guadeloupe'],
|
||||
'GQ' => ['Guinée équatoriale', 'Equatorial Guinea'],
|
||||
'GR' => ['Grèce', 'Greece'],
|
||||
'GS' => ['Géorgie du Sud-et-les Îles Sandwich du Sud', 'South Georgia & South Sandwich Islands'],
|
||||
'GT' => ['Guatemala', 'Guatemala'],
|
||||
'GU' => ['Guam', 'Guam'],
|
||||
'GW' => ['Guinée-Bissau', 'Guinea-Bissau'],
|
||||
'GY' => ['Guyana', 'Guyana'],
|
||||
'HK' => ['R.A.S. chinoise de Hong Kong', 'Hong Kong SAR China'],
|
||||
'HM' => ['Îles Heard-et-MacDonald', 'Heard & McDonald Islands'],
|
||||
'HN' => ['Honduras', 'Honduras'],
|
||||
'HR' => ['Croatie', 'Croatia'],
|
||||
'HT' => ['Haïti', 'Haiti'],
|
||||
'HU' => ['Hongrie', 'Hungary'],
|
||||
'ID' => ['Indonésie', 'Indonesia'],
|
||||
'IE' => ['Irlande', 'Ireland'],
|
||||
'IL' => ['Israël', 'Israel'],
|
||||
'IM' => ['Île de Man', 'Isle of Man'],
|
||||
'IN' => ['Inde', 'India'],
|
||||
'IO' => ['Territoire britannique de l’océan Indien', 'British Indian Ocean Territory'],
|
||||
'IQ' => ['Irak', 'Iraq'],
|
||||
'IR' => ['Iran', 'Iran'],
|
||||
'IS' => ['Islande', 'Iceland'],
|
||||
'IT' => ['Italie', 'Italy'],
|
||||
'JE' => ['Jersey', 'Jersey'],
|
||||
'JM' => ['Jamaïque', 'Jamaica'],
|
||||
'JO' => ['Jordanie', 'Jordan'],
|
||||
'JP' => ['Japon', 'Japan'],
|
||||
'KE' => ['Kenya', 'Kenya'],
|
||||
'KG' => ['Kirghizstan', 'Kyrgyzstan'],
|
||||
'KH' => ['Cambodge', 'Cambodia'],
|
||||
'KI' => ['Kiribati', 'Kiribati'],
|
||||
'KM' => ['Comores', 'Comoros'],
|
||||
'KN' => ['Saint-Christophe-et-Niévès', 'St. Kitts & Nevis'],
|
||||
'KP' => ['Corée du Nord', 'North Korea'],
|
||||
'KR' => ['Corée du Sud', 'South Korea'],
|
||||
'KW' => ['Koweït', 'Kuwait'],
|
||||
'KY' => ['Îles Caïmans', 'Cayman Islands'],
|
||||
'KZ' => ['Kazakhstan', 'Kazakhstan'],
|
||||
'LA' => ['Laos', 'Laos'],
|
||||
'LB' => ['Liban', 'Lebanon'],
|
||||
'LC' => ['Sainte-Lucie', 'St. Lucia'],
|
||||
'LI' => ['Liechtenstein', 'Liechtenstein'],
|
||||
'LK' => ['Sri Lanka', 'Sri Lanka'],
|
||||
'LR' => ['Liberia', 'Liberia'],
|
||||
'LS' => ['Lesotho', 'Lesotho'],
|
||||
'LT' => ['Lituanie', 'Lithuania'],
|
||||
'LU' => ['Luxembourg', 'Luxembourg'],
|
||||
'LV' => ['Lettonie', 'Latvia'],
|
||||
'LY' => ['Libye', 'Libya'],
|
||||
'MA' => ['Maroc', 'Morocco'],
|
||||
'MC' => ['Monaco', 'Monaco'],
|
||||
'MD' => ['Moldavie', 'Moldova'],
|
||||
'ME' => ['Monténégro', 'Montenegro'],
|
||||
'MF' => ['Saint-Martin', 'St. Martin'],
|
||||
'MG' => ['Madagascar', 'Madagascar'],
|
||||
'MH' => ['Îles Marshall', 'Marshall Islands'],
|
||||
'MK' => ['Macédoine du Nord', 'North Macedonia'],
|
||||
'ML' => ['Mali', 'Mali'],
|
||||
'MM' => ['Myanmar (Birmanie)', 'Myanmar (Burma)'],
|
||||
'MN' => ['Mongolie', 'Mongolia'],
|
||||
'MO' => ['R.A.S. chinoise de Macao', 'Macao SAR China'],
|
||||
'MP' => ['Îles Mariannes du Nord', 'Northern Mariana Islands'],
|
||||
'MQ' => ['Martinique', 'Martinique'],
|
||||
'MR' => ['Mauritanie', 'Mauritania'],
|
||||
'MS' => ['Montserrat', 'Montserrat'],
|
||||
'MT' => ['Malte', 'Malta'],
|
||||
'MU' => ['Maurice', 'Mauritius'],
|
||||
'MV' => ['Maldives', 'Maldives'],
|
||||
'MW' => ['Malawi', 'Malawi'],
|
||||
'MX' => ['Mexique', 'Mexico'],
|
||||
'MY' => ['Malaisie', 'Malaysia'],
|
||||
'MZ' => ['Mozambique', 'Mozambique'],
|
||||
'NA' => ['Namibie', 'Namibia'],
|
||||
'NC' => ['Nouvelle-Calédonie', 'New Caledonia'],
|
||||
'NE' => ['Niger', 'Niger'],
|
||||
'NF' => ['Île Norfolk', 'Norfolk Island'],
|
||||
'NG' => ['Nigeria', 'Nigeria'],
|
||||
'NI' => ['Nicaragua', 'Nicaragua'],
|
||||
'NL' => ['Pays-Bas', 'Netherlands'],
|
||||
'NO' => ['Norvège', 'Norway'],
|
||||
'NP' => ['Népal', 'Nepal'],
|
||||
'NR' => ['Nauru', 'Nauru'],
|
||||
'NU' => ['Niue', 'Niue'],
|
||||
'NZ' => ['Nouvelle-Zélande', 'New Zealand'],
|
||||
'OM' => ['Oman', 'Oman'],
|
||||
'PA' => ['Panama', 'Panama'],
|
||||
'PE' => ['Pérou', 'Peru'],
|
||||
'PF' => ['Polynésie française', 'French Polynesia'],
|
||||
'PG' => ['Papouasie-Nouvelle-Guinée', 'Papua New Guinea'],
|
||||
'PH' => ['Philippines', 'Philippines'],
|
||||
'PK' => ['Pakistan', 'Pakistan'],
|
||||
'PL' => ['Pologne', 'Poland'],
|
||||
'PM' => ['Saint-Pierre-et-Miquelon', 'St. Pierre & Miquelon'],
|
||||
'PN' => ['Îles Pitcairn', 'Pitcairn Islands'],
|
||||
'PR' => ['Porto Rico', 'Puerto Rico'],
|
||||
'PS' => ['Territoires palestiniens', 'Palestinian Territories'],
|
||||
'PT' => ['Portugal', 'Portugal'],
|
||||
'PW' => ['Palaos', 'Palau'],
|
||||
'PY' => ['Paraguay', 'Paraguay'],
|
||||
'QA' => ['Qatar', 'Qatar'],
|
||||
'RE' => ['La Réunion', 'Réunion'],
|
||||
'RO' => ['Roumanie', 'Romania'],
|
||||
'RS' => ['Serbie', 'Serbia'],
|
||||
'RU' => ['Russie', 'Russia'],
|
||||
'RW' => ['Rwanda', 'Rwanda'],
|
||||
'SA' => ['Arabie saoudite', 'Saudi Arabia'],
|
||||
'SB' => ['Îles Salomon', 'Solomon Islands'],
|
||||
'SC' => ['Seychelles', 'Seychelles'],
|
||||
'SD' => ['Soudan', 'Sudan'],
|
||||
'SE' => ['Suède', 'Sweden'],
|
||||
'SG' => ['Singapour', 'Singapore'],
|
||||
'SH' => ['Sainte-Hélène', 'St. Helena'],
|
||||
'SI' => ['Slovénie', 'Slovenia'],
|
||||
'SJ' => ['Svalbard et Jan Mayen', 'Svalbard & Jan Mayen'],
|
||||
'SK' => ['Slovaquie', 'Slovakia'],
|
||||
'SL' => ['Sierra Leone', 'Sierra Leone'],
|
||||
'SM' => ['Saint-Marin', 'San Marino'],
|
||||
'SN' => ['Sénégal', 'Senegal'],
|
||||
'SO' => ['Somalie', 'Somalia'],
|
||||
'SR' => ['Suriname', 'Suriname'],
|
||||
'SS' => ['Soudan du Sud', 'South Sudan'],
|
||||
'ST' => ['Sao Tomé-et-Principe', 'São Tomé & Príncipe'],
|
||||
'SV' => ['Salvador', 'El Salvador'],
|
||||
'SX' => ['Saint-Martin (partie néerlandaise)', 'Sint Maarten'],
|
||||
'SY' => ['Syrie', 'Syria'],
|
||||
'SZ' => ['Eswatini', 'Eswatini'],
|
||||
'TC' => ['Îles Turques-et-Caïques', 'Turks & Caicos Islands'],
|
||||
'TD' => ['Tchad', 'Chad'],
|
||||
'TF' => ['Terres australes françaises', 'French Southern Territories'],
|
||||
'TG' => ['Togo', 'Togo'],
|
||||
'TH' => ['Thaïlande', 'Thailand'],
|
||||
'TJ' => ['Tadjikistan', 'Tajikistan'],
|
||||
'TK' => ['Tokelau', 'Tokelau'],
|
||||
'TL' => ['Timor oriental', 'Timor-Leste'],
|
||||
'TM' => ['Turkménistan', 'Turkmenistan'],
|
||||
'TN' => ['Tunisie', 'Tunisia'],
|
||||
'TO' => ['Tonga', 'Tonga'],
|
||||
'TR' => ['Turquie', 'Türkiye'],
|
||||
'TT' => ['Trinité-et-Tobago', 'Trinidad & Tobago'],
|
||||
'TV' => ['Tuvalu', 'Tuvalu'],
|
||||
'TW' => ['Taïwan', 'Taiwan'],
|
||||
'TZ' => ['Tanzanie', 'Tanzania'],
|
||||
'UA' => ['Ukraine', 'Ukraine'],
|
||||
'UG' => ['Ouganda', 'Uganda'],
|
||||
'UM' => ['Îles mineures éloignées des États-Unis', 'U.S. Outlying Islands'],
|
||||
'US' => ['États-Unis', 'United States'],
|
||||
'UY' => ['Uruguay', 'Uruguay'],
|
||||
'UZ' => ['Ouzbékistan', 'Uzbekistan'],
|
||||
'VA' => ['État de la Cité du Vatican', 'Vatican City'],
|
||||
'VC' => ['Saint-Vincent-et-les Grenadines', 'St. Vincent & Grenadines'],
|
||||
'VE' => ['Venezuela', 'Venezuela'],
|
||||
'VG' => ['Îles Vierges britanniques', 'British Virgin Islands'],
|
||||
'VI' => ['Îles Vierges des États-Unis', 'U.S. Virgin Islands'],
|
||||
'VN' => ['Viêt Nam', 'Vietnam'],
|
||||
'VU' => ['Vanuatu', 'Vanuatu'],
|
||||
'WF' => ['Wallis-et-Futuna', 'Wallis & Futuna'],
|
||||
'WS' => ['Samoa', 'Samoa'],
|
||||
'XK' => ['Kosovo', 'Kosovo'],
|
||||
'YE' => ['Yémen', 'Yemen'],
|
||||
'YT' => ['Mayotte', 'Mayotte'],
|
||||
'ZA' => ['Afrique du Sud', 'South Africa'],
|
||||
'ZM' => ['Zambie', 'Zambia'],
|
||||
'ZW' => ['Zimbabwe', 'Zimbabwe'],
|
||||
];
|
||||
|
||||
/** Nom d'un pays dans la langue demandée (français ou anglais ; les autres langues reçoivent l'anglais). */
|
||||
function nom_pays(string $code, ?string $langue = null): string
|
||||
{
|
||||
$langue ??= langue_courante();
|
||||
$p = PAYS[strtoupper($code)] ?? null;
|
||||
return $p === null ? $code : ($langue === 'fr' ? $p[0] : $p[1]);
|
||||
}
|
||||
|
||||
/** Pays triés par nom dans la langue demandée : [code => nom]. */
|
||||
function liste_pays(?string $langue = null): array
|
||||
{
|
||||
$liste = [];
|
||||
foreach (array_keys(PAYS) as $code) {
|
||||
$liste[$code] = nom_pays($code, $langue);
|
||||
}
|
||||
$cle = static fn (string $n): string => Recherche::normaliser($n);
|
||||
uasort($liste, static fn ($a, $b) => strcmp($cle($a), $cle($b)));
|
||||
return $liste;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lit une liste de nationalités saisie ou importée : codes ISO séparés par des virgules, sans doublon.
|
||||
* @return string[] codes reconnus, dans l'ordre donné
|
||||
*/
|
||||
function codes_nationalites(mixed $valeur): array
|
||||
{
|
||||
$brut = is_array($valeur) ? $valeur : preg_split('/[\s,;]+/', (string) $valeur);
|
||||
$codes = [];
|
||||
foreach ($brut ?: [] as $c) {
|
||||
$c = strtoupper(trim((string) $c));
|
||||
if (isset(PAYS[$c]) && !in_array($c, $codes, true)) {
|
||||
$codes[] = $c;
|
||||
}
|
||||
}
|
||||
return array_slice($codes, 0, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Situation d'un profil vis-à-vis du permis de travail au Luxembourg, d'après ses nationalités.
|
||||
* @return ?int 0 : au moins une nationalité UE, EEE ou suisse (pas de permis) ; 1 : aucune ; null : nationalité inconnue
|
||||
*/
|
||||
function hors_ue(array $codes): ?int
|
||||
{
|
||||
if (!$codes) {
|
||||
return null;
|
||||
}
|
||||
return array_intersect($codes, PAYS_LIBRE_CIRCULATION) ? 0 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user