Code Duplication    Length = 8-8 lines in 2 locations

src/Transport/SendgridTransport.php 1 location

@@ 163-170 (lines=8) @@
160
     */
161
    protected function setSmtpApi(&$data, Swift_Mime_Message $message)
162
    {
163
        foreach ($message->getChildren() as $attachment) {
164
            if (!$attachment instanceof Swift_Image
165
                || !in_array(self::SMTP_API_NAME, [$attachment->getFilename(), $attachment->getContentType()])
166
            ) {
167
                continue;
168
            }
169
            $data['x-smtpapi'] = json_encode($attachment->getBody());
170
        }
171
    }
172
}
173

src/Transport/SendgridV3Transport.php 1 location

@@ 206-213 (lines=8) @@
203
        $this->numberOfRecipients = 0;
204
205
        $smtp_api = [];
206
        foreach ($message->getChildren() as $attachment) {
207
            if (!$attachment instanceof Swift_Image
208
                || !in_array(self::SMTP_API_NAME, [$attachment->getFilename(), $attachment->getContentType()])
209
            ) {
210
                continue;
211
            }
212
            $smtp_api = $attachment->getBody();
213
        }
214
215
        if (!is_array($smtp_api)) {
216
            return $data;