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

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