Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
16 | 15 | public static function getDateFormat(string $period): string |
|
17 | { |
||
18 | 15 | $formats = static::getDateFormats(); |
|
19 | |||
20 | 15 | if (!isset($formats[$period])) { |
|
21 | 1 | $keys = implode("','", array_keys($formats)); |
|
22 | 1 | throw new \InvalidArgumentException("Period must be one of '$keys'. $period given"); |
|
23 | } |
||
24 | |||
25 | 14 | return $formats[$period]; |
|
26 | } |
||
33 |