Lines
0.00%
0 / 5
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| StoreSetupError | 0.00% | 0 / 5 | 0.00% | 0 / 1 | 30 | 0.00% | 0 / 1 | |||
| messageTemplate | 0.00% | 0 / 5 | 0.00% | 0 / 1 | 30 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Store\Exception; | |
| 6 | ||
| 7 | use Stewart\Contracts\Exception\ExceptionReason; | |
| 8 | ||
| 9 | enum StoreSetupError: string implements ExceptionReason | |
| 10 | { | |
| 11 | case DsnInvalid = 'dsn_invalid'; | |
| 12 | case SchemeUnsupported = 'scheme_unsupported'; | |
| 13 | case UnknownPeerApp = 'unknown_peer_app'; | |
| 14 | case PrefixInvalid = 'prefix_invalid'; | |
| 15 | ||
| 16 | public function messageTemplate(): string | |
| 17 | { | |
| 18 | return match ($this) { | |
| 19 | self::DsnInvalid => 'Store URL is invalid ({length} characters); expected a URL like "redis://host:6379/0".', | |
| 20 | self::SchemeUnsupported => 'No installed store backend handles "{scheme}://"; installed schemes: {supported}.', | |
| 21 | self::UnknownPeerApp => 'No automation has ID "{appId}", so its store cannot be opened.', | |
| 22 | self::PrefixInvalid => 'Store prefix "{prefix}" is invalid; expected a letter or digit, then up to 63 letters, digits, ".", "_" or "-".', | |
| 23 | }; | |
| 24 | } | |
| 25 | } |