Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
IllegalTransition
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace LambdaTwelve\OneRecord\Server;
6
7use LambdaTwelve\OneRecord\Api\ActionRequest;
8use LambdaTwelve\OneRecord\Api\RequestStatus;
9use 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 */
15final 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}