1 | <?php |
||
8 | final class MessageFactory |
||
9 | { |
||
10 | /** |
||
11 | * @var array|string |
||
12 | */ |
||
13 | private $sender = []; |
||
14 | |||
15 | /** |
||
16 | * @var array|string |
||
17 | */ |
||
18 | private $replyTo = []; |
||
19 | |||
20 | /** |
||
21 | * @var array|string |
||
22 | */ |
||
23 | private $to = []; |
||
24 | |||
25 | /** |
||
26 | * @var EngineInterface |
||
27 | */ |
||
28 | private $template; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $templatePath; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $cssPath; |
||
39 | |||
40 | /** |
||
41 | * MessageFactory constructor. |
||
42 | * |
||
43 | * @param EngineInterface $template |
||
44 | * @param string $templatePath |
||
45 | * @param string $cssPath |
||
46 | */ |
||
47 | 5 | public function __construct(EngineInterface $template, $templatePath, $cssPath) |
|
53 | |||
54 | /** |
||
55 | * Set the default sender |
||
56 | * |
||
57 | * @param string $email |
||
58 | * @param string|null $name |
||
59 | */ |
||
60 | 1 | public function setDefaultSender($email, $name = null) |
|
68 | |||
69 | /** |
||
70 | * Set the default reply-to |
||
71 | * |
||
72 | * @param string $email |
||
73 | * @param string|null $name |
||
74 | */ |
||
75 | 1 | public function setDefaultReplyTo($email, $name = null) |
|
83 | |||
84 | /** |
||
85 | * Set the default to |
||
86 | * |
||
87 | * @param string $email |
||
88 | * @param string|null $name |
||
89 | */ |
||
90 | 1 | public function setDefaultTo($email, $name = null) |
|
98 | |||
99 | /** |
||
100 | * Create a message |
||
101 | * |
||
102 | * @param string|null $subject |
||
103 | * @param string|null $html |
||
104 | * @param string|null $alternative |
||
105 | * @return \Swift_Message |
||
106 | */ |
||
107 | 2 | private function createMessage($subject = null, $html = null, $alternative = null) |
|
134 | |||
135 | /** |
||
136 | * Create a HTML message |
||
137 | * |
||
138 | * If no alternative is provided it will be generated automatically. |
||
139 | * This is just an alias for createMessage |
||
140 | * |
||
141 | * @param string|null $subject |
||
142 | * @param string|null $html |
||
143 | * @param string|null $plainText |
||
144 | * @return \Swift_Message |
||
145 | */ |
||
146 | 1 | public function createHtmlMessage($subject = null, $html = null, $plainText = null) |
|
150 | |||
151 | /** |
||
152 | * Create a plain text message |
||
153 | * |
||
154 | * @param string|null $subject |
||
155 | * @param string|null $body |
||
156 | * @return \Swift_Message |
||
157 | */ |
||
158 | 1 | public function createPlainTextMessage($subject = null, $body = null) |
|
162 | |||
163 | /** |
||
164 | * @return \Swift_Message |
||
165 | */ |
||
166 | 4 | public function createDefaultMessage() |
|
184 | |||
185 | /** |
||
186 | * Wrap the given content in a nice default email template |
||
187 | * |
||
188 | * @param string $content |
||
189 | * @return string |
||
190 | */ |
||
191 | 1 | public function wrapInTemplate($content) |
|
209 | |||
210 | /** |
||
211 | * Convert the given content from HTML to Plain text |
||
212 | * |
||
213 | * @param string $content |
||
214 | * @return string |
||
215 | */ |
||
216 | 2 | public function convertToPlainText($content) |
|
251 | } |
||
252 |