Lines
0.00%
0 / 9
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| AppError | 0.00% | 0 / 9 | 0.00% | 0 / 1 | 90 | 0.00% | 0 / 1 | |||
| messageTemplate | 0.00% | 0 / 9 | 0.00% | 0 / 1 | 90 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Runtime\Exception; | |
| 6 | ||
| 7 | use Stewart\Contracts\Exception\ExceptionReason; | |
| 8 | ||
| 9 | enum 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 | } |