Lines 0.00% 0 / 15
Methods 0.00% 0 / 1
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 messageTemplate 0.00% 0 / 15 0.00% 0 / 1 240
9enum ContainerError: string implements ExceptionReason
10{
11    case ServiceTypeMismatch = 'service_type_mismatch';
12    case BuildFailed = 'build_failed';
13    case AppInServicesFile = 'app_in_services_file';
14    case PeerStoreWritable = 'peer_store_writable';
15    case PeerStoreAppIdInvalid = 'peer_store_app_id_invalid';
16    case MessageHandlerDuplicated = 'message_handler_duplicated';
17    case AppOptionInvalid = 'app_option_invalid';
18    case AppOptionUnknown = 'app_option_unknown';
19    case AppOptionMissing = 'app_option_missing';
20    case AppOptionAmbiguous = 'app_option_ambiguous';
21    case AppOptionRepeated = 'app_option_repeated';
22    case AppBuildFailed = 'app_build_failed';
23    case AppClassMissing = 'app_class_missing';
24    case ServicesFileMissing = 'services_file_missing';
25
26    public function messageTemplate(): string
27    {
28        return match ($this) {
29            self::ServiceTypeMismatch => 'Service "{serviceId}" is {actualType}; expected {expectedType}.',
30            self::BuildFailed => 'Worker {workerId} failed to build its container: {cause}',
31            self::AppInServicesFile => 'services.php defines "{serviceId}" as automation {class}. Configure it in stewart.yaml instead.',
32            self::PeerStoreWritable => '{class}::__construct() takes ${parameter} with #[PeerStore] as Store; type it ReadableStore.',
33            self::PeerStoreAppIdInvalid => '{class}::__construct() takes ${parameter} with #[PeerStore]: {cause}',
34            self::MessageHandlerDuplicated => '{firstHandler} and {secondHandler} both handle {messageClass}.',
35            self::AppOptionInvalid => 'Option "{option}" of app "{appId}" is "{value}", which is not a valid {expectedType}.',
36            self::AppOptionUnknown => 'App "{appId}" sets option "{option}", which matches no parameter of {class}::__construct().',
37            self::AppOptionMissing => 'App "{appId}" needs option "{option}"; {class}::__construct() takes ${option} with no default.',
38            self::AppOptionAmbiguous => 'App "{appId}" sets option "{option}", which matches parameters {parameters} of {class}::__construct(); use the exact name.',
39            self::AppOptionRepeated => 'App "{appId}" sets ${parameter} of {class}::__construct() twice, as options "{firstOption}" and "{secondOption}".',
40            self::AppBuildFailed => 'App "{appId}" cannot be built: {cause}',
41            self::AppClassMissing => 'App "{appId}" names class {class}, which cannot be loaded.',
42            self::ServicesFileMissing => 'Services file {path} no longer exists.',
43        };
44    }
45}