. */ namespace SP\Core\Messages; /** * Class MailMessage * * @package SP\Core\Messages */ final class MailMessage extends MessageBase implements MessageInterface { /** * Adds a blank description line */ public function addDescriptionLine() { $this->description[] = ''; } /** * Componer un mensaje en formato HTML * * @return string */ public function composeHtml() { $formatter = new HtmlFormatter(); $message = '
'; $message .= '

' . $this->title . '

'; $message .= '
' . $this->getDescription($formatter, true) . '
'; $message .= ''; $message .= '
'; return $message; } /** * @param FormatterInterface $formatter * @param bool $translate * * @return string */ public function getDescription(FormatterInterface $formatter, $translate = false): string { return $formatter->formatDescription($this->description, $translate); } /** * Componer un mensaje en formato texto * * @param string $delimiter * * @return string */ public function composeText($delimiter = PHP_EOL) { $formatter = new TextFormatter($delimiter); return $this->title . $delimiter . $formatter->formatDescription($this->description) . $delimiter . implode($delimiter, $this->footer); } }