Lines 100.00% 9 / 9
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
LoginCommand 100.00% 9 / 9 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 toMessage 100.00% 8 / 8 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Client\Command\Session;
6
7use Lorekeeper\Client\ClientVersion;
8use Lorekeeper\Client\Command\Command;
9use Lorekeeper\Core\Player\PlayerName;
10use Override;
11use SensitiveParameter;
12
13final readonly class LoginCommand implements Command
14{
15    public function __construct(
16        public PlayerName $playerName,
17        #[SensitiveParameter]
18        public string $token,
19        public ClientVersion $version,
20    ) {}
21
22    #[Override]
23    public function toMessage(): string
24    {
25        return (
26            "<msg t='sys'>"
27            . "<body action='login' r='0'>"
28            . "<login z='zone_master'>"
29            . "<nick><![CDATA[SPIDER#0001~{$this->playerName}~{$this->version}]]></nick>"
30            . "<pword><![CDATA[{$this->token}]]></pword>"
31            . '</login></body></msg>'
32        );
33    }
34}