BodyStructurePart
class BodyStructurePart implements Arrayable, JsonSerializable (View source)
Methods
Constructor.
Parse a single part BODYSTRUCTURE ListData into a BodyStructurePart.
Parse a single (non-multipart) part.
Safely read a scalar token value from the parsed body structure.
Safely read an integer token value from the parsed body structure.
Get the part number (e.g., "1", "1.2", "2.1.3").
Get the MIME type (e.g., "text", "image", "multipart").
Get the MIME subtype (e.g., "plain", "html", "jpeg", "mixed").
Get the full content type (e.g., "text/plain", "multipart/alternative").
Get the parameters (e.g., charset, boundary).
Get a specific parameter value.
Get the content ID.
Get the content description.
Get the content transfer encoding.
Get the size in bytes.
Get the number of lines (for text parts).
Get the content disposition.
Get the filename from disposition parameters.
Get the charset from parameters.
Determine if this is a text part.
Determine if this is an HTML part.
Determine if this is an attachment.
Determine if this is an inline part.
Get the array representation.
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.
static BodyStructurePart
fromListData(ListData $data, string $partNumber = '1')
Parse a single part BODYSTRUCTURE ListData into a BodyStructurePart.
static protected BodyStructurePart
parse(array $tokens, string $partNumber)
Parse a single (non-multipart) part.
static protected string|null
tokenValueAt(array $tokens, int $index)
Safely read a scalar token value from the parsed body structure.
static protected int|null
tokenIntValueAt(array $tokens, int $index)
Safely read an integer token value from the parsed body structure.
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).
ContentDisposition|null
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.