From 6a035bd0a0ea3f7a8811a2a970dcb22450fa26e0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 25 Oct 2017 09:26:57 +0200 Subject: Move attachment creators to mailer class Signed-off-by: Joas Schilling --- lib/private/Mail/Mailer.php | 22 ++++++++++++++++++++++ lib/private/Mail/Message.php | 21 --------------------- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'lib/private/Mail') diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index 43fdb07b810..ad59d640b3e 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -26,6 +26,7 @@ use OCP\Defaults; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\Mail\IAttachment; use OCP\Mail\IEMailTemplate; use OCP\Mail\IMailer; use OCP\ILogger; @@ -91,6 +92,27 @@ class Mailer implements IMailer { return new Message(new \Swift_Message()); } + /** + * @param string|null $data + * @param string|null $filename + * @param string|null $contentType + * @return IAttachment + * @since 13.0.0 + */ + public function createAttachment($data = null, $filename = null, $contentType = null) { + return new Attachment(\Swift_Attachment::newInstance($data, $filename, $contentType)); + } + + /** + * @param string $path + * @param string|null $contentType + * @return IAttachment + * @since 13.0.0 + */ + public function createAttachmentFromPath($path, $contentType = null) { + return new Attachment(\Swift_Attachment::fromPath($path, $contentType)); + } + /** * Creates a new email template object * diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index fb16c59c51e..dcd4a66e996 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -44,27 +44,6 @@ class Message implements IMessage { $this->swiftMessage = $swiftMessage; } - /** - * @param string|null $data - * @param string|null $filename - * @param string|null $contentType - * @return IAttachment - * @since 13.0.0 - */ - public function createAttachment($data = null, $filename = null, $contentType = null) { - return new Attachment(\Swift_Attachment::newInstance($data, $filename, $contentType)); - } - - /** - * @param string $path - * @param string|null $contentType - * @return IAttachment - * @since 13.0.0 - */ - public function createAttachmentFromPath($path, $contentType = null) { - return new Attachment(\Swift_Attachment::fromPath($path, $contentType)); - } - /** * @param IAttachment $attachment * @return $this -- cgit v1.2.3