mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 06:48:59 +08:00
Method names "yii\mail\MessageInterface" simplified.
This commit is contained in:
@@ -46,6 +46,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
|
||||
* @var array configuration, which should be applied by default to any new created
|
||||
* email message instance.
|
||||
* In addition to normal [[Yii::createObject()]] behavior extra config keys are available:
|
||||
* - 'charset' argument for [[MessageInterface::charset()]]
|
||||
* - 'from' argument for [[MessageInterface::from()]]
|
||||
* - 'to' argument for [[MessageInterface::to()]]
|
||||
* - 'cc' argument for [[MessageInterface::cc()]]
|
||||
@@ -123,6 +124,7 @@ abstract class BaseMailer extends Component implements MailerInterface, ViewCont
|
||||
$config['class'] = $this->messageClass;
|
||||
}
|
||||
$directSetterNames = [
|
||||
'charset',
|
||||
'from',
|
||||
'to',
|
||||
'cc',
|
||||
|
||||
@@ -21,7 +21,6 @@ use Yii;
|
||||
* @see BaseMailer
|
||||
*
|
||||
* @property \yii\mail\BaseMailer $mailer mailer component instance. This property is read-only.
|
||||
* @property string $charset the character set of this message.
|
||||
*
|
||||
* @author Paul Klimov <klimov.paul@gmail.com>
|
||||
* @since 2.0
|
||||
@@ -77,4 +76,20 @@ abstract class BaseMessage extends Object implements MessageInterface
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP magic method that returns the string representation of this object.
|
||||
* @return string the string representation of this object.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
// __toString cannot throw exception
|
||||
// use trigger_error to bypass this limitation
|
||||
try {
|
||||
return $this->toString();
|
||||
} catch (\Exception $e) {
|
||||
trigger_error($e->getMessage());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ interface MessageInterface
|
||||
* @param string $charset character set name.
|
||||
* @return static self reference.
|
||||
*/
|
||||
public function setCharset($charset);
|
||||
public function charset($charset);
|
||||
|
||||
/**
|
||||
* Sets message sender.
|
||||
@@ -96,6 +96,16 @@ interface MessageInterface
|
||||
*/
|
||||
public function html($html);
|
||||
|
||||
/**
|
||||
* Attaches existing file to the email message.
|
||||
* @param string $fileName full file name
|
||||
* @param array $options options for embed file. Valid options are:
|
||||
* - fileName: name, which should be used to attach file.
|
||||
* - contentType: attached file MIME type.
|
||||
* @return static self reference.
|
||||
*/
|
||||
public function attach($fileName, array $options = []);
|
||||
|
||||
/**
|
||||
* Attach specified content as file for the email message.
|
||||
* @param string $content attachment file content.
|
||||
@@ -106,16 +116,6 @@ interface MessageInterface
|
||||
*/
|
||||
public function attachContent($content, array $options = []);
|
||||
|
||||
/**
|
||||
* Attaches existing file to the email message.
|
||||
* @param string $fileName full file name
|
||||
* @param array $options options for embed file. Valid options are:
|
||||
* - fileName: name, which should be used to attach file.
|
||||
* - contentType: attached file MIME type.
|
||||
* @return static self reference.
|
||||
*/
|
||||
public function attachFile($fileName, array $options = []);
|
||||
|
||||
/**
|
||||
* Attach a file and return it's CID source.
|
||||
* This method should be used when embedding images or other data in a message.
|
||||
@@ -125,7 +125,7 @@ interface MessageInterface
|
||||
* - contentType: attached file MIME type.
|
||||
* @return string attachment CID.
|
||||
*/
|
||||
public function embedFile($fileName, array $options = []);
|
||||
public function embed($fileName, array $options = []);
|
||||
|
||||
/**
|
||||
* Attach a content as file and return it's CID source.
|
||||
@@ -178,9 +178,8 @@ interface MessageInterface
|
||||
public function body($view, $params = []);
|
||||
|
||||
/**
|
||||
* String output.
|
||||
* This is PHP magic method that returns string representation of an object.
|
||||
* @return string the string representation of the object
|
||||
* Returns string representation of this message.
|
||||
* @return string the string representation of this message.
|
||||
*/
|
||||
public function __toString();
|
||||
public function toString();
|
||||
}
|
||||
Reference in New Issue
Block a user