Lines 100.00% 3 / 3
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
LoadQuestCommand 100.00% 3 / 3 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 toMessage 100.00% 2 / 2 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Client\Command\Quest;
6
7use Lorekeeper\Client\Command\Command;
8use Lorekeeper\Core\World\Quest\QuestId;
9use Lorekeeper\Server\AreaId;
10use Override;
11
12final readonly class LoadQuestCommand implements Command
13{
14    /** @var non-empty-list<QuestId> */
15    private array $questIds;
16
17    public function __construct(
18        private AreaId $areaId,
19        QuestId $questId,
20        QuestId ...$more,
21    ) {
22        $this->questIds = [$questId, ...array_values($more)];
23    }
24
25    #[Override]
26    public function toMessage(): string
27    {
28        $ids = implode('%', array_map(static fn(QuestId $id): string => (string) $id->value, $this->questIds));
29
30        return "%xt%zm%getQuests%{$this->areaId}%{$ids}%";
31    }
32}