From 4c220881466dd46a18e828c6e6fe7838f9d9516b Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Thu, 16 Jan 2025 11:30:50 +0900 Subject: [PATCH] Address GraphQL --- src/Appwrite/GraphQL/Schema.php | 42 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/Appwrite/GraphQL/Schema.php b/src/Appwrite/GraphQL/Schema.php index cbef55ef8d..9214bf8e20 100644 --- a/src/Appwrite/GraphQL/Schema.php +++ b/src/Appwrite/GraphQL/Schema.php @@ -105,31 +105,29 @@ class Schema continue; } - $additionalMethods = null; - if (is_array($sdk)) { - $mainSdk = array_shift($sdk); - $additionalMethods = $sdk; - - $sdk = $mainSdk; + if (!\is_array($sdk)) { + $sdk = [$sdk]; } - $namespace = $sdk->getNamespace(); - $method = $sdk->getMethodName(); - $name = $namespace . \ucfirst($method); + foreach ($sdk as $method) { + $namespace = $method->getNamespace(); + $methodName = $method->getMethodName(); + $name = $namespace . \ucfirst($methodName); - foreach (Mapper::route($utopia, $route, $complexity) as $field) { - switch ($route->getMethod()) { - case 'GET': - $queries[$name] = $field; - break; - case 'POST': - case 'PUT': - case 'PATCH': - case 'DELETE': - $mutations[$name] = $field; - break; - default: - throw new \Exception("Unsupported method: {$route->getMethod()}"); + foreach (Mapper::route($utopia, $route, $complexity) as $field) { + switch ($route->getMethod()) { + case 'GET': + $queries[$name] = $field; + break; + case 'POST': + case 'PUT': + case 'PATCH': + case 'DELETE': + $mutations[$name] = $field; + break; + default: + throw new \Exception("Unsupported method: {$route->getMethod()}"); + } } } }