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
 type 0.00% 0 / 1 0.00% 0 / 1 2
 describe 100.00% 1 / 1 100.00% 1 / 1 1
 toMessage 100.00% 1 / 1 100.00% 1 / 1 1
12final readonly class UpdateExposedEntityState implements HaCommand
13{
14    public function __construct(
15        public ExposedEntityAddress $address,
16        public ExposedStateChange $change,
17    ) {}
18
19    public function type(): string
20    {
21        return 'stewart/entity/state';
22    }
23
24    public function describe(): string
25    {
26        return \sprintf('%s %s', $this->type(), $this->address->describe());
27    }
28
29    public function toMessage(): array
30    {
31        return ['type' => $this->type(), ...$this->address->toMessageFields(), ...ExposedStateFields::formatStateChange($this->change)];
32    }
33}