MailMimeParser 2.3

IParser

Interface defining a message part parser.

Tags
author

Zaahid Bateson

Table of Contents

canParse()  : bool
Called by the ParserManager to determine if the passed PartBuilder is a part handled by this IParser.
getParserMessageProxyFactory()  : ParserPartProxyFactory
Returns the ParserPartProxyFactory responsible for creating IMessage parts for this parser.
getParserPartProxyFactory()  : ParserPartProxyFactory
Returns the ParserPartProxyFactory responsible for creating IMessagePart parts for this parser.
parseContent()  : mixed
Performs read operations for content from the stream of the passed ParserPartProxy, and setting content bounds for the part in the passed ParserPartProxy.
parseNextChild()  : ParserPartProxy|null
Performs read operations to read children from the passed $proxy, using its stream, and reading up to (and not including) the beginning of the child's content if another child exists.
setParserManager()  : mixed
Sets up the passed ParserManager as the ParserManager for this part, which should be used when a new part is created (after its headers are read and a PartBuilder is created from it.)

Methods

canParse()

Called by the ParserManager to determine if the passed PartBuilder is a part handled by this IParser.

public canParse(PartBuilder $part) : bool
Parameters
$part : PartBuilder
Return values
bool

getParserMessageProxyFactory()

Returns the ParserPartProxyFactory responsible for creating IMessage parts for this parser.

public getParserMessageProxyFactory() : ParserPartProxyFactory

This is called by ParserManager after 'canParse' if it returns true so a ParserPartProxy can be created out of the PartBuilder.

Return values
ParserPartProxyFactory

getParserPartProxyFactory()

Returns the ParserPartProxyFactory responsible for creating IMessagePart parts for this parser.

public getParserPartProxyFactory() : ParserPartProxyFactory

This is called by ParserManager after 'canParse' if it returns true so a ParserPartProxy can be created out of the PartBuilder.

Return values
ParserPartProxyFactory

parseContent()

Performs read operations for content from the stream of the passed ParserPartProxy, and setting content bounds for the part in the passed ParserPartProxy.

public parseContent(ParserPartProxy $proxy) : mixed

The implementation should call $proxy->setStreamContentStartPos() and $proxy->setStreamContentAndPartEndPos() so an IMessagePart can return content from the raw message.

Reading should stop once the end of the current part's content has been reached or the end of the message has been reached. If the end of the message has been reached $proxy->setEof() should be called in addition to setStreamContentAndPartEndPos().

Parameters
$proxy : ParserPartProxy
Return values
mixed

parseNextChild()

Performs read operations to read children from the passed $proxy, using its stream, and reading up to (and not including) the beginning of the child's content if another child exists.

public parseNextChild(ParserMimePartProxy $proxy) : ParserPartProxy|null

The implementation should:

  1. Return null if there are no more children.
  2. Read headers
  3. Create a PartBuilder (adding the passed $proxy as its parent)
  4. Call ParserManager::createParserProxyFor() on the ParserManager previously set by a call to setParserManager(), which may determine that a different parser is responsible for parts represented by the headers and PartBuilder passed to it.

The method should then return the ParserPartProxy returned by the ParserManager, or null if there are no more children to read.

Parameters
$proxy : ParserMimePartProxy
Return values
ParserPartProxy|null

The child ParserPartProxy or null if there are no more children under $proxy.

setParserManager()

Sets up the passed ParserManager as the ParserManager for this part, which should be used when a new part is created (after its headers are read and a PartBuilder is created from it.)

public setParserManager(ParserManager $pm) : mixed
Parameters
$pm : ParserManager

The ParserManager to set.

Return values
mixed

Search results