Currency::isValid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
16 3
        $currencies = self::getCurrencies();
17 3
        return in_array($currency, $currencies);
18
    }
19
20 3
    static function getCurrencies(): array
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
    {
22 3
        $rClass = new \ReflectionClass(__CLASS__);
23 3
        return $rClass->getConstants();
24
    }
25
}