@@ 124-141 (lines=18) @@ | ||
121 | * @param MessageBuilder $builder |
|
122 | * @return array|null |
|
123 | */ |
|
124 | private function mapAttachments(array $attachments, MessageBuilder $builder) |
|
125 | { |
|
126 | foreach ($attachments as $attachment) { |
|
127 | if ($attachment->getContentId()) { |
|
128 | continue; |
|
129 | } |
|
130 | ||
131 | if ($attachment->getPath()) { |
|
132 | $file = $attachment->getPath(); |
|
133 | } elseif ($attachment->getContent()) { |
|
134 | $this->addTmpfile($file = tmpfile()); |
|
135 | fwrite($file, $attachment->getContent()); |
|
136 | } else { |
|
137 | continue; |
|
138 | } |
|
139 | $builder->addAttachment($file, $attachment->getName()); |
|
140 | } |
|
141 | } |
|
142 | ||
143 | /** |
|
144 | * @param AttachmentInterface[]|array|null $attachments |
|
@@ 148-165 (lines=18) @@ | ||
145 | * @param MessageBuilder $builder |
|
146 | * @return array|null |
|
147 | */ |
|
148 | private function mapInlineAttachments(array $attachments, MessageBuilder $builder) |
|
149 | { |
|
150 | foreach ($attachments as $attachment) { |
|
151 | if (!$attachment->getContentId()) { |
|
152 | continue; |
|
153 | } |
|
154 | ||
155 | if ($attachment->getPath()) { |
|
156 | $file = $attachment->getPath(); |
|
157 | } elseif ($attachment->getContent()) { |
|
158 | $this->addTmpfile($file = tmpfile()); |
|
159 | fwrite($file, $attachment->getContent()); |
|
160 | } else { |
|
161 | continue; |
|
162 | } |
|
163 | $builder->addInlineImage($file, $attachment->getContentId()); |
|
164 | } |
|
165 | } |
|
166 | ||
167 | /** |
|
168 | * @param array $emails |