@@ 103-117 (lines=15) @@ | ||
100 | * @return $this |
|
101 | * @throws \AcMailer\Exception\InvalidArgumentException |
|
102 | */ |
|
103 | public function setTemplate($template) |
|
104 | { |
|
105 | if (is_array($template)) { |
|
106 | $this->template = new TemplateOptions($template); |
|
107 | } elseif ($template instanceof TemplateOptions) { |
|
108 | $this->template = $template; |
|
109 | } else { |
|
110 | throw new InvalidArgumentException(sprintf( |
|
111 | 'Template should be an array or an AcMailer\Options\TemplateOptions object. %s provided.', |
|
112 | is_object($template) ? get_class($template) : gettype($template) |
|
113 | )); |
|
114 | } |
|
115 | ||
116 | return $this; |
|
117 | } |
|
118 | } |
|
119 |
@@ 115-129 (lines=15) @@ | ||
112 | * @return $this |
|
113 | * @throws \AcMailer\Exception\InvalidArgumentException |
|
114 | */ |
|
115 | public function setMessageOptions($messageOptions) |
|
116 | { |
|
117 | if (is_array($messageOptions)) { |
|
118 | $this->messageOptions = new MessageOptions($messageOptions); |
|
119 | } elseif ($messageOptions instanceof MessageOptions) { |
|
120 | $this->messageOptions = $messageOptions; |
|
121 | } else { |
|
122 | throw new InvalidArgumentException(sprintf( |
|
123 | 'MessageOptions should be an array or an AcMailer\Options\MessageOptions object. %s provided.', |
|
124 | is_object($messageOptions) ? get_class($messageOptions) : gettype($messageOptions) |
|
125 | )); |
|
126 | } |
|
127 | ||
128 | return $this; |
|
129 | } |
|
130 | ||
131 | /** |
|
132 | * @return SmtpOptions |
|
@@ 147-161 (lines=15) @@ | ||
144 | * @param SmtpOptions|array $smtpOptions |
|
145 | * @return $this |
|
146 | */ |
|
147 | public function setSmtpOptions($smtpOptions) |
|
148 | { |
|
149 | if (is_array($smtpOptions)) { |
|
150 | $this->smtpOptions = new SmtpOptions($smtpOptions); |
|
151 | } elseif ($smtpOptions instanceof SmtpOptions) { |
|
152 | $this->smtpOptions = $smtpOptions; |
|
153 | } else { |
|
154 | throw new InvalidArgumentException(sprintf( |
|
155 | 'SmtpOptions should be an array or an Zend\Mail\Transport\SmtpOptions object. %s provided.', |
|
156 | is_object($smtpOptions) ? get_class($smtpOptions) : gettype($smtpOptions) |
|
157 | )); |
|
158 | } |
|
159 | ||
160 | return $this; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * @return FileOptions |
|
@@ 179-193 (lines=15) @@ | ||
176 | * @param FileOptions|array $fileOptions |
|
177 | * @return $this |
|
178 | */ |
|
179 | public function setFileOptions($fileOptions) |
|
180 | { |
|
181 | if (is_array($fileOptions)) { |
|
182 | $this->fileOptions = new FileOptions($fileOptions); |
|
183 | } elseif ($fileOptions instanceof FileOptions) { |
|
184 | $this->fileOptions = $fileOptions; |
|
185 | } else { |
|
186 | throw new InvalidArgumentException(sprintf( |
|
187 | 'FileOptions should be an array or an Zend\Mail\Transport\FileOptions object. %s provided.', |
|
188 | is_object($fileOptions) ? get_class($fileOptions) : gettype($fileOptions) |
|
189 | )); |
|
190 | } |
|
191 | ||
192 | return $this; |
|
193 | } |
|
194 | ||
195 | /** |
|
196 | * @return array |
@@ 217-231 (lines=15) @@ | ||
214 | * @param BodyOptions|array $body |
|
215 | * @return $this |
|
216 | */ |
|
217 | public function setBody($body) |
|
218 | { |
|
219 | if (is_array($body)) { |
|
220 | $this->body = new BodyOptions($body); |
|
221 | } elseif ($body instanceof BodyOptions) { |
|
222 | $this->body = $body; |
|
223 | } else { |
|
224 | throw new InvalidArgumentException(sprintf( |
|
225 | 'Body should be an array or an AcMailer\\Options\\BodyOptions, %s provided', |
|
226 | is_object($body) ? get_class($body) : gettype($body) |
|
227 | )); |
|
228 | } |
|
229 | ||
230 | return $this; |
|
231 | } |
|
232 | ||
233 | /** |
|
234 | * @return AttachmentsOptions |
|
@@ 249-263 (lines=15) @@ | ||
246 | * @param AttachmentsOptions|array $attachments |
|
247 | * @return $this |
|
248 | */ |
|
249 | public function setAttachments($attachments) |
|
250 | { |
|
251 | if (is_array($attachments)) { |
|
252 | $this->attachments = new AttachmentsOptions($attachments); |
|
253 | } elseif ($attachments instanceof AttachmentsOptions) { |
|
254 | $this->attachments = $attachments; |
|
255 | } else { |
|
256 | throw new InvalidArgumentException(sprintf( |
|
257 | 'Attachments should be an array or an AcMailer\\Options\\AttachmentsOptions, %s provided', |
|
258 | is_object($attachments) ? get_class($attachments) : gettype($attachments) |
|
259 | )); |
|
260 | } |
|
261 | ||
262 | return $this; |
|
263 | } |
|
264 | } |
|
265 |