1 | <?php |
||
35 | class Part implements MimePartInterface |
||
36 | { |
||
37 | |||
38 | /** |
||
39 | * @var \Zend\Mime\Part |
||
40 | */ |
||
41 | protected $mimePart; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $template; |
||
47 | |||
48 | /** |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $data; |
||
52 | |||
53 | /** |
||
54 | * @var TemplateEngineInterface |
||
55 | */ |
||
56 | protected $templateEngine; |
||
57 | |||
58 | /** |
||
59 | * To load content from twig templates |
||
60 | */ |
||
61 | use ContentFromTemplateMethods; |
||
62 | |||
63 | /** |
||
64 | * Part |
||
65 | * |
||
66 | * Loads a template or a file for this part |
||
67 | * |
||
68 | * @param string $template |
||
69 | * @param array $data |
||
70 | * |
||
71 | */ |
||
72 | 12 | public function __construct($template, $data = []) |
|
81 | |||
82 | /** |
||
83 | * Magic method to handle Zend\Mime\Part method calls |
||
84 | * |
||
85 | * @param string $name |
||
86 | * @param array $arguments |
||
87 | * |
||
88 | * @return mixed |
||
89 | */ |
||
90 | 6 | public function __call($name, $arguments) |
|
101 | |||
102 | /** |
||
103 | * Get content from template |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | 12 | protected function processTemplate() |
|
114 | |||
115 | /** |
||
116 | * Set type |
||
117 | * |
||
118 | * @param string $type |
||
119 | * |
||
120 | * @return MimePartInterface |
||
121 | * |
||
122 | * @codeCoverageIgnore |
||
123 | */ |
||
124 | public function setType($type = Mime::TYPE_OCTETSTREAM) |
||
129 | |||
130 | /** |
||
131 | * Set id |
||
132 | * |
||
133 | * @param string $id |
||
134 | * |
||
135 | * @return MimePartInterface |
||
136 | * |
||
137 | * @codeCoverageIgnore |
||
138 | */ |
||
139 | public function setId($id) |
||
144 | |||
145 | /** |
||
146 | * Set disposition |
||
147 | * |
||
148 | * @param string $disposition |
||
149 | * |
||
150 | * @return MimePartInterface |
||
151 | * |
||
152 | * @codeCoverageIgnore |
||
153 | */ |
||
154 | public function setDisposition($disposition) |
||
159 | |||
160 | /** |
||
161 | * Set description |
||
162 | * |
||
163 | * @param string $description |
||
164 | * |
||
165 | * @return MimePartInterface |
||
166 | * |
||
167 | * @codeCoverageIgnore |
||
168 | */ |
||
169 | public function setDescription($description) |
||
174 | |||
175 | /** |
||
176 | * Set filename |
||
177 | * |
||
178 | * @param string $fileName |
||
179 | * |
||
180 | * @return MimePartInterface |
||
181 | * |
||
182 | * @codeCoverageIgnore |
||
183 | */ |
||
184 | public function setFileName($fileName) |
||
189 | |||
190 | /** |
||
191 | * Set charset |
||
192 | * |
||
193 | * @param string $charset |
||
194 | * |
||
195 | * @return MimePartInterface |
||
196 | * |
||
197 | * @codeCoverageIgnore |
||
198 | */ |
||
199 | public function setCharset($charset) |
||
204 | |||
205 | /** |
||
206 | * Set boundary |
||
207 | * |
||
208 | * @param string $boundary |
||
209 | * |
||
210 | * @return MimePartInterface |
||
211 | * |
||
212 | * @codeCoverageIgnore |
||
213 | */ |
||
214 | public function setBoundary($boundary) |
||
219 | |||
220 | /** |
||
221 | * Set location |
||
222 | * |
||
223 | * @param string $location |
||
224 | * |
||
225 | * @return MimePartInterface |
||
226 | * |
||
227 | * @codeCoverageIgnore |
||
228 | */ |
||
229 | public function setLocation($location) |
||
234 | |||
235 | /** |
||
236 | * Set language |
||
237 | * |
||
238 | * @param string $language |
||
239 | * |
||
240 | * @return MimePartInterface |
||
241 | * |
||
242 | * @codeCoverageIgnore |
||
243 | */ |
||
244 | public function setLanguage($language) |
||
249 | |||
250 | /** |
||
251 | * Return the headers for this part as a string |
||
252 | * |
||
253 | * @param string $eol |
||
254 | * |
||
255 | * @return String |
||
256 | * |
||
257 | * @codeCoverageIgnore |
||
258 | */ |
||
259 | public function getHeaders($eol = Mime::LINEEND) |
||
263 | |||
264 | /** |
||
265 | * Get the Content of the current Mime Part in the given encoding. |
||
266 | * |
||
267 | * @param string $eol |
||
268 | * @return string |
||
269 | * |
||
270 | * @codeCoverageIgnore |
||
271 | */ |
||
272 | public function getContent($eol = Mime::LINEEND) |
||
276 | } |