protected function processAttachments(array $attachments)
    {
        $attachments = AttachmentUtils::processAttachments($attachments);
        $processedAttachments = [];

        foreach ($attachments as $name => $attachment) {
            $item = [
                'content'  => base64_encode(file_get_contents($attachment->getPath())),
                'type'     => $attachment->getType(),
                'filename' => $attachment->getName(),
            ];

            $id = $attachment->getId();
            if (!empty($id)) {
                $item['disposition'] = 'inline';
                $item['content_id'] = $id;
            }

            $processedAttachments[] = $item;
        }

        return $processedAttachments;
    }
protected function processAttachments(array $attachments)
    {
        $attachments = AttachmentUtils::processAttachments($attachments);
        $processedAttachments = [];

        foreach ($attachments as $name => $attachment) {
            $item = [
                'content'  => base64_encode(file_get_contents($attachment->getPath())),
                'type'     => $attachment->getType(),
                'filename' => $attachment->getName(),
            ];

            $id = $attachment->getId();
            if (!empty($id)) {
                $item['disposition'] = 'inline';
                $item['content_id'] = $id;
            }

            $processedAttachments[] = $item;
        }

        return $processedAttachments;
    }
protected function processAttachments ( array $ attachments ) { $ attachments = AttachmentUtils :: processAttachments ( $ attachments ) ; $ processedAttachments = [ ] ; foreach ( $ attachments as $ name => $ attachment ) { $ item = [ 'content' => base64_encode ( file_get_contents ( $ attachment -> getPath ( ) ) ) , 'type' => $ attachment -> getType ( ) , 'filename' => $ attachment -> getName ( ) , ] ; $ id = $ attachment -> getId ( ) ; if ( ! empty ( $ id ) ) { $ item [ 'disposition' ] = 'inline' ; $ item [ 'content_id' ] = $ id ; } $ processedAttachments [ ] = $ item ; } return $ processedAttachments ; }
@param Attachment[] $attachments

@return array First element: All attachments – array(name => path). Second element: Inline attachments – array(id => name)
@param Attachment [] $attachments