Automattic\WooCommerce\Vendor\League\ISO3166

Guards::guardAgainstInvalidAlpha2public staticWC 1.0

Assert that input looks like an alpha2 key.

Method of the class: Guards{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = Guards::guardAgainstInvalidAlpha2( $alpha2 ): void;
$alpha2(string) (required)
.

Guards::guardAgainstInvalidAlpha2() code WC 10.3.6

public static function guardAgainstInvalidAlpha2(string $alpha2): void
{
    if (1 !== preg_match('/^[a-zA-Z]{2}$/', $alpha2)) {
        throw new DomainException(sprintf('Not a valid alpha2 key: %s', $alpha2));
    }
}