Lines 71.42% 5 / 7
Functions and Methods 0.00% 0 / 1
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
RegistryEditError 71.42% 5 / 7 0.00% 0 / 1 8.14 0.00% 0 / 1
 messageTemplate 71.42% 5 / 7 0.00% 0 / 1 8.14
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Contracts\Exception;
6
7enum RegistryEditError: string implements ExceptionReason
8{
9    case NotFound = 'registry_edit_not_found';
10    case NothingToUpdate = 'registry_edit_nothing_to_update';
11    case Rejected = 'registry_edit_rejected';
12    case Unreachable = 'registry_edit_unreachable';
13    case TimedOut = 'registry_edit_timed_out';
14    case Overloaded = 'registry_edit_overloaded';
15
16    public function messageTemplate(): string
17    {
18        return match ($this) {
19            self::NotFound => 'Entity {entityId} is not in the Home Assistant entity registry.',
20            self::NothingToUpdate => 'The registry update for {entityId} changes nothing.',
21            self::Rejected => 'Home Assistant rejected the registry update for {entityId}: {detail}',
22            self::Unreachable => 'The registry update for {entityId} could not reach Home Assistant: {detail}',
23            self::TimedOut => 'The registry update for {entityId} timed out: {detail}',
24            self::Overloaded => 'The registry update for {entityId} was refused: {detail}',
25        };
26    }
27}