Lines 0.00% 0 / 7
Methods 0.00% 0 / 1
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 messageTemplate 0.00% 0 / 7 0.00% 0 / 1 56
7enum ScheduleError: string implements ExceptionReason
8{
9    case CronInvalid = 'cron_invalid';
10    case EntityTimeDomainUnsupported = 'entity_time_domain_unsupported';
11    case SunLocationUnknown = 'sun_location_unknown';
12    case TimeOfDayInvalid = 'time_of_day_invalid';
13    case TimeOfDayOutOfRange = 'time_of_day_out_of_range';
14    case TimeWindowEmpty = 'time_window_empty';
15
16    public function messageTemplate(): string
17    {
18        return match ($this) {
19            self::CronInvalid => 'Cron expression "{expression}" is invalid.',
20            self::EntityTimeDomainUnsupported => 'Entity "{entityId}" holds no time; expected an input_datetime or a sensor entity.',
21            self::SunLocationUnknown => 'A {event} schedule needs a location, and Home Assistant reported none.',
22            self::TimeOfDayInvalid => 'Time of day "{value}" is invalid; expected "HH:MM" or "HH:MM:SS".',
23            self::TimeOfDayOutOfRange => 'Time of day {unit} {value} is outside 0-{highest}.',
24            self::TimeWindowEmpty => 'Time window starts and ends at {time}; start and end must differ.',
25        };
26    }
27}