class BodyStructureCollection implements Arrayable, Countable, IteratorAggregate, JsonSerializable (View source)

Methods

__construct(string $subtype = 'mixed', array $parameters = [], array $parts = [])

Constructor.

fromListData(ListData $data, string|null $partNumber = null)

Parse a multipart BODYSTRUCTURE ListData into a BodyStructureCollection.

static bool
isMultipart(ListData $data)

Determine if a ListData represents a multipart structure.

static bool
isDispositionList(ListData $data)

Determine if a ListData represents a disposition (INLINE or ATTACHMENT).

string
subtype()

Get the multipart subtype (mixed, alternative, related, etc.).

string
contentType()

Get the content type.

array
parameters()

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

string|null
boundary()

Get the boundary parameter.

array
parts()

Get the direct child parts.

array
flatten()

Get all parts flattened (including nested parts).

find(string $partNumber)

Find a part by its part number.

text()

Get the text/plain part if available.

html()

Get the text/html part if available.

array
attachments()

Get all attachment parts.

bool
hasAttachments()

Determine if the collection has attachments.

int
attachmentCount()

Get the count of attachments.

int
count()

Get the count of parts.

getIterator()

Get an iterator for the parts.

array
toArray()

Get the array representation.

array
jsonSerialize()

Get the JSON representation.

Details

__construct(string $subtype = 'mixed', array $parameters = [], array $parts = [])

Constructor.

Parameters

string $subtype
array $parameters
array $parts

static BodyStructureCollection fromListData(ListData $data, string|null $partNumber = null)

Parse a multipart BODYSTRUCTURE ListData into a BodyStructureCollection.

Parameters

ListData $data
string|null $partNumber

Return Value

BodyStructureCollection

static protected bool isMultipart(ListData $data)

Determine if a ListData represents a multipart structure.

Parameters

ListData $data

Return Value

bool

static protected bool isDispositionList(ListData $data)

Determine if a ListData represents a disposition (INLINE or ATTACHMENT).

Parameters

ListData $data

Return Value

bool

string subtype()

Get the multipart subtype (mixed, alternative, related, etc.).

Return Value

string

string contentType()

Get the content type.

Return Value

string

array parameters()

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

Return Value

array

string|null boundary()

Get the boundary parameter.

Return Value

string|null

array parts()

Get the direct child parts.

Return Value

array

array flatten()

Get all parts flattened (including nested parts).

Return Value

array

BodyStructurePart|BodyStructureCollection|null find(string $partNumber)

Find a part by its part number.

Parameters

string $partNumber

Return Value

BodyStructurePart|BodyStructureCollection|null

BodyStructurePart|null text()

Get the text/plain part if available.

Return Value

BodyStructurePart|null

BodyStructurePart|null html()

Get the text/html part if available.

Return Value

BodyStructurePart|null

array attachments()

Get all attachment parts.

Return Value

array

bool hasAttachments()

Determine if the collection has attachments.

Return Value

bool

int attachmentCount()

Get the count of attachments.

Return Value

int

int count()

Get the count of parts.

Return Value

int

Traversable getIterator()

Get an iterator for the parts.

Return Value

Traversable

array toArray()

Get the array representation.

Return Value

array

array jsonSerialize()

Get the JSON representation.

Return Value

array