Copied!

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.

CloneableInstantiable
Methods
public __construct(ZBateson\MailMimeParser\Parser\MimeParserService $mimeParser, ZBateson\MailMimeParser\Parser\NonMimeParserService $nonMimeParser)
public createParserProxyFor(ZBateson\MailMimeParser\Parser\PartBuilder $partBuilder) : ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy
 

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

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.

  • param \PartBuilder $partBuilder The PartBuilder to wrap in a proxy with an IParser
  • throws \CompatibleParserNotFoundException if a compatible parser for the type is not configured.
  • return \ParserPartProxy The created ParserPartProxy tied to a new IMessagePart and associated IParser.
public prependParser(ZBateson\MailMimeParser\Parser\IParserService $parser) : static
 

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

  • param \IParserService $parser The parser to add.
public setParsers(array $parsers) : static
 

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

  • param \IParserService[] $parsers
Properties
protected array $parsers = []
 
  • var \IParserService[] List of parsers in order of priority (0 is highest priority).
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration