public static function validate($currency) { if (static::$codes == null) { static::$codes = config('currency.currency_list'); } if (!isset(static::$codes[$currency])) { throw new CurrencyNotFound(); } }
/** * @param bool $combined * @return array */ public static function getCodes($combined = false) { if (!isset(static::$codes, static::$combinedCodes)) { $codes = []; $combinedCodes = []; foreach (static::getValues() as $key => $value) { if (substr($key, 0, 5) === 'CODE_') { $codes[$key] = $value; $combinedCodes[$value] = $value; } } static::$codes = $codes; static::$combinedCodes = $combinedCodes; } return $combined ? static::$combinedCodes : static::$codes; }