Code Duplication    Length = 8-8 lines in 2 locations

src/Transport/SendgridTransport.php 1 location

@@ 151-158 (lines=8) @@
148
     */
149
    protected function setSmtpApi(&$data, Swift_Mime_Message $message)
150
    {
151
        foreach ($message->getChildren() as $attachment) {
152
            if (!$attachment instanceof Swift_Image
153
                || !in_array(self::SMTP_API_NAME, [$attachment->getFilename(), $attachment->getContentType()])
154
            ) {
155
                continue;
156
            }
157
            $data['x-smtpapi'] = json_encode($attachment->getBody());
158
        }
159
    }
160
}
161

src/Transport/SendgridV3Transport.php 1 location

@@ 187-194 (lines=8) @@
184
    protected function setParameters(Swift_Mime_Message $message, $data)
185
    {
186
        $smtp_api = [];
187
        foreach ($message->getChildren() as $attachment) {
188
            if (!$attachment instanceof Swift_Image
189
                || !in_array(self::SMTP_API_NAME, [$attachment->getFilename(), $attachment->getContentType()])
190
            ) {
191
                continue;
192
            }
193
            $smtp_api = $attachment->getBody();
194
        }
195
196
        if (!is_array($smtp_api)) {
197
            return $data;