Lines 0.00% 0 / 5
Functions and Methods 0.00% 0 / 5
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
WorkerExposedAction 0.00% 0 / 5 0.00% 0 / 5 30 0.00% 0 / 1
 getConfig 0.00% 0 / 1 0.00% 0 / 1 2
 updateConfig 0.00% 0 / 1 0.00% 0 / 1 2
 watchCalls 0.00% 0 / 1 0.00% 0 / 1 2
 applySnapshot 0.00% 0 / 1 0.00% 0 / 1 2
 recordCommandedState 0.00% 0 / 1 0.00% 0 / 1 2
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\Worker\Exposure;
6
7use Stewart\Contracts\EventStream;
8use Stewart\Contracts\Exposure\Action\ActionCall;
9use Stewart\Contracts\Exposure\Action\ActionConfig;
10use Stewart\Contracts\Exposure\Action\ExposedAction;
11use Stewart\Contracts\Exposure\ExposedEntitySnapshot;
12use Stewart\Contracts\Exposure\ExposedState;
13
14/** @extends WorkerExposure<ActionConfig> */
15final class WorkerExposedAction extends WorkerExposure implements ExposedAction
16{
17    public function getConfig(): ActionConfig
18    {
19        return $this->findConfig();
20    }
21
22    public function updateConfig(ActionConfig $config): void
23    {
24        $this->sendReconfiguration($config);
25    }
26
27    public function watchCalls(): EventStream
28    {
29        /** @var EventStream<ActionCall> */
30        return $this->watchOwnCommands();
31    }
32
33    // An action has no entity in Home Assistant, so there is no state to track.
34    public function applySnapshot(ExposedEntitySnapshot $snapshot): void {}
35
36    public function recordCommandedState(ExposedState $state): void {}
37}