mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Method 'MessageInterface::__toString()' added
This commit is contained in:
@ -48,6 +48,14 @@ class Message extends BaseMessage
|
|||||||
$this->getSwiftMessage()->setReplyTo($from);
|
$this->getSwiftMessage()->setReplyTo($from);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string from address of this message.
|
||||||
|
*/
|
||||||
|
public function getFrom()
|
||||||
|
{
|
||||||
|
return $this->getSwiftMessage()->getFrom();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -56,6 +64,14 @@ class Message extends BaseMessage
|
|||||||
$this->getSwiftMessage()->setTo($to);
|
$this->getSwiftMessage()->setTo($to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array To addresses of this message.
|
||||||
|
*/
|
||||||
|
public function getTo()
|
||||||
|
{
|
||||||
|
return $this->getSwiftMessage()->getTo();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -64,6 +80,14 @@ class Message extends BaseMessage
|
|||||||
$this->getSwiftMessage()->setCc($cc);
|
$this->getSwiftMessage()->setCc($cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array Cc address of this message.
|
||||||
|
*/
|
||||||
|
public function getCc()
|
||||||
|
{
|
||||||
|
return $this->getSwiftMessage()->getCc();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -72,6 +96,14 @@ class Message extends BaseMessage
|
|||||||
$this->getSwiftMessage()->setBcc($bcc);
|
$this->getSwiftMessage()->setBcc($bcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array Bcc addresses of this message.
|
||||||
|
*/
|
||||||
|
public function getBcc()
|
||||||
|
{
|
||||||
|
return $this->getSwiftMessage()->getBcc();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -80,6 +112,14 @@ class Message extends BaseMessage
|
|||||||
$this->getSwiftMessage()->setSubject($subject);
|
$this->getSwiftMessage()->setSubject($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the subject of this message.
|
||||||
|
*/
|
||||||
|
public function getSubject()
|
||||||
|
{
|
||||||
|
return $this->getSwiftMessage()->getSubject();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -123,4 +163,12 @@ class Message extends BaseMessage
|
|||||||
$attachment = \Swift_Attachment::newInstance($content, $fileName, $contentType);
|
$attachment = \Swift_Attachment::newInstance($content, $fileName, $contentType);
|
||||||
$this->getSwiftMessage()->attach($attachment);
|
$this->getSwiftMessage()->attach($attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return $this->getSwiftMessage()->toString();
|
||||||
|
}
|
||||||
}
|
}
|
@ -113,4 +113,11 @@ interface MessageInterface
|
|||||||
* @return string string the rendering result
|
* @return string string the rendering result
|
||||||
*/
|
*/
|
||||||
public function render($view, $params = []);
|
public function render($view, $params = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String output.
|
||||||
|
* This is PHP magic method that returns string representation of an object.
|
||||||
|
* @return string the string representation of the object
|
||||||
|
*/
|
||||||
|
public function __toString();
|
||||||
}
|
}
|
@ -188,4 +188,9 @@ class Message extends BaseMessage
|
|||||||
public function addHtml($html) {}
|
public function addHtml($html) {}
|
||||||
|
|
||||||
public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream') {}
|
public function attachContentAsFile($content, $fileName, $contentType = 'application/octet-stream') {}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return get_class($this);
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user