Lines 100.00% 9 / 9
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 8 / 8 100.00% 1 / 1 6
 toMessage 100.00% 1 / 1 100.00% 1 / 1 1
14final readonly class SupportPlayerCommand implements Command
15{
16    private string $code;
17
18    /** @throws InvalidArgumentException */
19    public function __construct(
20        private AreaId $area,
21        SkillSlot $skill,
22        private PlayerSpawnId $player,
23    ) {
24        $this->code = match ($skill) {
25            SkillSlot::First => 'a1',
26            SkillSlot::Second => 'a2',
27            SkillSlot::Third => 'a3',
28            SkillSlot::Fourth => 'a4',
29            SkillSlot::AutoAttack, SkillSlot::Potion => throw new InvalidArgumentException(
30                'Only a class skill can support a player.',
31            ),
32        };
33    }
34
35    #[Override]
36    public function toMessage(): string
37    {
38        return "%xt%zm%gar%{$this->area}%0%{$this->code}>p:{$this->player}%wvz%";
39    }
40}