MailMimeParser 1.3

PartBuilder

Used by MessageParser to keep information about a parsed message as an intermediary before creating a Message object and its MessagePart children.

Tags
author

Zaahid Bateson

Table of Contents

$children  : array<string|int, PartBuilder>
$endBoundaryFound  : bool
$headerContainer  : HeaderContainer
$messagePartFactory  : MessagePartFactory
$mimeBoundary  : bool|null|string
$parent  : PartBuilder
$parentBoundaryFound  : bool
$properties  : array<string|int, string>
$streamContentEndPos  : int
$streamContentStartPos  : int
$streamPartEndPos  : int
$streamPartStartPos  : int
__construct()  : mixed
Sets up class dependencies.
addChild()  : mixed
Registers the passed PartBuilder as a child of the current PartBuilder.
addHeader()  : mixed
Adds a header with the given $name and $value to the headers array.
canHaveHeaders()  : bool
Returns false if this part has a parent part in which endBoundaryFound is set to true (i.e. this isn't a discardable part following the parent's end boundary line).
createMessagePart()  : MessagePart
Creates a MessagePart and returns it using the PartBuilder's MessagePartFactory passed in during construction.
getChildren()  : array<string|int, PartBuilder>
Returns all children PartBuilder objects.
getContentType()  : ParameterHeader
Returns a ParameterHeader representing the parsed Content-Type header for this PartBuilder.
getHeaderContainer()  : HeaderContainer
Returns the HeaderContainer object containing parsed headers.
getMimeBoundary()  : string
Returns the parsed boundary parameter of the Content-Type header if set for a multipart message part.
getParent()  : PartBuilder
Returns this PartBuilder's parent.
getProperty()  : mixed
Returns the value of the property with the given $name.
getStreamContentLength()  : int
Returns the length of this part's content stream.
getStreamContentStartOffset()  : int
Returns the offset for this part's content within its part stream.
getStreamPartLength()  : int
Returns the length of this part's stream.
getStreamPartStartOffset()  : int
Returns the offset for this part's stream within its parent stream.
isMime()  : bool
Returns true if either a Content-Type or Mime-Version header are defined in this PartBuilder's headers.
isMultiPart()  : bool
Returns true if this part's content-type is multipart/*
isParentBoundaryFound()  : bool
Returns true if MessageParser passed an input line to setEndBoundary that matches a parent's mime boundary, and the following input belongs to a new part under its parent.
setEndBoundaryFound()  : bool
Returns true if the passed $line of read input matches this PartBuilder's mime boundary, or any of its parent's mime boundaries for a multipart message.
setEof()  : mixed
Called once EOF is reached while reading content. The method sets the flag used by PartBuilder::isParentBoundaryFound to true on this part and all parent PartBuilders.
setProperty()  : mixed
Sets the specified property denoted by $name to $value.
setStreamContentStartPos()  : mixed
Sets the start position of the content in the input stream.
setStreamPartAndContentEndPos()  : mixed
Sets the end position of the content and part in the input stream.
setStreamPartEndPos()  : mixed
Sets the end position of the part in the input stream, and also calls parent->setParentStreamPartEndPos to expand to parent parts.
setStreamPartStartPos()  : mixed
Sets the start position of the part in the input stream.

Properties

$endBoundaryFound

private bool $endBoundaryFound = false

$mimeBoundary

private bool|null|string $mimeBoundary = false

$parentBoundaryFound

private bool $parentBoundaryFound = false

$properties

private array<string|int, string> $properties = []

$streamContentEndPos

private int $streamContentEndPos = 0

$streamContentStartPos

private int $streamContentStartPos = 0

$streamPartStartPos

private int $streamPartStartPos = 0

Methods

addChild()

Registers the passed PartBuilder as a child of the current PartBuilder.

public addChild(PartBuilder $partBuilder) : mixed
Parameters
$partBuilder : PartBuilder
Return values
mixed

addHeader()

Adds a header with the given $name and $value to the headers array.

public addHeader(string $name, string $value) : mixed

Removes non-alphanumeric characters from $name, and sets it to lower-case to use as a key in the private headers array. Sets the original $name and $value as elements in the headers' array value for the calculated key.

Parameters
$name : string
$value : string
Return values
mixed

canHaveHeaders()

Returns false if this part has a parent part in which endBoundaryFound is set to true (i.e. this isn't a discardable part following the parent's end boundary line).

public canHaveHeaders() : bool
Return values
bool

createMessagePart()

Creates a MessagePart and returns it using the PartBuilder's MessagePartFactory passed in during construction.

public createMessagePart([StreamInterface $stream = null ]) : MessagePart
Parameters
$stream : StreamInterface = null
Return values
MessagePart

getChildren()

Returns all children PartBuilder objects.

public getChildren() : array<string|int, PartBuilder>
Return values
array<string|int, PartBuilder>

getMimeBoundary()

Returns the parsed boundary parameter of the Content-Type header if set for a multipart message part.

public getMimeBoundary() : string
Return values
string

getProperty()

Returns the value of the property with the given $name.

public getProperty(string $name) : mixed
Parameters
$name : string
Return values
mixed

getStreamContentLength()

Returns the length of this part's content stream.

public getStreamContentLength() : int
Return values
int

getStreamContentStartOffset()

Returns the offset for this part's content within its part stream.

public getStreamContentStartOffset() : int
Return values
int

getStreamPartLength()

Returns the length of this part's stream.

public getStreamPartLength() : int
Return values
int

getStreamPartStartOffset()

Returns the offset for this part's stream within its parent stream.

public getStreamPartStartOffset() : int
Return values
int

isMime()

Returns true if either a Content-Type or Mime-Version header are defined in this PartBuilder's headers.

public isMime() : bool
Return values
bool

isMultiPart()

Returns true if this part's content-type is multipart/*

public isMultiPart() : bool
Return values
bool

isParentBoundaryFound()

Returns true if MessageParser passed an input line to setEndBoundary that matches a parent's mime boundary, and the following input belongs to a new part under its parent.

public isParentBoundaryFound() : bool
Return values
bool

setEndBoundaryFound()

Returns true if the passed $line of read input matches this PartBuilder's mime boundary, or any of its parent's mime boundaries for a multipart message.

public setEndBoundaryFound(string $line) : bool

If the passed $line is the ending boundary for the current PartBuilder, $this->isEndBoundaryFound will return true after.

Parameters
$line : string
Return values
bool

setEof()

Called once EOF is reached while reading content. The method sets the flag used by PartBuilder::isParentBoundaryFound to true on this part and all parent PartBuilders.

public setEof() : mixed
Return values
mixed

setProperty()

Sets the specified property denoted by $name to $value.

public setProperty(string $name, mixed $value) : mixed
Parameters
$name : string
$value : mixed
Return values
mixed

setStreamContentStartPos()

Sets the start position of the content in the input stream.

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

setStreamPartAndContentEndPos()

Sets the end position of the content and part in the input stream.

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

setStreamPartEndPos()

Sets the end position of the part in the input stream, and also calls parent->setParentStreamPartEndPos to expand to parent parts.

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

setStreamPartStartPos()

Sets the start position of the part in the input stream.

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

Search results