Lines 100.00% 7 / 7
Methods 100.00% 1 / 1
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 messageTemplate 100.00% 7 / 7 100.00% 1 / 1 7
9enum HarnessError: string implements ExceptionReason
10{
11    case AlreadyStarted = 'harness_already_started';
12    case AutomationMissing = 'harness_automation_missing';
13    case NotStarted = 'harness_not_started';
14    case OptionMissing = 'harness_option_missing';
15    case OptionUnknown = 'harness_option_unknown';
16    case ParameterUnresolvable = 'harness_parameter_unresolvable';
17
18    public function messageTemplate(): string
19    {
20        return match ($this) {
21            self::AlreadyStarted => 'The harness already runs {class}; use one harness per app.',
22            self::AutomationMissing => '{class} has no #[Automation] attribute, so it is not an app.',
23            self::NotStarted => 'No app is running; call startApp() first.',
24            self::OptionMissing => '{class}::__construct() needs option "{option}"; pass it to startApp().',
25            self::OptionUnknown => 'Option "{option}" matches no parameter of {class}::__construct().',
26            self::ParameterUnresolvable => '{class}::__construct() takes ${parameter} as {type}, which the harness has no fake for; pass one with provideService().',
27        };
28    }
29}