brucepc /
sum-up
| 1 | <?php |
||
| 2 | namespace BPCI\SumUp\Utils; |
||
| 3 | |||
| 4 | class Currency |
||
| 5 | { |
||
| 6 | const EUR = 'EUR'; |
||
| 7 | const GBP = 'GBP'; |
||
| 8 | const RUB = 'RUB'; |
||
| 9 | const BRL = 'BRL'; |
||
| 10 | const PLN = 'PLN'; |
||
| 11 | const CHF = 'CHF'; |
||
| 12 | const SEK = 'SEK'; |
||
| 13 | const USD = 'USD'; |
||
| 14 | |||
| 15 | 3 | static function isValid(string $currency){ |
|
|
0 ignored issues
–
show
|
|||
| 16 | 3 | $currencies = self::getCurrencies(); |
|
| 17 | 3 | return in_array($currency, $currencies); |
|
| 18 | } |
||
| 19 | |||
| 20 | 3 | static function getCurrencies(): array |
|
|
0 ignored issues
–
show
|
|||
| 21 | { |
||
| 22 | 3 | $rClass = new \ReflectionClass(__CLASS__); |
|
| 23 | 3 | return $rClass->getConstants(); |
|
| 24 | } |
||
| 25 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.