for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace h4kuna\MailManager\Message;
use Nette\Mail;
class MessageFactory implements IMessageFactory
{
/** @var string */
private $from;
private $returnPath;
public function __construct(string $from, string $returnPath)
$this->from = $from;
$this->returnPath = $returnPath;
}
public function create(): Mail\Message
$message = new Mail\Message;
$this->bindFrom($message);
$this->bindReturnPath($message);
return $message;
public function createSystemMessage(): SystemMessage
$message = new SystemMessage;
private function bindFrom(Mail\Message $message): void
if ($this->from !== '') {
$message->setFrom($this->from);
private function bindReturnPath(Mail\Message $message): void
if ($this->returnPath !== '') {
$message->setReturnPath($this->returnPath);