You are here

public function CurrencyRepository::get in Commerce Core 8.2

File

modules/price/src/Repository/CurrencyRepository.php, line 44

Class

CurrencyRepository
Defines the currency repository.

Namespace

Drupal\commerce_price\Repository

Code

public function get($currency_code, $locale = NULL) {

  /** @var \Drupal\commerce_price\Entity\CurrencyInterface $currency */
  $currency = $this->currencyStorage
    ->load($currency_code);
  if (!$currency) {
    throw new UnknownCurrencyException($currency_code);
  }
  return $this
    ->createValueObjectFromEntity($currency);
}