Skip to content

Commit

Permalink
Fix custom list in currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PostScripton committed Jul 25, 2022
1 parent 457d64c commit 2c55be1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 137 deletions.
19 changes: 9 additions & 10 deletions src/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ class Currency
public const LIST_CUSTOM = 'custom';
public const LIST_CONFIG = 'config';

public const LISTS = [
self::LIST_ALL,
self::LIST_POPULAR,
self::LIST_CUSTOM,
self::LIST_CONFIG,
];

private const CONFIG_LIST = 'money.currency_list';
private const CONFIG_CUSTOM = 'money.custom_currencies';

Expand Down Expand Up @@ -192,21 +199,13 @@ public static function getCurrencies(): array

public static function isIncorrectList(string $list): bool
{
return !in_array(
$list,
[
self::LIST_ALL,
self::LIST_POPULAR,
self::LIST_CONFIG,
self::LIST_CONFIG,
]
);
return !in_array($list, self::LISTS);
}

public static function setCurrencyList(string $list = self::LIST_POPULAR): void
{
if (self::isIncorrectList($list)) {
$list = self::LIST_POPULAR;
throw new CurrencyListConfigException($list);
}
self::$list = $list;

Expand Down
127 changes: 0 additions & 127 deletions tests/Feature/CurrencyListsTest.php

This file was deleted.

0 comments on commit 2c55be1

Please sign in to comment.