MailMimeParser 3.0

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

Properties

$parsers

protected array<string|int, mixed> $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

Tags
throws
CompatibleParserNotFoundException

if a compatible parser for the type is not configured.

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(IParserService $parser) : static
Parameters
$parser : IParserService

The parser to add.

Return values
static

setParsers()

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

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

Search results