class BodyStructurePart implements Arrayable, JsonSerializable (View source)

Methods

__construct(string $partNumber, string $type, string $subtype, array $parameters = [], string|null $id = null, string|null $description = null, string|null $encoding = null, int|null $size = null, int|null $lines = null, ContentDisposition|null $disposition = null)

Constructor.

fromListData(ListData $data, string $partNumber = '1')

Parse a single part BODYSTRUCTURE ListData into a BodyStructurePart.

parse(array $tokens, string $partNumber)

Parse a single (non-multipart) part.

string
partNumber()

Get the part number (e.g., "1", "1.2", "2.1.3").

string
type()

Get the MIME type (e.g., "text", "image", "multipart").

string
subtype()

Get the MIME subtype (e.g., "plain", "html", "jpeg", "mixed").

string
contentType()

Get the full content type (e.g., "text/plain", "multipart/alternative").

array
parameters()

Get the parameters (e.g., charset, boundary).

string|null
parameter(string $name)

Get a specific parameter value.

string|null
id()

Get the content ID.

string|null
description()

Get the content description.

string|null
encoding()

Get the content transfer encoding.

int|null
size()

Get the size in bytes.

int|null
lines()

Get the number of lines (for text parts).

disposition()

Get the content disposition.

string|null
filename()

Get the filename from disposition parameters.

string|null
charset()

Get the charset from parameters.

bool
isText()

Determine if this is a text part.

bool
isHtml()

Determine if this is an HTML part.

bool
isAttachment()

Determine if this is an attachment.

bool
isInline()

Determine if this is an inline part.

array
toArray()

Get the array representation.

array
jsonSerialize()

Get the JSON representation.

Details

__construct(string $partNumber, string $type, string $subtype, array $parameters = [], string|null $id = null, string|null $description = null, string|null $encoding = null, int|null $size = null, int|null $lines = null, ContentDisposition|null $disposition = null)

Constructor.

Parameters

string $partNumber
string $type
string $subtype
array $parameters
string|null $id
string|null $description
string|null $encoding
int|null $size
int|null $lines
ContentDisposition|null $disposition

static BodyStructurePart fromListData(ListData $data, string $partNumber = '1')

Parse a single part BODYSTRUCTURE ListData into a BodyStructurePart.

Parameters

ListData $data
string $partNumber

Return Value

BodyStructurePart

static protected BodyStructurePart parse(array $tokens, string $partNumber)

Parse a single (non-multipart) part.

Parameters

array $tokens
string $partNumber

Return Value

BodyStructurePart

string partNumber()

Get the part number (e.g., "1", "1.2", "2.1.3").

Return Value

string

string type()

Get the MIME type (e.g., "text", "image", "multipart").

Return Value

string

string subtype()

Get the MIME subtype (e.g., "plain", "html", "jpeg", "mixed").

Return Value

string

string contentType()

Get the full content type (e.g., "text/plain", "multipart/alternative").

Return Value

string

array parameters()

Get the parameters (e.g., charset, boundary).

Return Value

array

string|null parameter(string $name)

Get a specific parameter value.

Parameters

string $name

Return Value

string|null

string|null id()

Get the content ID.

Return Value

string|null

string|null description()

Get the content description.

Return Value

string|null

string|null encoding()

Get the content transfer encoding.

Return Value

string|null

int|null size()

Get the size in bytes.

Return Value

int|null

int|null lines()

Get the number of lines (for text parts).

Return Value

int|null

ContentDisposition|null disposition()

Get the content disposition.

Return Value

ContentDisposition|null

string|null filename()

Get the filename from disposition parameters.

Return Value

string|null

string|null charset()

Get the charset from parameters.

Return Value

string|null

bool isText()

Determine if this is a text part.

Return Value

bool

bool isHtml()

Determine if this is an HTML part.

Return Value

bool

bool isAttachment()

Determine if this is an attachment.

Return Value

bool

bool isInline()

Determine if this is an inline part.

Return Value

bool

array toArray()

Get the array representation.

Return Value

array

array jsonSerialize()

Get the JSON representation.

Return Value

array