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

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