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 | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| DeployError | 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\Runtime\Exception; | |
| 6 | ||
| 7 | use Stewart\Contracts\Exception\ExceptionReason; | |
| 8 | ||
| 9 | enum DeployError: string implements ExceptionReason | |
| 10 | { | |
| 11 | case CommitIdInvalid = 'commit_id_invalid'; | |
| 12 | case CommandTimedOut = 'command_timed_out'; | |
| 13 | case CommandFailed = 'command_failed'; | |
| 14 | case PrepareOutputUnexpected = 'prepare_output_unexpected'; | |
| 15 | ||
| 16 | public function messageTemplate(): string | |
| 17 | { | |
| 18 | return match ($this) { | |
| 19 | self::CommitIdInvalid => '"{value}" is not a commit hash.', | |
| 20 | self::CommandTimedOut => '{command} did not finish within {timeout}.', | |
| 21 | self::CommandFailed => '{command} failed with exit code {exitCode}: {detail}', | |
| 22 | self::PrepareOutputUnexpected => 'release-prepare printed "{output}" instead of a commit and its state.', | |
| 23 | }; | |
| 24 | } | |
| 25 | } |