| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2.032 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 1 | public static function getRandomAlertLevel(): SpacecraftAlertStateEnum |
|
| 39 | { |
||
| 40 | /** @var array<int> */ |
||
| 41 | 1 | $values = array_map(fn(SpacecraftAlertStateEnum $alertState) => $alertState->value, self::cases()); |
|
| 42 | 1 | if($values === []) { |
|
| 43 | throw new RuntimeException('No alert states defined'); |
||
| 44 | } |
||
| 45 | |||
| 46 | 1 | return self::from($values[array_rand($values)]); |
|
| 47 | } |
||
| 49 |