MailMimeParser 2.4

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|null
Creates a ParserPartProxy for the passed $partBuilder using a compatible IParser.
prependParser()  : self
Adds an IParser at the highest priority (up front), calling $parser->setParserManager($this) on it.
setParsers()  : self
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|null

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|null

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) : self
Parameters
$parser : IParser

The parser to add.

Return values
self

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) : self
Parameters
$parsers : array<string|int, mixed>
Return values
self

Search results