Lines
100.00%
6 / 6
Methods
100.00%
3 / 3
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| forApp | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| updateEntity | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 2 | ||
| 16 | final readonly class WorkerRegistryEditor implements RegistryEditor | |
| 17 | { | |
| 18 | public function __construct( | |
| 19 | private RegistryEditRequester $requester, | |
| 20 | private ResourceScope $resourceScope, | |
| 21 | ) {} | |
| 22 | ||
| 23 | public function forApp(AppId $appId): self | |
| 24 | { | |
| 25 | return new self($this->requester, ResourceScope::forApp($appId)); | |
| 26 | } | |
| 27 | ||
| 28 | public function updateEntity(EntityId|string $entityId, EntityRegistryUpdate $update): RegisteredEntity | |
| 29 | { | |
| 30 | $entityId = EntityId::fromStringOrId($entityId); | |
| 31 | ||
| 32 | if ($update->isEmpty()) { | |
| 33 | throw RegistryEditException::nothingToUpdate($entityId); | |
| 34 | } | |
| 35 | ||
| 36 | return $this->requester->requestEntityUpdate($this->resourceScope, $entityId, $update); | |
| 37 | } | |
| 38 | } |