Lines
100.00%
9 / 9
Methods
100.00%
1 / 1
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| follow | 100.00% | 9 / 9 | 100.00% | 1 / 1 | 2 | ||
| 13 | final readonly class LocationTracking | |
| 14 | { | |
| 15 | public static function follow(Location $location, Event $event, Identity $me): Location | |
| 16 | { | |
| 17 | if (!$event instanceof MovedToMapEvent) { | |
| 18 | return $location; | |
| 19 | } | |
| 20 | ||
| 21 | $spot = $event | |
| 22 | ->map | |
| 23 | ->players | |
| 24 | ->find($me->spawnId) | |
| 25 | ->map(static fn(MapPlayer $seen): MapSpot => $seen->spot) | |
| 26 | ->unwrapOr($location->spot); | |
| 27 | ||
| 28 | return new Location($event->areaId, $event->map, $spot); | |
| 29 | } | |
| 30 | } |