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