File tree 2 files changed +9
-137
lines changed
2 files changed +9
-137
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,13 @@ class Currency
26
26
public const LIST_CUSTOM = 'custom ' ;
27
27
public const LIST_CONFIG = 'config ' ;
28
28
29
+ public const LISTS = [
30
+ self ::LIST_ALL ,
31
+ self ::LIST_POPULAR ,
32
+ self ::LIST_CUSTOM ,
33
+ self ::LIST_CONFIG ,
34
+ ];
35
+
29
36
private const CONFIG_LIST = 'money.currency_list ' ;
30
37
private const CONFIG_CUSTOM = 'money.custom_currencies ' ;
31
38
@@ -192,21 +199,13 @@ public static function getCurrencies(): array
192
199
193
200
public static function isIncorrectList (string $ list ): bool
194
201
{
195
- return !in_array (
196
- $ list ,
197
- [
198
- self ::LIST_ALL ,
199
- self ::LIST_POPULAR ,
200
- self ::LIST_CONFIG ,
201
- self ::LIST_CONFIG ,
202
- ]
203
- );
202
+ return !in_array ($ list , self ::LISTS );
204
203
}
205
204
206
205
public static function setCurrencyList (string $ list = self ::LIST_POPULAR ): void
207
206
{
208
207
if (self ::isIncorrectList ($ list )) {
209
- $ list = self :: LIST_POPULAR ;
208
+ throw new CurrencyListConfigException ( $ list ) ;
210
209
}
211
210
self ::$ list = $ list ;
212
211
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments