versao compilada
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-15 17:37:00 +02:00
parent 9a96ee8dfe
commit c13f250b87
935 changed files with 210656 additions and 272 deletions
+25
View File
@@ -46,6 +46,31 @@ final class CountryCatalogue
};
}
/**
* Exact catalogue labels for reading legacy free-text country values.
* Does not infer request origin, alter stored values or classify unmatched text.
* Only labels belonging to one ISO country are included.
*
* @return list<string> Case-folded country code and catalogue labels.
*/
public function filterValues(string $code): array
{
$countries = $this->all();
$owners = [];
$selected = [];
foreach ($countries as $country) {
foreach (array_unique([$country['code'], $country['name'], $country['name_en']]) as $label) {
$key = mb_strtolower(trim($label), 'UTF-8');
$owners[$key][$country['code']] = true;
if ($country['code'] === $code) {
$selected[$key] = true;
}
}
}
return array_values(array_filter(array_keys($selected), fn ($key) => count($owners[$key]) === 1));
}
/** @return array{code:string|null,name:string} */
public function describe(?string $code): array
{