Commit 4a9d546c by Paul Klimov

'MessageInterface::createAttachment()' renamed to 'MessageInterface::attachContentAsFile()'

parent c7c32659
...@@ -115,7 +115,7 @@ class Message extends BaseMessage ...@@ -115,7 +115,7 @@ class Message extends BaseMessage
/** /**
* @inheritdoc * @inheritdoc
*/ */
public function createAttachment($content, $fileName, $contentType = 'application/octet-stream') public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream')
{ {
if (empty($contentType)) { if (empty($contentType)) {
$contentType = 'application/octet-stream'; $contentType = 'application/octet-stream';
......
...@@ -75,7 +75,7 @@ abstract class BaseMessage extends Object implements MessageInterface ...@@ -75,7 +75,7 @@ abstract class BaseMessage extends Object implements MessageInterface
$attachFileName = basename($fileName); $attachFileName = basename($fileName);
} }
$content = file_get_contents($fileName); $content = file_get_contents($fileName);
$this->createAttachment($content, $attachFileName, $contentType); $this->attachContentAsFile($content, $attachFileName, $contentType);
} }
/** /**
......
...@@ -82,12 +82,12 @@ interface MessageInterface ...@@ -82,12 +82,12 @@ interface MessageInterface
public function addHtml($html); public function addHtml($html);
/** /**
* Create file attachment for the email message. * Attach specified content as file for the email message.
* @param string $content attachment file content. * @param string $content attachment file content.
* @param string $fileName attachment file name. * @param string $fileName attachment file name.
* @param string $contentType MIME type of the attachment file, by default 'application/octet-stream' will be used. * @param string $contentType MIME type of the attachment file, by default 'application/octet-stream' will be used.
*/ */
public function createAttachment($content, $fileName, $contentType = 'application/octet-stream'); public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream');
/** /**
* Attaches existing file to the email message. * Attaches existing file to the email message.
......
...@@ -82,7 +82,7 @@ class MessageTest extends VendorTestCase ...@@ -82,7 +82,7 @@ class MessageTest extends VendorTestCase
$message->setFrom('someuser@somedomain.com'); $message->setFrom('someuser@somedomain.com');
$message->setSubject('Yii Swift Create Attachment Test'); $message->setSubject('Yii Swift Create Attachment Test');
$message->setText('Yii Swift Create Attachment Test body'); $message->setText('Yii Swift Create Attachment Test body');
$message->createAttachment('Test attachment content', 'test.txt'); $message->attachContentAsFile('Test attachment content', 'test.txt');
$this->assertTrue($message->send()); $this->assertTrue($message->send());
} }
......
...@@ -187,5 +187,5 @@ class Message extends BaseMessage ...@@ -187,5 +187,5 @@ class Message extends BaseMessage
public function addHtml($html) {} public function addHtml($html) {}
public function createAttachment($content, $fileName, $contentType = 'application/octet-stream') {} public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream') {}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment