public function getAttachments($mail)
    {
        /** @noinspection IsEmptyFunctionUsageInspection */
        if(empty($mail->getId())) {
            return [];
        }
        
        $folderFileList = $this->getMailLocalFolderFileList($mail);

        $attachments = [];
        
        foreach ($folderFileList as $filePath => $fileMetaData) {

            $filePath = $fileMetaData['path'];

            /** @var \Shockwavemk\Mail\Base\Model\Mail\Attachment $attachment */
            $attachment = $this->_objectManager
                ->create('\Shockwavemk\Mail\Base\Model\Mail\Attachment');

            $attachment->setFilePath($filePath);
            $attachment->setMail($mail);

            // transfer all meta data into attachment object
            foreach ($fileMetaData as $attributeKey => $attributeValue) {
                $attachment->setData($attributeKey, $attributeValue);
            }

            $attachments[$filePath] = $attachment;
        }

        return $attachments;
    }
public function getAttachments($mail)
    {
        /** @noinspection IsEmptyFunctionUsageInspection */
        if(empty($mail->getId())) {
            return [];
        }
        
        $folderFileList = $this->getMailLocalFolderFileList($mail);

        $attachments = [];
        
        foreach ($folderFileList as $filePath => $fileMetaData) {

            $filePath = $fileMetaData['path'];

            /** @var \Shockwavemk\Mail\Base\Model\Mail\Attachment $attachment */
            $attachment = $this->_objectManager
                ->create('\Shockwavemk\Mail\Base\Model\Mail\Attachment');

            $attachment->setFilePath($filePath);
            $attachment->setMail($mail);

            // transfer all meta data into attachment object
            foreach ($fileMetaData as $attributeKey => $attributeValue) {
                $attachment->setData($attributeKey, $attributeValue);
            }

            $attachments[$filePath] = $attachment;
        }

        return $attachments;
    }
public function getAttachments ( $ mail ) { /** @noinspection IsEmptyFunctionUsageInspection */ if ( empty ( $ mail -> getId ( ) ) ) { return [ ] ; } $ folderFileList = $ this -> getMailLocalFolderFileList ( $ mail ) ; $ attachments = [ ] ; foreach ( $ folderFileList as $ filePath => $ fileMetaData ) { $ filePath = $ fileMetaData [ 'path' ] ; /** @var \Shockwavemk\Mail\Base\Model\Mail\Attachment $attachment */ $ attachment = $ this -> _objectManager -> create ( '\Shockwavemk\Mail\Base\Model\Mail\Attachment' ) ; $ attachment -> setFilePath ( $ filePath ) ; $ attachment -> setMail ( $ mail ) ; // transfer all meta data into attachment object foreach ( $ fileMetaData as $ attributeKey => $ attributeValue ) { $ attachment -> setData ( $ attributeKey , $ attributeValue ) ; } $ attachments [ $ filePath ] = $ attachment ; } return $ attachments ; }
Returns attachments for a given mail

\Shockwavemk\Mail\Base\Model\Mail $mail

@return \Shockwavemk\Mail\Base\Model\Mail\Attachment[]
Returns attachments for a given mail