Returns all attachment parts.

"Attachments" are any non-multipart, non-signature and any text or html
html part witha Content-Disposition set to  'attachment'.

@return MessagePart[]
338854
public function getAllAttachmentParts()
    {
        $parts = $this->getAllParts(
            $this->partFilterFactory->newFilterFromArray([
                'multipart' => PartFilter::FILTER_EXCLUDE
            ])
        );
        return array_values(array_filter(
            $parts,
            function ($part) {
                return !(
                    $part->isTextPart()
                    && $part->getContentDisposition() === 'inline'
                );
            }
        ));
    }
234226
protected function getSectionAttachments()
    {
        $output = '';

        foreach ($this->_attachments as $key => $file) {
            $tmp_file = false;

            // If the attachment is a URL, download the file to a temporary location.
            // This prevents downloading the file twice - once for info, once for data.
            if (filter_var($file['file'], FILTER_VALIDATE_URL)) {
                $gateway = new Gateway();
                $gateway->init($file['file']);
                $gateway->setopt('TIMEOUT', 30);
                $file_content = @$gateway->exec();

                $tmp_file = tempnam(TMP, 'attachment');
                General::writeFile($tmp_file, $file_content, Symphony::Configuration()->get('write_mode', 'file'));

                $original_filename = $file['file'];
                $file['file'] = $tmp_file;

                // Without this the temporary filename will be used. Ugly!
                if (is_null($file['filename'])) {
                    $file['filename'] = basename($original_filename);
                }
            } else {
                $file_content = @file_get_contents($file['file']);
            }

            if ($file_content !== false && !empty($file_content)) {
                $output .= $this->boundaryDelimiterLine('multipart/mixed')
                     . $this->contentInfoString($file['mime-type'], $file['file'], $file['filename'], $file['charset'])
                     . EmailHelper::base64ContentTransferEncode($file_content);
            } else {
                if ($this->_validate_attachment_errors) {
                    if (!$tmp_file === false) {
                        $filename = $original_filename;
                    } else {
                        $filename = $file['file'];
                    }

                    throw new EmailGatewayException(__('The content of the file `%s` could not be loaded.', array($filename)));
                }
            }

            if (!$tmp_file === false) {
                General::deleteFile($tmp_file);
            }
        }
        return $output;
    }
358881
public function getAttachmentUrls()
    {
        return Collection::make($this->event->get('attachments'))->map(function ($item) {
            return new File($item['contentUrl'], $item);
        })->toArray();
    }
1124532
public function attachmentTypes()
    {
        $attachableObjects = $this->attachableObjects();

        $out = [];

        if (!$attachableObjects) {
            return $out;
        }

        $i = 0;
        foreach ($attachableObjects as $attType => $attMeta) {
            $i++;
            $label = $attMeta['label'];

            $out[] = [
                'id'             => (isset($attMeta['att_id']) ? $attMeta['att_id'] : null),
                'ident'          => $this->createIdent($attType),
                'skipForm'       => $attMeta['skipForm'],
                'formIdent'      => $attMeta['formIdent'],
                'quickFormIdent' => $attMeta['quickFormIdent'],
                'hasFaIcon'      => !!$attMeta['faIcon'],
                'faIcon'         => $attMeta['faIcon'],
                'label'          => $label,
                'val'            => $attType,
                'locked'         => $attMeta['locked'],
                'active'         => ($i == 1)
            ];
        }

        return $out;
    }
638803
public function getBody()
	{
		$number		= count( $this->parts );
		if( !$number )
			return '';

		$innerBoundary	= $this->mimeBoundary.'-1';

		$contents	= array( 'This is a multi-part message in MIME format.');
		$contents[]	= '--'.$this->mimeBoundary;
		$contents[]	= 'Content-Type: multipart/alternative;';
		$contents[]	= ' boundary="'.$innerBoundary.'"'.Net_Mail::$delimiter;
		foreach( $this->parts as $part )
			if( $part instanceof Net_Mail_Body )
				$contents[]	= '--'.$innerBoundary.Net_Mail::$delimiter.$part->render();
		$contents[]	= '--'.$innerBoundary.'--'.Net_Mail::$delimiter;

		foreach( $this->parts as $part )
			if( $part instanceof Net_Mail_Attachment )
				$contents[]	= '--'.$this->mimeBoundary.Net_Mail::$delimiter.$part->render();
		$contents[]	= '--'.$this->mimeBoundary.'--'.Net_Mail::$delimiter;
		return join( Net_Mail::$delimiter, $contents );
	}
1021996
public function compileHeaders()
    {
        if (count($this->attachement) > 0) {
            $this->headers[] = "Content-type: multipart/mixed; boundary=\"{$this->boundary}\"" . self::END;

            foreach ($this->attachement as $file) {
                $filename = basename($file);
                $this->headers[] = "--" . $this->boundary;
                $this->headers[] = "Content-Type: application/octet-stream; name=\"{$filename}\"";
                $this->headers[] = "Content-Transfer-Encoding: base64";
                $this->headers[] = "Content-Disposition: attachment" . self::END;
                $this->headers[] = chunk_split(base64_encode(file_get_contents($file)));
            }

            $this->headers[] = "--" . $this->boundary;
        }

        return implode(self::END, $this->headers).self::END;
    }
1362178
public function getMessagesArray()
    {
        $result = [];
        foreach ($this->getMessages() as $message) {
            $result[$message->getLocale()] = $message;
        }

        return $result;
    }
