MessageParser
in package
Parses a mail mime message into its component parts. To invoke, call {@see MailMimeParser::parse()}.
Tags
Table of Contents
- $headerParser : HeaderParser
- $parserManager : ParserManager
- $partBuilderFactory : PartBuilderFactory
- $partHeaderContainerFactory : PartHeaderContainerFactory
- __construct() : mixed
- parse() : IMessage
- Parses the passed stream into an {@see ZBateson\MailMimeParser\IMessage} object and returns it.
- readLine() : string|bool
- Convenience method to read a line of up to 4096 characters from the passed resource handle.
Properties
$headerParser
protected
HeaderParser
$headerParser
To parse the headers into a PartHeaderContainer.
$parserManager
protected
ParserManager
$parserManager
To figure out what parser is responsible for parsing a message.
$partBuilderFactory
protected
PartBuilderFactory
$partBuilderFactory
To create a PartBuilder representing this message, and to pass it to ParserManager.
$partHeaderContainerFactory
protected
PartHeaderContainerFactory
$partHeaderContainerFactory
To create a container to read the message's headers into.
Methods
__construct()
public
__construct(PartBuilderFactory $pbf, PartHeaderContainerFactory $phcf, ParserManager $pm, HeaderParser $hp) : mixed
Parameters
- $pbf : PartBuilderFactory
- $phcf : PartHeaderContainerFactory
- $pm : ParserManager
- $hp : HeaderParser
Return values
mixed —parse()
Parses the passed stream into an {@see ZBateson\MailMimeParser\IMessage} object and returns it.
public
parse(StreamInterface $stream) : IMessage
Parameters
- $stream : StreamInterface
-
the stream to parse the message from
Return values
IMessage —readLine()
Convenience method to read a line of up to 4096 characters from the passed resource handle.
public
static readLine(resource $handle) : string|bool
If the line is larger than 4096 characters, the remaining characters in the line are read and discarded, and only the first 4096 characters are returned.
Parameters
- $handle : resource
Return values
string|bool —the read line or false on EOF or on error.