From ca1c83c2cf68a839f11a470034ff003959ee3e29 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sat, 24 Feb 2024 14:33:38 +0000 Subject: [PATCH 1/3] method to reset attachment --- src/Appwrite/Event/Mail.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Appwrite/Event/Mail.php b/src/Appwrite/Event/Mail.php index ca8fe7d202..bbd05a018f 100644 --- a/src/Appwrite/Event/Mail.php +++ b/src/Appwrite/Event/Mail.php @@ -338,6 +338,14 @@ class Mail extends Event return $this; } + /** + * Set attachment + * @param string $content + * @param string $filename + * @param string $encoding + * @param string $type + * @return self + */ public function setAttachment(string $content, string $filename, string $encoding = 'base64', string $type = 'plain/text') { $this->attachment = [ @@ -349,11 +357,27 @@ class Mail extends Event return $this; } + /** + * Get attachment + * + * @return array + */ public function getAttachment(): array { return $this->attachment; } + /** + * Reset attachment + * + * @return self + */ + public function resetAttachment(): self + { + $this->attachment = []; + return $this; + } + /** * Executes the event and sends it to the mails worker. * From ea484e593b9325e99e1dd45ed8a374595074d7c1 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sat, 24 Feb 2024 14:49:17 +0000 Subject: [PATCH 2/3] format --- src/Appwrite/Event/Mail.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Event/Mail.php b/src/Appwrite/Event/Mail.php index bbd05a018f..ac021e71a2 100644 --- a/src/Appwrite/Event/Mail.php +++ b/src/Appwrite/Event/Mail.php @@ -359,7 +359,7 @@ class Mail extends Event /** * Get attachment - * + * * @return array */ public function getAttachment(): array @@ -369,7 +369,7 @@ class Mail extends Event /** * Reset attachment - * + * * @return self */ public function resetAttachment(): self From d91a0e30481b0ade36ec837c866baf038124b91a Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sat, 24 Feb 2024 14:56:53 +0000 Subject: [PATCH 3/3] reset variables --- src/Appwrite/Event/Mail.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Appwrite/Event/Mail.php b/src/Appwrite/Event/Mail.php index ac021e71a2..6ded33e02e 100644 --- a/src/Appwrite/Event/Mail.php +++ b/src/Appwrite/Event/Mail.php @@ -378,6 +378,23 @@ class Mail extends Event return $this; } + /** + * Reset + * + * @return self + */ + public function reset(): self + { + $this->project = null; + $this->recipient = ''; + $this->name = ''; + $this->subject = ''; + $this->body = ''; + $this->variables = []; + $this->bodyTemplate = ''; + $this->attachment = []; + } + /** * Executes the event and sends it to the mails worker. *