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