Omnipay\Common\Currency::find PHP Method

find() public static method

Find a specific currency
public static find ( string $code ) : mixed
$code string The three letter currency code
return mixed A Currency object, or null if no currency was found
    public static function find($code)
    {
        $code = strtoupper($code);
        $currencies = static::all();
        if (isset($currencies[$code])) {
            return new static($code, $currencies[$code]['numeric'], $currencies[$code]['decimals']);
        }
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Get the number of decimal places in the payment currency.
  *
  * @return integer
  */
 public function getCurrencyDecimalPlaces()
 {
     if ($currency = Currency::find($this->getCurrency())) {
         return $currency->getDecimals();
     }
     return 2;
 }
All Usage Examples Of Omnipay\Common\Currency::find