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

' . $this->title . '

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