Lines 100.00% 10 / 10
Methods 100.00% 1 / 1
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 read 100.00% 10 / 10 100.00% 1 / 1 10
11final readonly class MapPads
12{
13    /**
14     * @param class-string<Event> $event
15     *
16     * @throws MalformedEventException
17     */
18    public static function read(string $pad, string $event): MapPad
19    {
20        return match (strtolower($pad)) {
21            'left' => MapPad::Left,
22            'right' => MapPad::Right,
23            'top' => MapPad::Top,
24            'bottom' => MapPad::Bottom,
25            'up' => MapPad::Up,
26            'down' => MapPad::Down,
27            'center' => MapPad::Center,
28            'spawn' => MapPad::Spawn,
29            default => throw new MalformedEventException($event, "unknown pad '{$pad}'"),
30        };
31    }
32}