Lines 75.00% 3 / 4
Methods 75.00% 3 / 4
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 isTurnOn 100.00% 1 / 1 100.00% 1 / 1 1
 getContext 0.00% 0 / 1 0.00% 0 / 1 2
 getRequestedState 100.00% 1 / 1 100.00% 1 / 1 1
10final readonly class SwitchCommand implements ExposedCommand
11{
12    public function __construct(
13        public SwitchAction $action,
14        public EventContext $context,
15    ) {}
16
17    public function isTurnOn(): bool
18    {
19        return $this->action === SwitchAction::TurnOn;
20    }
21
22    public function getContext(): EventContext
23    {
24        return $this->context;
25    }
26
27    public function getRequestedState(): ExposedState
28    {
29        return new ExposedState($this->isTurnOn());
30    }
31}