ParserMessageProxy
        
        extends ParserMimePartProxy
    
    
            
            in package
            
        
    
    
    
        
            A bi-directional parser-to-part proxy for IMessage objects created by MimeParser.
Tags
Table of Contents
- $allChildrenParsed : bool
- $children : array<string|int, ParserPartProxy>
- $endBoundaryFound : bool
- $lastAddedChild : ParserPartProxy
- $lastLineEndingLength : int
- $mimeBoundary : bool|null|string
- $parentBoundaryFound : bool
- $parser : IParser
- $partBuilder : PartBuilder
- $headerContainer : PartHeaderContainer
- $messageHandle : resource
- $messageStream : StreamInterface
- $parent : ParserPartProxy
- $part : IMessagePart
- $streamContentEndPos : int
- $streamContentStartPos : int
- $streamPartEndPos : int
- $streamPartStartPos : int
- __construct() : mixed
- __destruct() : mixed
- getContentType() : ParameterHeader
- Returns a ParameterHeader representing the parsed Content-Type header for this part.
- getHeaderContainer() : PartHeaderContainer
- Returns this part's PartHeaderContainer.
- getLastLineEndingLength() : int
- Returns the length of the last line ending read by MimeParser (e.g. 2 for '\r\n', or 1 for '\n').
- 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()).
- getMimeBoundary() : string
- Returns the parsed boundary parameter of the Content-Type header if set for a multipart message part.
- getParent() : ParserPartProxy
- The ParserPartProxy parent of this PartBuilder.
- getPart() : IMessagePart
- Returns the IMessagePart associated with this proxy.
- 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
- Returns true if the byte offset positions for this part's content have been set.
- isEndBoundaryFound() : bool
- Returns true if an end boundary was found for this part.
- isMime() : bool
- Returns true if this part, or any parent, have a Content-Type or MIME-Version header set.
- isParentBoundaryFound() : bool
- Returns true if the parser 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.
- parseAll() : mixed
- Parses everything under this part.
- parseContent() : mixed
- Requests the parser to parse this part's content, and call setStreamContentStartPos/EndPos to setup this part's boundaries within the main message's raw stream.
- popNextChild() : IMessagePart|null
- Returns the next child part if one exists, popping it from the internal 'stack' of children, attempting to parse a new one if the stack is empty, and returning null if there are no more children.
- setEndBoundaryFound() : bool
- Returns true if the passed $line of read input matches this part'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 isParentBoundaryFound() to true on this part and all parent parts.
- setLastLineEndingLength() : mixed
- Sets the length of the last line ending read by MimeParser (e.g. 2 for '\r\n', or 1 for '\n').
- setPart() : mixed
- Sets the associated part.
- setStreamContentStartPos() : mixed
- Sets the byte offset start position of the content in the raw message stream.
- setStreamPartAndContentEndPos() : mixed
- Sets the byte offset end position of the content and part in the raw message stream.
- setStreamPartEndPos() : mixed
- 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() : mixed
- Sets the byte offset start position of the part in the raw message stream.
- ensureLastChildParsed() : mixed
- Ensures that the last child added to this part is fully parsed (content and children).
- parseNextChild() : mixed
- Parses the next child of this part and adds it to the 'stack' of children.
Properties
$allChildrenParsed
    protected
        bool
    $allChildrenParsed
     = false
    
        true once all children of this part have been parsed.
$children
    protected
        array<string|int, ParserPartProxy>
    $children
     = []
    
        Parsed children used as a 'first-in-first-out' stack as children are parsed.
$endBoundaryFound
    protected
        bool
    $endBoundaryFound
     = false
    
        set to true once the end boundary of the currently-parsed part is found.
$lastAddedChild
    protected
        ParserPartProxy
    $lastAddedChild
     = null
    
        Reference to the last child added to this part.
$lastLineEndingLength
    protected
        int
    $lastLineEndingLength
     = 0
    
        maintains the character length of the last line separator, typically 2 for CRLF, to keep track of the correct 'end' position for a part because the CRLF before a boundary is considered part of the boundary.
$mimeBoundary
    protected
        bool|null|string
    $mimeBoundary
     = false
    
        FALSE if not queried for in the content-type header of this part, NULL if the current part does not have a boundary, and otherwise contains the value of the boundary parameter of the content-type header if the part contains one.
$parentBoundaryFound
    protected
        bool
    $parentBoundaryFound
     = false
    
        set to true once a boundary belonging to this parent's part is found.
$parser
    protected
        IParser
    $parser
    
    
        The parser.
$partBuilder
    protected
        PartBuilder
    $partBuilder
    
    
        The part's PartBuilder.
$headerContainer
    private
        PartHeaderContainer
    $headerContainer
    
    
        The parsed part's headers.
$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.
$parent
    private
        ParserPartProxy
    $parent
     = null
    
        The parent ParserPartProxy.
