Lines 0.00% 0 / 3
Functions and Methods 0.00% 0 / 3
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
RegistryEntityUpdateRequest 0.00% 0 / 3 0.00% 0 / 3 12 0.00% 0 / 1
 __construct 0.00% 0 / 1 0.00% 0 / 1 2
 createUnreachableFailure 0.00% 0 / 1 0.00% 0 / 1 2
 createOverloadedFailure 0.00% 0 / 1 0.00% 0 / 1 2
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\Ipc\Message;
6
7use Stewart\Contracts\Entity\EntityId;
8use Stewart\Contracts\Exception\RegistryEditError;
9use Stewart\Contracts\Exception\RegistryEditException;
10use Stewart\Contracts\Registry\Update\EntityRegistryUpdate;
11use Stewart\Runtime\Model\CorrelationId;
12use Stewart\Runtime\Model\ResourceScope;
13use Throwable;
14
15#[IpcMessage(tag: 'registry_entity_update_request')]
16final readonly class RegistryEntityUpdateRequest implements WorkerMessage, RefusableHaCallRequest
17{
18    public function __construct(
19        public CorrelationId $correlationId,
20        public ResourceScope $scope,
21        public EntityId $entityId,
22        public EntityRegistryUpdate $update,
23    ) {}
24
25    public function createUnreachableFailure(string $detail, ?Throwable $previous = null): RegistryEditException
26    {
27        return RegistryEditException::unreachable($this->entityId, $detail, $previous);
28    }
29
30    public function createOverloadedFailure(string $detail): RegistryEditException
31    {
32        return RegistryEditException::createForReason(RegistryEditError::Overloaded, entityId: $this->entityId->value, detail: $detail);
33    }
34}