You are here

public function CurrencyRepository::get in Price 2.0.x

Same name and namespace in other branches
  1. 8 src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::get()
  2. 3.x src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::get()
  3. 2.x src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::get()
  4. 3.0.x src/Repository/CurrencyRepository.php \Drupal\price\Repository\CurrencyRepository::get()

File

src/Repository/CurrencyRepository.php, line 44

Class

CurrencyRepository
Defines the currency repository.

Namespace

Drupal\price\Repository

Code

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

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