From beab655ebab756f3f4e22bb981068c9881f0bcb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 11 May 2026 12:03:48 +0200 Subject: [PATCH] Code quality details --- .../Modules/Projects/Http/Projects/Create.php | 1 - .../Utopia/Response/Model/Project.php | 22 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php index 67cb5ab0fd..d2c92fc65c 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/Projects/Create.php @@ -28,7 +28,6 @@ use Utopia\Pools\Group; use Utopia\System\System; use Utopia\Validator; use Utopia\Validator\Text; -use Utopia\Validator\URL; use Utopia\Validator\WhiteList; class Create extends Action diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index b25fdc51e9..f83ed8e663 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -204,9 +204,9 @@ class Project extends Model public function filter(Document $document): Document { $this->expandSmtpFields($document); - $this->expandServiceFields($document); - $this->expandApiFields($document); - $this->expandAuthFields($document); + $this->expandServices($document); + $this->expandProtocols($document); + $this->expandAuthMethods($document); return $document; } @@ -218,7 +218,7 @@ class Project extends Model } $smtp = $document->getAttribute('smtp', []); - + $document->setAttribute('smtpEnabled', $smtp['enabled'] ?? false); $document->setAttribute('smtpSenderEmail', $smtp['senderEmail'] ?? ''); $document->setAttribute('smtpSenderName', $smtp['senderName'] ?? ''); @@ -231,7 +231,7 @@ class Project extends Model $document->setAttribute('smtpSecure', $smtp['secure'] ?? ''); } - private function expandServiceFields(Document $document): void + private function expandServices(Document $document): void { if (!$document->isSet('services')) { return; @@ -250,11 +250,11 @@ class Project extends Model 'enabled' => $values[$service['key']] ?? true, ]); } - + $document->setAttribute('services', $services); } - private function expandApiFields(Document $document): void + private function expandProtocols(Document $document): void { if (!$document->isSet('apis')) { return; @@ -273,22 +273,22 @@ class Project extends Model $document->setAttribute('protocols', $protocols); } - private function expandAuthFields(Document $document): void + private function expandAuthMethods(Document $document): void { if (!$document->isSet('auths')) { return; } - $authValues = $document->getAttribute('auths', []); + $values = $document->getAttribute('auths', []); $authMethods = []; foreach (Config::getParam('auth', []) as $id => $method) { $authMethods[] = new Document([ '$id' => $id, - 'enabled' => $authValues[$method['key']] ?? true + 'enabled' => $values[$method['key']] ?? true ]); } - + $document->setAttribute('authMethods', $authMethods); } }