Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| IllegalTransition | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Server; |
| 6 | |
| 7 | use LambdaTwelve\OneRecord\Api\ActionRequest; |
| 8 | use LambdaTwelve\OneRecord\Api\RequestStatus; |
| 9 | use RuntimeException; |
| 10 | |
| 11 | /** |
| 12 | * An action request cannot move to the requested status from where it is |
| 13 | * (revoking an applied change, accepting a rejected request, ...). |
| 14 | */ |
| 15 | final class IllegalTransition extends RuntimeException |
| 16 | { |
| 17 | public function __construct(public readonly ActionRequest $request, public readonly RequestStatus $next) |
| 18 | { |
| 19 | parent::__construct(\sprintf('A %s in status %s cannot become %s.', $request->type->name, $request->status->shortName(), $next->shortName())); |
| 20 | } |
| 21 | } |