Lines
0.00%
0 / 13
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ExposureError | 0.00% | 0 / 13 | 0.00% | 0 / 1 | 182 | 0.00% | 0 / 1 | |||
| messageTemplate | 0.00% | 0 / 13 | 0.00% | 0 / 1 | 182 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Contracts\Exception; | |
| 6 | ||
| 7 | enum ExposureError: string implements ExceptionReason | |
| 8 | { | |
| 9 | /** @deprecated since 2.1, exposures wait for the integration instead; removed in 3.0 */ | |
| 10 | case ComponentMissing = 'exposure_component_missing'; | |
| 11 | case ProtocolMismatch = 'exposure_protocol_mismatch'; | |
| 12 | case ComponentRefused = 'exposure_component_refused'; | |
| 13 | case OutsideApp = 'exposure_outside_app'; | |
| 14 | case KeyInvalid = 'exposure_key_invalid'; | |
| 15 | case KeyTaken = 'exposure_key_taken'; | |
| 16 | case ConfigInvalid = 'exposure_config_invalid'; | |
| 17 | case StateInvalid = 'exposure_state_invalid'; | |
| 18 | case Removed = 'exposure_removed'; | |
| 19 | case Unreachable = 'exposure_unreachable'; | |
| 20 | case TimedOut = 'exposure_timed_out'; | |
| 21 | case Disabled = 'exposure_disabled'; | |
| 22 | ||
| 23 | public function messageTemplate(): string | |
| 24 | { | |
| 25 | return match ($this) { | |
| 26 | self::ComponentMissing => 'Entity {key} cannot be exposed because the stewart Home Assistant integration is not installed or not loaded yet; see `stewart status`.', | |
| 27 | self::ProtocolMismatch => 'Entity {key} cannot be exposed because the stewart Home Assistant integration speaks another protocol; see `stewart status`.', | |
| 28 | self::ComponentRefused => 'Entity {key} cannot be exposed because Home Assistant refused the stewart integration session; see `stewart status`.', | |
| 29 | self::OutsideApp => 'Entity {key} cannot be exposed outside an app, because its unique ID needs an app ID.', | |
| 30 | self::KeyInvalid => 'Exposed entity key "{key}" is invalid; use up to {limit} lowercase letters, digits and "_", starting with a letter.', | |
| 31 | self::KeyTaken => 'App {appId} already exposes an entity with key {key}.', | |
| 32 | self::ConfigInvalid => 'Home Assistant cannot use this entity configuration: {detail}', | |
| 33 | self::StateInvalid => 'Home Assistant cannot use this entity state: {detail}', | |
| 34 | self::Removed => 'Exposed entity {key} was removed; expose it again to use it.', | |
| 35 | self::Unreachable => 'Could not reach the broker for exposed entity {key}: {detail}', | |
| 36 | self::TimedOut => 'The broker did not answer for exposed entity {key} within {timeout}.', | |
| 37 | self::Disabled => 'Entity {key} cannot be exposed because expose.enabled is off.', | |
| 38 | }; | |
| 39 | } | |
| 40 | } |