Commit 4a9d546c by Paul Klimov

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

parent c7c32659
......@@ -115,7 +115,7 @@ class Message extends BaseMessage
/**
* @inheritdoc
*/
public function createAttachment($content, $fileName, $contentType = 'application/octet-stream')
public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream')
{
if (empty($contentType)) {
$contentType = 'application/octet-stream';
......
......@@ -75,7 +75,7 @@ abstract class BaseMessage extends Object implements MessageInterface
$attachFileName = basename($fileName);
}
$content = file_get_contents($fileName);
$this->createAttachment($content, $attachFileName, $contentType);
$this->attachContentAsFile($content, $attachFileName, $contentType);
}
/**
......
......@@ -82,12 +82,12 @@ interface MessageInterface
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 $fileName attachment file name.
* @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.
......
......@@ -82,7 +82,7 @@ class MessageTest extends VendorTestCase
$message->setFrom('someuser@somedomain.com');
$message->setSubject('Yii Swift Create Attachment Test');
$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());
}
......
......@@ -187,5 +187,5 @@ class Message extends BaseMessage
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