317656
public function getAttachments()
    {
        /** @noinspection IsEmptyFunctionUsageInspection */
        /** @noinspection PhpUndefinedMethodInspection */
        if (!empty(parent::getAttachments())) {
            /** @noinspection PhpUndefinedMethodInspection */
            return parent::getAttachments();
        }

        $attachments = $this->_storage->getAttachments($this);

        /** @noinspection PhpUndefinedMethodInspection */
        $this->setAttachments($attachments);

        return $attachments;
    }
150987
public function toArray()
    {
        return array_filter(
            [
                'text' => $this->getText(),
                'notification' => $this->getNotification(),
                'markdown' => $this->getMarkdown(),
                'channel' => $this->getChannel(),
                'user' => $this->getUser(),
                'attachments' => $this->getAttachments(),
            ],
            function ($value, $key) {
                return ! (
                    is_null($value) ||
                    ($key === 'markdown' && $value === true) ||
                    (is_array($value) && empty($value))
                );
            },
            ARRAY_FILTER_USE_BOTH
        );
    }
245663
public function getInlineParts($type = 'text')
    {
        $inline_parts = [];
        $mime_types = [
            'text'         => 'text/plain',
            'html'         => 'text/html',
        ];

        if (!in_array($type, array_keys($mime_types))) {
            throw new Exception('Invalid type specified for getInlineParts(). "type" can either be text or html.');
        }

        foreach ($this->parts as $partId => $part) {
            if ($this->getPart('content-type', $part) == $mime_types[$type]
                && $this->getPart('content-disposition', $part) != 'attachment'
                && !$this->partIdIsChildOfAnAttachment($partId)
            ) {
                $headers = $this->getPart('headers', $part);
                $encodingType = array_key_exists('content-transfer-encoding', $headers) ?
                    $headers['content-transfer-encoding'] : '';
                $undecoded_body = $this->decodeContentTransfer($this->getPartBody($part), $encodingType);
                $inline_parts[] = $this->charset->decodeCharset($undecoded_body, $this->getPartCharset($part));
            }
        }

        return $inline_parts;
    }
815168
private function pack()
    {
        return [
            'status' => $this->getStatusText(),
            'message' => $this->getMessage(),
            'agent' => $this->getAgent(),
            'content' => $this->getContent(),
            'params' => $this->getParams(),
            'receipt_id' => $this->getReceiptId(),
            'receipt_data' => $this->getReceiptData(),
        ];
    }
825936
public function getMessages()
    {
        $message = new IncomingMessage(Image::PATTERN, $this->event->get('ToUserName'), $this->event->get('FromUserName'),
            $this->event);
        $message->setImages($this->getImages());

        return [$message];
    }
929025
public function attachments()
    {
        $files = func_get_args();

        foreach ($files as $file) {
            if (is_string($file)) {
                $this->_attachments[] = ['file' => $file];
            } elseif (is_array($file)) {
                foreach ($file as $key => $value) {
                    $this->_attachments[] = ['name' => $key, 'file' => $value];
                }
            }
        }

        return $this;
    }
291242
public static function getAllArguments() {
		if(self::$arguments === array())
			self::$arguments = array_merge($_GET, $_POST, $_FILES);

		return self::$arguments;
	}
1353204
public function getParts()
    {
        return array(
            'scheme'   => $this->scheme,
            'user'     => $this->username,
            'pass'     => $this->password,
            'host'     => $this->host,
            'port'     => $this->port,
            'path'     => $this->path,
            'query'    => $this->query,
            'fragment' => $this->fragment,
        );
    }
586033
protected function genericMessageToArray()
    {
        $message = [];
        $message['recipient'] = $this->recipient;
        $message['notification_type'] = $this->notificationType;
        $message['message']['attachment']['type'] = 'template';
        $message['message']['attachment']['payload']['template_type'] = 'generic';
        $message['message']['attachment']['payload']['elements'] = $this->cards;

        return $message;
    }
685133
public function toMessage()
    {
        $message = clone $this;

        $altBody = $message->altBody();
        $attachments = $message->attachments();
        $inlines = $message->inlines();

        $root = $cursor = $message->stream();

        $body = $message->body();
        $bodyMime = $cursor->mime() ?: 'text/plain';
        $bodyCharset = $cursor->charset() ?: Mime::optimalCharset($body);

        if (count($attachments)) {
            $cursor->mime('multipart/mixed');
            $current = $cursor->add(new MixedPart());
            foreach ($attachments as $path => $attachment) {
                $cursor->add(fopen($path, 'r'), $attachment);
            }
            $cursor = $current;
        }

        if ($altBody || count($inlines)) {
            $cursor->mime('multipart/alternative');
        }

        if ($altBody) {
            $cursor->add($altBody, [
                'mime'     => 'text/plain',
                'charset'  => Mime::optimalCharset($altBody),
                'encoding' => Mime::optimalEncoding($altBody)
            ]);
        }

        if ($body) {
            $options = [
                'mime'     => $bodyMime,
                'charset'  => $bodyCharset,
                'encoding' => Mime::optimalEncoding($body)
            ];

            if ($inlines) {
                $current = $cursor->add(new MixedPart(['mime' => 'multipart/related']));
                $current->add($body, $options);
                foreach ($inlines as $path => $inline) {
                    $current->add(fopen($path, 'r'), $inline);
                }
            } else {
                $cursor->add($body, $options);
            }
        }

        $headers = $root->headers();
        $headers['Date'] = date('r');
        $headers['Message-ID'] = static::generateId($this->client());
        return $root->toMessage();
    }