Copied!

A bi-directional parser-to-part proxy for MimeParser and IMimeParts.

CloneableInstantiable
Methods
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::__construct(ZBateson\MailMimeParser\Parser\PartBuilder $partBuilder, ZBateson\MailMimeParser\Parser\IParser $parser)
public ZBateson\MailMimeParser\Parser\PartBuilder::__destruct()
public getContentType()
 

Returns a ParameterHeader representing the parsed Content-Type header for
this part.

  • return ?\ZBateson\MailMimeParser\Header\IHeader
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getHeaderContainer()
public getLastLineEndingLength() : int
 

Returns the length of the last line ending read by MimeParser (e.g. 2 for
'\r\n', or 1 for '\n').

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 int the length of the last line ending read
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getMessageResourceHandle()
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getMessageResourceHandlePos() : int
public getMimeBoundary()
 

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

  • return string
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getParent()
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getPart()
 

Returns the IMessagePart associated with this proxy.

  • return \IMessagePart the part.
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getStream()
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getStreamContentLength() : int
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getStreamContentStartPos() : ?int
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getStreamPartLength() : int
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::getStreamPartStartPos() : int
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::isContentParsed() : ?bool
public isEndBoundaryFound() : bool
 

Returns true if an end boundary was found for this part.

public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::isMime() : bool
public 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.

public parseAll()
 

Parses all content and children for this part.

  • return static
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::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.

The method first checks to see if the content has already been parsed,
and is safe to call multiple times.

  • return static
public 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.

  • return \IMessagePart|null the child part.
public setEndBoundaryFound(string $line)
 

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.

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

  • return bool
public setEof() : self
 

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.

  • return static
public setLastLineEndingLength(int $length)
 

Sets the length of the last line ending read by MimeParser (e.g. 2 for
'\r\n', or 1 for '\n').

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.

  • return static
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::setPart(ZBateson\MailMimeParser\Message\IMessagePart $part) : self
 

Sets the associated part.

  • param \IMessagePart $part The part
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::setStreamContentStartPos(int $streamContentStartPos)
 
  • return static
public setStreamPartAndContentEndPos(int $streamContentEndPos)
 

Overridden to set a 0-length content length, and a stream end pos of -2
if the passed end pos is before the start pos (can happen if a mime
end boundary doesn't have an empty line before the next parent start
boundary).

  • return static
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::setStreamPartEndPos(int $streamPartEndPos)
 
  • return static
public ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::setStreamPartStartPos(int $streamPartStartPos)
 
  • return static
Properties
protected $allChildrenParsed = false
 
  • var bool true once all children of this part have been parsed.
protected $children = []
 
  • var \ParserPartProxy[] Parsed children used as a 'first-in-first-out'
    stack as children are parsed.
protected $endBoundaryFound = false
 
  • var bool set to true once the end boundary of the currently-parsed
    part is found.
protected $lastAddedChild = NULL
 
  • var \ParserPartProxy Reference to the last child added to this part.
protected $mimeBoundary = false
 
  • var bool|null|string 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.
protected $parentBoundaryFound = false
 
  • var bool set to true once a boundary belonging to this parent's part
    is found.
protected ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::$parser = NULL
 
  • var \IParser The parser.
protected ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy::$partBuilder = NULL
 
  • var \PartBuilder The part's PartBuilder.
Methods
protected ensureLastChildParsed() : self
 

Ensures that the last child added to this part is fully parsed (content
and children).

protected parseNextChild() : self
 

Parses the next child of this part and adds it to the 'stack' of
children.

© 2023 Bruce Wells
Search Namespaces \ Classes
Configuration