| Total Complexity | 4 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Coverage | 88.89% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | final readonly class RefreshInterceptor implements MethodInterceptor |
||
|
|
|||
| 15 | { |
||
| 16 | public function __construct( |
||
| 17 | private RefreshAnnotatedCommand $command, |
||
| 18 | ) { |
||
| 19 | } |
||
| 20 | 2 | ||
| 21 | #[Override] |
||
| 22 | 2 | public function invoke(MethodInvocation $invocation): ResourceObject |
|
| 23 | 2 | { |
|
| 24 | /** @psalm-suppress MixedAssignment */ |
||
| 25 | 2 | $ro = $invocation->proceed(); |
|
| 26 | if (! $ro instanceof ResourceObject) { |
||
| 27 | 2 | throw new ReturnValueIsNotResourceObjectException($invocation->getThis()::class); // @codeCoverageIgnore |
|
| 28 | 2 | } |
|
| 29 | |||
| 30 | if ($ro->code < Code::BAD_REQUEST) { |
||
| 31 | $this->command->command($invocation, $ro); |
||
| 32 | 2 | } |
|
| 33 | 2 | ||
| 34 | return $ro; |
||
| 35 | } |
||
| 37 |