$part
    private
        IMessagePart
    $part
    
    
        The 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
__construct()
    public
                __construct(PartHeaderContainer $headerContainer[, StreamInterface $messageStream = null ][, ParserPartProxy $parent = null ]) : mixed
        
        Parameters
- $headerContainer : PartHeaderContainer
- $messageStream : StreamInterface = null
- $parent : ParserPartProxy = null
Return values
mixed —__destruct()
    public
                __destruct() : mixed
        
    
    
        Return values
mixed —getContentType()
Returns a ParameterHeader representing the parsed Content-Type header for this part.
    public
                getContentType() : ParameterHeader
    
    
    
        Return values
ParameterHeader —getHeaderContainer()
Returns this part's PartHeaderContainer.
    public
                getHeaderContainer() : PartHeaderContainer
    
    
    
        Return values
PartHeaderContainer —the container
getLastLineEndingLength()
Returns the length of the last line ending read by MimeParser (e.g. 2 for '\r\n', or 1 for '\n').
    public
                getLastLineEndingLength() : int
        The line ending may not belong specifically to this part, so ParserMimePartProxy simply calls getLastLineEndingLength on its parent, which must eventually reach a ParserMessageProxy which actually keeps the length and returns it.
Return values
int —the length of the last line ending read
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 —getMimeBoundary()
Returns the parsed boundary parameter of the Content-Type header if set for a multipart message part.
    public
                getMimeBoundary() : string
    
    
    
        Return values
string —getParent()
The ParserPartProxy parent of this PartBuilder.
    public
                getParent() : ParserPartProxy
    
    
    
        Return values
ParserPartProxy —getPart()
Returns the IMessagePart associated with this proxy.
    public
                getPart() : IMessagePart
    
    
    
        Return values
IMessagePart —the part.
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
    
    
    
        Return values
bool —true if set.
isEndBoundaryFound()
Returns true if an end boundary was found for this part.
    public
                isEndBoundaryFound() : bool
    
    
    
        Return values
bool —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.
isParentBoundaryFound()
Returns true if the parser 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 —parseAll()
Parses everything under this part.
    public
                parseAll() : mixed
        For ParserPartProxy, this is just content, but sub-classes may override this to parse all children as well for example. .
Return values
mixed —parseContent()
Requests the parser to parse this part's content, and call setStreamContentStartPos/EndPos to setup this part's boundaries within the main message's raw stream.
    public
                parseContent() : mixed
        The method first checks to see if the content has already been parsed, and is safe to call multiple times.
Return values
mixed —popNextChild()
Returns the next child part if one exists, popping it from the internal 'stack' of children, attempting to parse a new one if the stack is empty, and returning null if there are no more children.
    public
                popNextChild() : IMessagePart|null
    
    
    
        Return values
IMessagePart|null —the child part.
setEndBoundaryFound()
Returns true if the passed $line of read input matches this part'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 part, $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 isParentBoundaryFound() to true on this part and all parent parts.
    public
                setEof() : mixed
    
    
    
        Return values
mixed —setLastLineEndingLength()
Sets the length of the last line ending read by MimeParser (e.g. 2 for '\r\n', or 1 for '\n').
    public
                setLastLineEndingLength(mixed $lastLineEndingLength) : mixed
        The line ending may not belong specifically to this part, so ParserMimePartProxy simply calls setLastLineEndingLength on its parent, which must eventually reach a ParserMessageProxy which actually stores the length.
Parameters
- $lastLineEndingLength : mixed
Return values
mixed —setPart()
Sets the associated part.
    public
                setPart(IMessagePart $part) : mixed
    
        Parameters
- $part : IMessagePart
- 
                    The part 
Return values
mixed —setStreamContentStartPos()
Sets the byte offset start position of the content in the raw message stream.
    public
                setStreamContentStartPos(int $streamContentStartPos) : mixed
    
        Parameters
- $streamContentStartPos : int
Return values
mixed —setStreamPartAndContentEndPos()
Sets the byte offset end position of the content and part in the raw message stream.
    public
                setStreamPartAndContentEndPos(int $streamContentEndPos) : mixed
    
        Parameters
- $streamContentEndPos : int
Return values
mixed —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) : mixed
    
        Parameters
- $streamPartEndPos : int
Return values
mixed —setStreamPartStartPos()
Sets the byte offset start position of the part in the raw message stream.
    public
                setStreamPartStartPos(int $streamPartStartPos) : mixed
    
        Parameters
- $streamPartStartPos : int
Return values
mixed —ensureLastChildParsed()
Ensures that the last child added to this part is fully parsed (content and children).
    protected
                ensureLastChildParsed() : mixed
    
    
    
        Return values
mixed —parseNextChild()
Parses the next child of this part and adds it to the 'stack' of children.
    protected
                parseNextChild() : mixed