Lines 90.90% 10 / 11
Functions and Methods 50.00% 1 / 2
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
MoveToCellCommand 90.90% 10 / 11 50.00% 1 / 2 10.08 0.00% 0 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 toMessage 90.00% 9 / 10 0.00% 0 / 1 9.08
1<?php
2
3declare(strict_types=1);
4
5namespace Lorekeeper\Client\Command\Map;
6
7use Lorekeeper\Client\Command\Command;
8use Lorekeeper\Core\World\Map\Cell;
9use Lorekeeper\Core\World\Map\Pad;
10use Lorekeeper\Server\AreaId;
11use Override;
12
13final readonly class MoveToCellCommand implements Command
14{
15    public function __construct(
16        private AreaId $area,
17        private Cell $cell,
18        private Pad $pad,
19    ) {}
20
21    #[Override]
22    public function toMessage(): string
23    {
24        $pad = match ($this->pad) {
25            Pad::Left => 'Left',
26            Pad::Right => 'Right',
27            Pad::Top => 'Top',
28            Pad::Bottom => 'Bottom',
29            Pad::Up => 'Up',
30            Pad::Down => 'Down',
31            Pad::Center => 'Center',
32            Pad::Spawn => 'Spawn',
33        };
34
35        return "%xt%zm%moveToCell%{$this->area}%{$this->cell}%{$pad}%";
36    }
37}