refactor: improvemets
All checks were successful
Build Test / test (pull_request) Successful in 1m44s
JS Unit Tests / test (pull_request) Successful in 1m45s
PHP Unit Tests / test (pull_request) Successful in 2m24s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-03-24 19:12:26 -04:00
parent 3e899a50bd
commit 4730b75a05
11 changed files with 1730 additions and 20 deletions

View File

@@ -99,17 +99,21 @@ class Provider implements ProviderServiceMutateInterface, ProviderServiceDiscove
public function serviceList(string $tenantId, string $userId, array $filter = []): array
{
$list = $this->serviceStore->list($tenantId, $userId, $filter);
foreach ($list as $entry) {
$service = new Service();
$service->fromStore($entry);
$list[$service->identifier()] = $service;
foreach ($list as $serviceData) {
$serviceInstance = $this->serviceFresh()->fromStore($serviceData);
$list[$serviceInstance->identifier()] = $serviceInstance;
}
return $list;
}
public function serviceFetch(string $tenantId, string $userId, string|int $identifier): ?Service
{
return $this->serviceStore->fetch($tenantId, $userId, $identifier);
$serviceData = $this->serviceStore->fetch($tenantId, $userId, $identifier);
if ($serviceData === null) {
return null;
}
$serviceInstance = $this->serviceFresh()->fromStore($serviceData);
return $serviceInstance;
}
public function serviceFindByAddress(string $tenantId, string $userId, string $address): ?Service
@@ -129,7 +133,7 @@ class Provider implements ProviderServiceMutateInterface, ProviderServiceDiscove
return $this->serviceStore->extant($tenantId, $userId, $identifiers);
}
public function serviceFresh(): ResourceServiceMutateInterface
public function serviceFresh(): Service
{
return new Service();
}
@@ -141,7 +145,7 @@ class Provider implements ProviderServiceMutateInterface, ProviderServiceDiscove
}
$created = $this->serviceStore->create($tenantId, $userId, $service);
return (string) $created->identifier();
return (string) $created['id'];
}
public function serviceModify(string $tenantId, string $userId, ResourceServiceMutateInterface $service): string
@@ -151,7 +155,7 @@ class Provider implements ProviderServiceMutateInterface, ProviderServiceDiscove
}
$updated = $this->serviceStore->modify($tenantId, $userId, $service);
return (string) $updated->identifier();
return (string) $updated['id'];
}
public function serviceDestroy(string $tenantId, string $userId, ResourceServiceMutateInterface $service): bool