Lines
0.00%
0 / 4
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ScaffoldError | 0.00% | 0 / 4 | 0.00% | 0 / 1 | 20 | 0.00% | 0 / 1 | |||
| messageTemplate | 0.00% | 0 / 4 | 0.00% | 0 / 1 | 20 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Runtime\Exception; | |
| 6 | ||
| 7 | use Stewart\Contracts\Exception\ExceptionReason; | |
| 8 | ||
| 9 | enum ScaffoldError: string implements ExceptionReason | |
| 10 | { | |
| 11 | case ClassNameInvalid = 'class_name_invalid'; | |
| 12 | case FileExists = 'file_exists'; | |
| 13 | case IdTaken = 'id_taken'; | |
| 14 | ||
| 15 | public function messageTemplate(): string | |
| 16 | { | |
| 17 | return match ($this) { | |
| 18 | self::ClassNameInvalid => '"{name}" is not a class name; use letters and digits starting with a capital, such as PorchLight.', | |
| 19 | self::FileExists => '{path} already exists.', | |
| 20 | self::IdTaken => 'An automation already has the ID "{appId}".', | |
| 21 | }; | |
| 22 | } | |
| 23 | } |