Lines 0.00% 0 / 12
Methods 0.00% 0 / 1
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 messageTemplate 0.00% 0 / 12 0.00% 0 / 1 156
7enum ExposureError: string implements ExceptionReason
8{
9    case ComponentMissing = 'exposure_component_missing';
10    case ProtocolMismatch = 'exposure_protocol_mismatch';
11    case ComponentRefused = 'exposure_component_refused';
12    case OutsideApp = 'exposure_outside_app';
13    case KeyInvalid = 'exposure_key_invalid';
14    case KeyTaken = 'exposure_key_taken';
15    case ConfigInvalid = 'exposure_config_invalid';
16    case StateInvalid = 'exposure_state_invalid';
17    case Removed = 'exposure_removed';
18    case Unreachable = 'exposure_unreachable';
19    case TimedOut = 'exposure_timed_out';
20
21    public function messageTemplate(): string
22    {
23        return match ($this) {
24            self::ComponentMissing => 'Entity {key} cannot be exposed because the stewart Home Assistant integration is not installed; see `stewart status`.',
25            self::ProtocolMismatch => 'Entity {key} cannot be exposed because the stewart Home Assistant integration speaks another protocol; see `stewart status`.',
26            self::ComponentRefused => 'Entity {key} cannot be exposed because Home Assistant refused the stewart integration session; see `stewart status`.',
27            self::OutsideApp => 'Entity {key} cannot be exposed outside an app, because its unique ID needs an app ID.',
28            self::KeyInvalid => 'Exposed entity key "{key}" is invalid; use up to {limit} lowercase letters, digits and "_", starting with a letter.',
29            self::KeyTaken => 'App {appId} already exposes an entity with key {key}.',
30            self::ConfigInvalid => 'Home Assistant cannot use this entity configuration: {detail}',
31            self::StateInvalid => 'Home Assistant cannot use this entity state: {detail}',
32            self::Removed => 'Exposed entity {key} was removed; expose it again to use it.',
33            self::Unreachable => 'Could not reach the broker for exposed entity {key}: {detail}',
34            self::TimedOut => 'The broker did not answer for exposed entity {key} within {timeout}.',
35        };
36    }
37}