MailMimeParser 2.3

PartBuilder
in package

Holds generic/all purpose information about a part while it's being parsed.

The class holds:

  • a HeaderContainer to hold headers
  • stream positions (part start/end positions, content start/end)
  • the message's psr7 stream and a resource handle created from it (held only for a top-level PartBuilder representing the message, child PartBuilders do not duplicate/hold a separate stream).

More specific information a parser needs to keep about a message as it's parsing it should be stored in its ParserPartProxy.

Tags
author

Zaahid Bateson

Table of Contents

$headerContainer  : PartHeaderContainer
$messageHandle  : resource
$messageStream  : StreamInterface
$parent  : ParserPartProxy
$streamContentEndPos  : int
$streamContentStartPos  : int
$streamPartEndPos  : int
$streamPartStartPos  : int
__construct()  : mixed
__destruct()  : mixed
getHeaderContainer()  : PartHeaderContainer
Returns this part's PartHeaderContainer.
getMessageResourceHandle()  : resource
Returns the resource handle for a the message's stream, getting it from the parent part if this is a child part.
getMessageResourceHandlePos()  : int
Shortcut for calling ftell($partBuilder->getMessageResourceHandle()).
getParent()  : ParserPartProxy
The ParserPartProxy parent of this PartBuilder.
getStream()  : StreamInterface
Returns the raw message StreamInterface for a message, getting it from the parent part if this is a child part.
getStreamContentLength()  : int
Returns the length of this part's content stream.
getStreamContentStartPos()  : int|null
Returns the byte offset start position of the content of this part within the main raw message stream, or null if not set.
getStreamPartLength()  : int
Returns the number of raw bytes this part has.
getStreamPartStartPos()  : int|null
Returns the byte offset start position for this part within the message stream if it's been set, or null otherwise.
isContentParsed()  : bool|null
Returns true if the byte offset positions for this part's content have been set.
isMime()  : bool
Returns true if this part, or any parent, have a Content-Type or MIME-Version header set.
setStreamContentStartPos()  : static
Sets the byte offset start position of the content in the raw message stream.
setStreamPartAndContentEndPos()  : static
Sets the byte offset end position of the content and part in the raw message stream.
setStreamPartEndPos()  : static
Sets the byte offset end position of the part in the raw message stream, and also calls its parent's setParentStreamPartEndPos to expand to parent PartBuilders.
setStreamPartStartPos()  : static
Sets the byte offset start position of the part in the raw message stream.

Properties

$messageHandle

private resource $messageHandle = null

the raw message input stream handle constructed from $messageStream or null for a child part

$messageStream

private StreamInterface $messageStream = null

the raw message input stream for a message, or null for a child part.

$streamContentEndPos

private int $streamContentEndPos = null

The offset read end position in the message's stream for the end of this part's content (body).

$streamContentStartPos

private int $streamContentStartPos = null

The offset read start position in the message's stream for the beginning of this part's content (body).

$streamPartEndPos

private int $streamPartEndPos = null

The offset read end position for this part. If the part is a multipart mime part, the end position is after all of this parts children.

$streamPartStartPos

private int $streamPartStartPos = null

The offset read start position for this part (beginning of headers) in the message's stream.

Methods

__destruct()

public __destruct() : mixed
Return values
mixed

getMessageResourceHandle()

Returns the resource handle for a the message's stream, getting it from the parent part if this is a child part.

public getMessageResourceHandle() : resource
Return values
resource

getMessageResourceHandlePos()

Shortcut for calling ftell($partBuilder->getMessageResourceHandle()).

public getMessageResourceHandlePos() : int
Return values
int

getStream()

Returns the raw message StreamInterface for a message, getting it from the parent part if this is a child part.

public getStream() : StreamInterface
Return values
StreamInterface

getStreamContentLength()

Returns the length of this part's content stream.

public getStreamContentLength() : int

This method does not perform checks on whether the start pos and end pos of this part's content have been set, and so could cause errors if called before being set and are still null.

Return values
int

getStreamContentStartPos()

Returns the byte offset start position of the content of this part within the main raw message stream, or null if not set.

public getStreamContentStartPos() : int|null
Return values
int|null

getStreamPartLength()

Returns the number of raw bytes this part has.

public getStreamPartLength() : int

This method does not perform checks on whether the start pos and end pos of this part have been set, and so could cause errors if called before being set and are still null.

Return values
int

getStreamPartStartPos()

Returns the byte offset start position for this part within the message stream if it's been set, or null otherwise.

public getStreamPartStartPos() : int|null
Return values
int|null

isContentParsed()

Returns true if the byte offset positions for this part's content have been set.

public isContentParsed() : bool|null
Return values
bool|null

true if set.

isMime()

Returns true if this part, or any parent, have a Content-Type or MIME-Version header set.

public isMime() : bool
Return values
bool

true if it's a mime message or child of a mime message.

setStreamContentStartPos()

Sets the byte offset start position of the content in the raw message stream.

public setStreamContentStartPos(int $streamContentStartPos) : static
Parameters
$streamContentStartPos : int
Return values
static

setStreamPartAndContentEndPos()

Sets the byte offset end position of the content and part in the raw message stream.

public setStreamPartAndContentEndPos(int $streamContentEndPos) : static
Parameters
$streamContentEndPos : int
Return values
static

setStreamPartEndPos()

Sets the byte offset end position of the part in the raw message stream, and also calls its parent's setParentStreamPartEndPos to expand to parent PartBuilders.

public setStreamPartEndPos(int $streamPartEndPos) : static
Parameters
$streamPartEndPos : int
Return values
static

setStreamPartStartPos()

Sets the byte offset start position of the part in the raw message stream.

public setStreamPartStartPos(int $streamPartStartPos) : static
Parameters
$streamPartStartPos : int
Return values
static

Search results