| Total Complexity | 7 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 7 | class MessageFactory implements IMessageFactory |
||
| 8 | { |
||
| 9 | |||
| 10 | /** @var string */ |
||
| 11 | private $from; |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | private $returnPath; |
||
| 15 | |||
| 16 | |||
| 17 | public function __construct(string $from, string $returnPath) |
||
| 21 | } |
||
| 22 | |||
| 23 | |||
| 24 | public function create(): Mail\Message |
||
| 30 | } |
||
| 31 | |||
| 32 | |||
| 33 | public function createSystemMessage(): SystemMessage |
||
| 34 | { |
||
| 35 | $message = new SystemMessage; |
||
| 36 | $this->bindFrom($message); |
||
| 37 | $this->bindReturnPath($message); |
||
| 38 | return $message; |
||
| 39 | } |
||
| 40 | |||
| 41 | |||
| 42 | private function bindFrom(Mail\Message $message): void |
||
| 43 | { |
||
| 44 | if ($this->from !== '') { |
||
| 45 | $message->setFrom($this->from); |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | |||
| 50 | private function bindReturnPath(Mail\Message $message): void |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 58 |