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

@@ 170-177 (lines=8) @@
167
    protected function setParameters(Swift_Mime_Message $message, $data)
168
    {
169
        $smtp_api = [];
170
        foreach ($message->getChildren() as $attachment) {
171
            if (!$attachment instanceof Swift_Image
172
                || !in_array(self::SMTP_API_NAME, [$attachment->getFilename(), $attachment->getContentType()])
173
            ) {
174
                continue;
175
            }
176
            $smtp_api = $attachment->getBody();
177
        }
178
179
        if (!is_array($smtp_api)) {
180
            return $data;