Code Duplication    Length = 18-20 lines in 2 locations

src/Mailjet.php 1 location

@@ 133-150 (lines=18) @@
130
        return $finalAttachments;
131
    }
132
133
    private function mapAttachment(AttachmentInterface $attachment)
134
    {
135
        $finalAttachment = [
136
            'Content-type' => $attachment->getMimeType(),
137
            'Filename' => $attachment->getName()
138
        ];
139
        if ($attachment->getPath()) {
140
            $finalAttachment['content'] = base64_encode(file_get_contents($attachment->getPath()));
141
        } elseif ($attachment->getContent()) {
142
            $finalAttachment['content'] = base64_encode($attachment->getContent());
143
        }
144
145
        if ($attachment->getContentId()) {
146
            $finalAttachment['Filename'] = $attachment->getContentId();
147
        }
148
149
        return $finalAttachment;
150
    }
151
152
    /**
153
     * @param array $emails

src/Mandrill.php 1 location

@@ 160-179 (lines=20) @@
157
        return $finalAttachments;
158
    }
159
160
    private function mapAttachment(AttachmentInterface $attachment)
161
    {
162
        $finalAttachment = [
163
            'type' => $attachment->getMimeType(),
164
            'name' => $attachment->getName()
165
        ];
166
        if ($attachment->getPath()) {
167
            $finalAttachment['content'] = base64_encode(file_get_contents($attachment->getPath()));
168
        } elseif ($attachment->getContent()) {
169
            $finalAttachment['content'] = base64_encode($attachment->getContent());
170
        } else {
171
            return null;
172
        }
173
174
        if ($attachment->getContentId()) {
175
            $finalAttachment['name'] = $attachment->getContentId();
176
        }
177
178
        return $finalAttachment;
179
    }
180
181
    /**
182
     * @param array $emails