protected function Price::assertCurrencyCodeFormat in Commerce Core 8.2
Asserts that the currency code is in the right format.
Serves only as a basic sanity check.
Parameters
string $currency_code: The currency code.
Throws
\InvalidArgumentException Thrown when the currency code is not in the right format.
1 call to Price::assertCurrencyCodeFormat()
- Price::__construct in modules/
price/ src/ Price.php - Constructs a new Price object.
File
- modules/
price/ src/ Price.php, line 297
Class
- Price
- Provides a value object for monetary values.
Namespace
Drupal\commerce_priceCode
protected function assertCurrencyCodeFormat($currency_code) {
if (strlen($currency_code) != '3') {
throw new \InvalidArgumentException(sprintf('Invalid currency code "%s".', $currency_code));
}
}