Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Currency.php
Go to the documentation of this file.
1 <?php
8 
10 
14 class Currency
15 {
19  protected $lists;
20 
26  public function __construct(Lists $lists)
27  {
28  $this->lists = $lists;
29  }
30 
38  public function isValid($currencyCode)
39  {
40  $isValid = true;
41  $allowedCurrencyCodes = array_keys($this->lists->getCurrencyList());
42 
43  if (!$currencyCode || !in_array($currencyCode, $allowedCurrencyCodes)) {
44  $isValid = false;
45  }
46 
47  return $isValid;
48  }
49 }