class Attachment implements Arrayable, JsonSerializable (View source)

Methods

__construct(string|null $filename, string|null $contentId, string $contentType, string|null $contentDisposition, StreamInterface $contentStream)

Constructor.

static array
parsed(MessageInterface $message)

Get attachments from a parsed message.

static array
lazy(Message $message)

Get attachments from a message's body structure using lazy streams.

static bool
isForwardedMessage(IMessagePart $part)

Determine if the attachment should be treated as an embedded forwarded message.

string|null
filename()

Get the attachment's filename.

string|null
contentId()

Get the attachment's content ID.

string
contentType()

Get the attachment's content type.

string
contentDisposition()

Get the attachment's content disposition.

string
contents()

Get the attachment's contents.

StreamInterface
contentStream()

Get the attachment's content stream.

false|int
save(string $path)

Save the attachment to a file.

string|null
extension()

Get the attachment's extension.

array
toArray()

Get the array representation of the attachment.

array
jsonSerialize()

Get the JSON representation of the attachment.

Details

__construct(string|null $filename, string|null $contentId, string $contentType, string|null $contentDisposition, StreamInterface $contentStream)

Constructor.

Parameters

string|null $filename
string|null $contentId
string $contentType
string|null $contentDisposition
StreamInterface $contentStream

static array parsed(MessageInterface $message)

Get attachments from a parsed message.

Parameters

MessageInterface $message

Return Value

array

static array lazy(Message $message)

Get attachments from a message's body structure using lazy streams.

Parameters

Message $message

Return Value

array

static protected bool isForwardedMessage(IMessagePart $part)

Determine if the attachment should be treated as an embedded forwarded message.

Parameters

IMessagePart $part

Return Value

bool

string|null filename()

Get the attachment's filename.

Return Value

string|null

string|null contentId()

Get the attachment's content ID.

Return Value

string|null

string contentType()

Get the attachment's content type.

Return Value

string

string contentDisposition()

Get the attachment's content disposition.

Return Value

string

string contents()

Get the attachment's contents.

Return Value

string

StreamInterface contentStream()

Get the attachment's content stream.

Return Value

StreamInterface

false|int save(string $path)

Save the attachment to a file.

Parameters

string $path

Return Value

false|int

string|null extension()

Get the attachment's extension.

Return Value

string|null

array toArray()

Get the array representation of the attachment.

Return Value

array

array jsonSerialize()

Get the JSON representation of the attachment.

Return Value

array