Method names "yii\mail\MessageInterface" simplified.

This commit is contained in:
Paul Klimov
2013-11-06 12:28:39 +02:00
parent 28b032737d
commit b0c5981d42
7 changed files with 71 additions and 52 deletions

View File

@@ -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 '';
}
}
}