File tree Expand file tree Collapse file tree 2 files changed +9
-137
lines changed Expand file tree Collapse file tree 2 files changed +9
-137
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,13 @@ class Currency
2626 public const LIST_CUSTOM = 'custom ' ;
2727 public const LIST_CONFIG = 'config ' ;
2828
29+ public const LISTS = [
30+ self ::LIST_ALL ,
31+ self ::LIST_POPULAR ,
32+ self ::LIST_CUSTOM ,
33+ self ::LIST_CONFIG ,
34+ ];
35+
2936 private const CONFIG_LIST = 'money.currency_list ' ;
3037 private const CONFIG_CUSTOM = 'money.custom_currencies ' ;
3138
@@ -192,21 +199,13 @@ public static function getCurrencies(): array
192199
193200 public static function isIncorrectList (string $ list ): bool
194201 {
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 );
204203 }
205204
206205 public static function setCurrencyList (string $ list = self ::LIST_POPULAR ): void
207206 {
208207 if (self ::isIncorrectList ($ list )) {
209- $ list = self :: LIST_POPULAR ;
208+ throw new CurrencyListConfigException ( $ list ) ;
210209 }
211210 self ::$ list = $ list ;
212211
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments