Automattic\WooCommerce\Vendor\League\ISO3166
ISO3166DataValidator::assertEntryHasRequiredKeys
Method of the class: ISO3166DataValidator{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->assertEntryHasRequiredKeys( $entry ): void;
- $entry(array) (required)
- .
ISO3166DataValidator::assertEntryHasRequiredKeys() ISO3166DataValidator::assertEntryHasRequiredKeys code WC 10.3.6
private function assertEntryHasRequiredKeys(array $entry): void
{
if (!isset($entry[ISO3166::KEY_NAME])) {
throw new DomainException('Each data entry must have a name key.');
}
Guards::guardAgainstInvalidName($entry[ISO3166::KEY_NAME]);
if (!isset($entry[ISO3166::KEY_ALPHA2])) {
throw new DomainException('Each data entry must have a alpha2 key.');
}
Guards::guardAgainstInvalidAlpha2($entry[ISO3166::KEY_ALPHA2]);
if (!isset($entry[ISO3166::KEY_ALPHA3])) {
throw new DomainException('Each data entry must have a alpha3 key.');
}
Guards::guardAgainstInvalidAlpha3($entry[ISO3166::KEY_ALPHA3]);
if (!isset($entry[ISO3166::KEY_NUMERIC])) {
throw new DomainException('Each data entry must have a numeric key.');
}
Guards::guardAgainstInvalidNumeric($entry[ISO3166::KEY_NUMERIC]);
}