1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-04 20:27:31 +02:00

Getter for SwiftMailerHandler subject formatter

This commit is contained in:
Sergey Zaika
2018-06-12 00:55:44 +03:00
committed by Jordi Boggiano
parent 120c434db9
commit 6e1793e966

View File

@@ -12,6 +12,7 @@
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\LineFormatter;
use Swift;
@@ -47,6 +48,17 @@ class SwiftMailerHandler extends MailHandler
$this->mailer->send($this->buildMessage($content, $records));
}
/**
* Gets the formatter for the Swift_Message subject.
*
* @param string $format The format of the subject
* @return FormatterInterface
*/
protected function getSubjectFormatter($format)
{
return new LineFormatter($format);
}
/**
* Creates instance of Swift_Message to be sent
*
@@ -69,7 +81,7 @@ class SwiftMailerHandler extends MailHandler
}
if ($records) {
$subjectFormatter = new LineFormatter($message->getSubject());
$subjectFormatter = $this->getSubjectFormatter($message->getSubject());
$message->setSubject($subjectFormatter->format($this->getHighestRecord($records)));
}