Lines 100.00% 10 / 10
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 toMessage 100.00% 9 / 9 100.00% 1 / 1 8
11final readonly class ChangeGameSettingCommand implements Command
12{
13    public function __construct(
14        private GameSetting $setting,
15        private bool $allowed,
16    ) {}
17
18    #[Override]
19    public function toMessage(): string
20    {
21        $setting = match ($this->setting) {
22            GameSetting::Goto => 'bGoto',
23            GameSetting::Whispers => 'bWhisper',
24            GameSetting::FriendRequests => 'bFriend',
25            GameSetting::PartyInvites => 'bParty',
26            GameSetting::GuildInvites => 'bGuild',
27            GameSetting::Duels => 'bDuel',
28        };
29        $allowed = $this->allowed ? 'true' : 'false';
30
31        return "%xt%zm%cmd%1%uopref%{$setting}%{$allowed}%";
32    }
33}