From c4cb72731e8cf0eadce93df13bd593bf7c6db92a Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Tue, 24 Aug 2021 09:49:58 -0400 Subject: [PATCH] Refactor attributeCallback to function createAttribute --- app/controllers/api/database.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 3175287335..2dd5c3f0e7 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -42,7 +42,7 @@ use DeviceDetector\DeviceDetector; * * @return Document Newly created attribute document */ -function attributesCallback($collectionId, $attribute, $response, $dbForInternal, $database, $audits): Document +function createAttribute($collectionId, $attribute, $response, $dbForInternal, $database, $audits): Document { $attributeId = $attribute->getId(); @@ -473,7 +473,7 @@ App::post('/v1/database/collections/:collectionId/attributes/string') throw new Exception($validator->getDescription(), 400); } - $attribute = attributesCallback($collectionId, new Document([ + $attribute = createAttribute($collectionId, new Document([ '$id' => $attributeId, 'type' => Database::VAR_STRING, 'size' => $size, @@ -512,7 +512,7 @@ App::post('/v1/database/collections/:collectionId/attributes/email') /** @var Appwrite\Event\Event $database */ /** @var Appwrite\Event\Event $audits */ - $attribute = attributesCallback($collectionId, new Document([ + $attribute = createAttribute($collectionId, new Document([ '$id' => $attributeId, 'type' => Database::VAR_STRING, 'size' => 254, @@ -552,7 +552,7 @@ App::post('/v1/database/collections/:collectionId/attributes/ip') /** @var Appwrite\Event\Event $database */ /** @var Appwrite\Event\Event $audits */ - $attribute = attributesCallback($collectionId, new Document([ + $attribute = createAttribute($collectionId, new Document([ '$id' => $attributeId, 'type' => Database::VAR_STRING, 'size' => 39, @@ -592,7 +592,7 @@ App::post('/v1/database/collections/:collectionId/attributes/url') /** @var Appwrite\Event\Event $database */ /** @var Appwrite\Event\Event $audits */ - $attribute = attributesCallback($collectionId, new Document([ + $attribute = createAttribute($collectionId, new Document([ '$id' => $attributeId, 'type' => Database::VAR_STRING, 'size' => 2000, @@ -643,7 +643,7 @@ App::post('/v1/database/collections/:collectionId/attributes/integer') throw new Exception($validator->getDescription(), 400); } - $attribute = attributesCallback($collectionId, new Document([ + $attribute = createAttribute($collectionId, new Document([ '$id' => $attributeId, 'type' => Database::VAR_INTEGER, 'size' => 0, @@ -698,7 +698,7 @@ App::post('/v1/database/collections/:collectionId/attributes/float') throw new Exception($validator->getDescription(), 400); } - $attribute = attributesCallback($collectionId, new Document([ + $attribute = createAttribute($collectionId, new Document([ '$id' => $attributeId, 'type' => Database::VAR_FLOAT, 'required' => $required, @@ -742,7 +742,7 @@ App::post('/v1/database/collections/:collectionId/attributes/boolean') /** @var Appwrite\Event\Event $database */ /** @var Appwrite\Event\Event $audits */ - $attribute = attributesCallback($collectionId, new Document([ + $attribute = createAttribute($collectionId, new Document([ '$id' => $attributeId, 'type' => Database::VAR_BOOLEAN, 'size' => 0,