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