Lines
100.00%
4 / 4
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| CombatStates | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 4 | 100.00% | 1 / 1 | |||
| read | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 4 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Lorekeeper\Server\Event\Combat\Helper; | |
| 6 | ||
| 7 | use Lorekeeper\Core\Game\Combat\CombatState; | |
| 8 | ||
| 9 | final readonly class CombatStates | |
| 10 | { | |
| 11 | /** @param int<0, 2> $state */ | |
| 12 | public static function read(int $state): CombatState | |
| 13 | { | |
| 14 | return match ($state) { | |
| 15 | 0 => CombatState::Dead, | |
| 16 | 2 => CombatState::Fighting, | |
| 17 | default => CombatState::Idle, | |
| 18 | }; | |
| 19 | } | |
| 20 | } |