Lines
100.00%
11 / 11
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% | 10 / 10 | 100.00% | 1 / 1 | 9 | ||
| 13 | final readonly class MoveToCellCommand implements Command | |
| 14 | { | |
| 15 | public function __construct( | |
| 16 | private AreaId $area, | |
| 17 | private MapSpot $spot, | |
| 18 | ) {} | |
| 19 | ||
| 20 | #[Override] | |
| 21 | public function toMessage(): string | |
| 22 | { | |
| 23 | $pad = match ($this->spot->pad) { | |
| 24 | MapPad::Left => 'Left', | |
| 25 | MapPad::Right => 'Right', | |
| 26 | MapPad::Top => 'Top', | |
| 27 | MapPad::Bottom => 'Bottom', | |
| 28 | MapPad::Up => 'Up', | |
| 29 | MapPad::Down => 'Down', | |
| 30 | MapPad::Center => 'Center', | |
| 31 | MapPad::Spawn => 'Spawn', | |
| 32 | }; | |
| 33 | ||
| 34 | return "%xt%zm%moveToCell%{$this->area}%{$this->spot->cell}%{$pad}%"; | |
| 35 | } | |
| 36 | } |