Lines 0.00% 0 / 9
Methods 0.00% 0 / 1
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 messageTemplate 0.00% 0 / 9 0.00% 0 / 1 90
9enum AppError: string implements ExceptionReason
10{
11    case DuplicateId = 'duplicate_id';
12    case DirectoryNotAutoloadable = 'directory_not_autoloadable';
13    case NotAnApp = 'not_an_app';
14    case NotInstantiable = 'not_instantiable';
15    case IdInvalid = 'id_invalid';
16    case InitializeTimedOut = 'initialize_timed_out';
17    case Unknown = 'unknown';
18    case Disabled = 'disabled';
19
20    public function messageTemplate(): string
21    {
22        return match ($this) {
23            self::DuplicateId => 'Automations {firstClass} and {secondClass} both use ID "{appId}"; "-" and "_" count as the same character.',
24            self::DirectoryNotAutoloadable => '{directory} is not covered by a PSR-4 autoload rule. Add it to "autoload" in composer.json and run `make install`.',
25            self::NotAnApp => '{className} has #[Automation] but does not implement {appInterface}.',
26            self::NotInstantiable => '{className} has #[Automation] but cannot be instantiated.',
27            self::IdInvalid => '{className}: automation ID "{appId}" is invalid; use lowercase letters, digits, "-" and "_", starting with a letter.',
28            self::InitializeTimedOut => '{appId} initialize() did not return within {timeout}. Raise supervision.initialize_timeout if needed.',
29            self::Unknown => 'No automation with ID "{appId}".',
30            self::Disabled => 'Automation "{appId}" is not loaded because apps.{appId}.enabled is false.',
31        };
32    }
33}