Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Currency Class Reference

Public Member Functions

 __construct (Lists $lists)
 
 isValid ($currencyCode)
 

Protected Attributes

 $lists
 

Detailed Description

Currency validator model

Definition at line 14 of file Currency.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Lists  $lists)

Constructor

Parameters
Lists$lists

Definition at line 26 of file Currency.php.

27  {
28  $this->lists = $lists;
29  }

Member Function Documentation

◆ isValid()

isValid (   $currencyCode)

Validate currency code

Parameters
string$currencyCode
Returns
bool @api

Definition at line 38 of file Currency.php.

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  }

Field Documentation

◆ $lists

$lists
protected

Definition at line 19 of file Currency.php.


The documentation for this class was generated from the following file: