You are here

protected function Price::assertCurrencyCodeFormat in Price 8

Same name and namespace in other branches
  1. 3.x src/Price.php \Drupal\price\Price::assertCurrencyCodeFormat()
  2. 2.0.x src/Price.php \Drupal\price\Price::assertCurrencyCodeFormat()
  3. 2.x src/Price.php \Drupal\price\Price::assertCurrencyCodeFormat()
  4. 3.0.x src/Price.php \Drupal\price\Price::assertCurrencyCodeFormat()

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 src/Price.php
Constructs a new Price object.

File

src/Price.php, line 262

Class

Price
Provides a value object for monetary values.

Namespace

Drupal\price

Code

protected function assertCurrencyCodeFormat($currency_code) {
  if (strlen($currency_code) != '3') {
    throw new \InvalidArgumentException();
  }
}