Automattic\WooCommerce\Vendor\League\ISO3166

ISO3166::iteratorpublicWC 1.0

Method of the class: ISO3166{}

No Hooks.

Returns

\Generator. array{name: string, alpha2: string, alpha3: string, numeric: numeric-string, currency: string[]}>

Usage

$ISO3166 = new ISO3166();
$ISO3166->iterator( $key ): \Generator;
$key('name'|'alpha2'|'alpha3'|'numeric')
.
Default: self::KEY_ALPHA2

ISO3166::iterator() code WC 10.3.6

public function iterator(string $key = self::KEY_ALPHA2): \Generator
{
    if (!in_array($key, $this->keys, true)) {
        throw new DomainException(sprintf('Invalid value for $key, got "%s", expected one of: %s', $key, implode(', ', $this->keys)));
    }

    foreach ($this->countries as $country) {
        yield $country[$key] => $country;
    }
}