From e802c8fc0ffe555af75c0c899383677c4dab6e37 Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Sat, 5 Sep 2026 17:27:55 -0400 Subject: [PATCH] feat: use ResourceIdentifiers Signed-off-by: Sebastian Krupinski --- lib/Controllers/DefaultController.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/Controllers/DefaultController.php b/lib/Controllers/DefaultController.php index cda1ea9..870f648 100644 --- a/lib/Controllers/DefaultController.php +++ b/lib/Controllers/DefaultController.php @@ -807,19 +807,18 @@ class DefaultController extends ControllerAbstract { private function nodeList(string $tenantId, string $userId, array $data, int $version, string $transaction): StreamedNdJsonResponse { - if (isset($data['sources'])) { - if (!is_array($data['sources'])) { - throw new InvalidArgumentException(self::ERR_INVALID_SOURCES); - } + if (!isset($data['sources'])) { + throw new InvalidArgumentException(self::ERR_MISSING_SOURCES); + } + if (!is_array($data['sources'])) { + throw new InvalidArgumentException(self::ERR_INVALID_SOURCES); + } - $sources = ResourceIdentifiers::fromArray($data['sources']); - foreach ($sources as $source) { - if (!$source instanceof ServiceIdentifier && !$source instanceof CollectionIdentifier) { - throw new InvalidArgumentException('Invalid parameter: sources must contain provider:service or provider:service:collection identifiers'); - } + $sources = ResourceIdentifiers::fromArray($data['sources']); + foreach ($sources as $source) { + if ($source instanceof EntityIdentifier || (!$source instanceof ServiceIdentifier && !$source instanceof CollectionIdentifier)) { + throw new InvalidArgumentException('Invalid parameter: sources must contain provider:service or provider:service:collection identifiers'); } - } else { - $sources = null; } $filter = $data['filter'] ?? null;