MailMimeParser 2.0

ParserManager
in package

Manages a prioritized list of IParser objects for parsing messages and parts and creating proxied parts.

The default ParserManager sets up a MimeParser in priority 0, and a NonMimeParser in priority 1.

Tags
author

Zaahid Bateson

Table of Contents

$parsers  : array<string|int, IParser>
__construct()  : mixed
createParserProxyFor()  : ParserPartProxy
Creates a ParserPartProxy for the passed $partBuilder using a compatible IParser.
prependParser()  : mixed
Adds an IParser at the highest priority (up front), calling $parser->setParserManager($this) on it.
setParsers()  : mixed
Overrides the internal prioritized list of parses with the passed list, calling $parser->setParserManager($this) on each one.

Properties

$parsers

protected array<string|int, IParser> $parsers = []

List of parsers in order of priority (0 is highest priority).

Methods

createParserProxyFor()

Creates a ParserPartProxy for the passed $partBuilder using a compatible IParser.

public createParserProxyFor(PartBuilder $partBuilder) : ParserPartProxy

Loops through registered IParsers calling 'canParse()' on each with the passed PartBuilder, then calling either 'getParserMessageProxyFactory()' or 'getParserPartProxyFactory()' depending on if the PartBuilder has a parent, and finally calling 'newInstance' on the returned ParserPartProxyFactory passing it the IParser, and returning the new ParserPartProxy instance that was created.

Parameters
$partBuilder : PartBuilder

The PartBuilder to wrap in a proxy with an IParser

Return values
ParserPartProxy

The created ParserPartProxy tied to a new IMessagePart and associated IParser.

prependParser()

Adds an IParser at the highest priority (up front), calling $parser->setParserManager($this) on it.

public prependParser(IParser $parser) : mixed
Parameters
$parser : IParser

The parser to add.

Return values
mixed

setParsers()

Overrides the internal prioritized list of parses with the passed list, calling $parser->setParserManager($this) on each one.

public setParsers(array<string|int, mixed> $parsers) : mixed
Parameters
$parsers : array<string|int, mixed>
Return values
mixed

Search results