Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
11 | 8 | public static function getIntervalCode(string $period): string |
|
12 | { |
||
13 | 8 | $codes = static::getIntervalCodes(); |
|
14 | |||
15 | 8 | if (!isset($codes[$period])) { |
|
16 | 6 | $keys = implode("','", array_keys($codes)); |
|
17 | 6 | throw new \InvalidArgumentException("Period must be one of '$keys'. $period given"); |
|
18 | } |
||
19 | |||
20 | 8 | return $codes[$period]; |
|
21 | } |
||
35 |