You are here

protected function PriceModified::assertCurrencyCodeFormat in Price 3.x

Same name and namespace in other branches
  1. 8 src/PriceModified.php \Drupal\price\PriceModified::assertCurrencyCodeFormat()
  2. 3.0.x src/PriceModified.php \Drupal\price\PriceModified::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 PriceModified::assertCurrencyCodeFormat()
PriceModified::__construct in src/PriceModified.php
Constructs a new PriceModified object.

File

src/PriceModified.php, line 280

Class

PriceModified
Provides a value object for monetary values.

Namespace

Drupal\price

Code

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