Automattic\WooCommerce\Vendor\League\ISO3166
ISO3166::lookup
Lookup ISO3166-1 data by given identifier.
Looks for a match against the given key for each entry in the dataset.
Метод класса: ISO3166{}
Хуков нет.
Возвращает
Массив{name:. string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}
Использование
// private - только в коде основоного (родительского) класса $result = $this->lookup( $key, $value ): array;
- $key('name'|'alpha2'|'alpha3'|'numeric') (обязательный)
- .
- $value(строка) (обязательный)
- .
Код ISO3166::lookup() ISO3166::lookup WC 10.3.6
private function lookup(string $key, string $value): array
{
$value = mb_strtolower($value);
foreach ($this->countries as $country) {
$comparison = mb_strtolower($country[$key]);
if ($value === $comparison || $value === mb_substr($comparison, 0, mb_strlen($value))) {
return $country;
}
}
throw new OutOfBoundsException(sprintf('No "%s" key found matching: %s', $key, $value));
}