Lines
0.00%
0 / 7
Methods
0.00%
0 / 1
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| messageTemplate | 0.00% | 0 / 7 | 0.00% | 0 / 1 | 56 | ||
| 7 | enum TimeError: string implements ExceptionReason | |
| 8 | { | |
| 9 | case DurationNegative = 'duration_negative'; | |
| 10 | case DurationNotFinite = 'duration_not_finite'; | |
| 11 | case DurationNotPositive = 'duration_not_positive'; | |
| 12 | case DurationTooLarge = 'duration_too_large'; | |
| 13 | case DurationUnparsable = 'duration_unparsable'; | |
| 14 | case InstantUnparsable = 'instant_unparsable'; | |
| 15 | ||
| 16 | public function messageTemplate(): string | |
| 17 | { | |
| 18 | return match ($this) { | |
| 19 | self::DurationNegative => 'Duration {microseconds}us is negative.', | |
| 20 | self::DurationNotFinite => 'Duration {amount} is not a finite number.', | |
| 21 | self::DurationNotPositive => 'The duration for {usage} must be at least 1ms.', | |
| 22 | self::DurationTooLarge => 'Duration exceeds the 292-year maximum.', | |
| 23 | self::DurationUnparsable => 'Duration "{text}" is invalid; expected a number and one unit, such as 500ms, 5s, 2m or 1h.', | |
| 24 | self::InstantUnparsable => 'Instant "{text}" is not ISO-8601.', | |
| 25 | }; | |
| 26 | } | |
| 27 | } |