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\MimeParser $mimeParser, ZBateson\MailMimeParser\Parser\NonMimeParser $nonMimeParser)
public createParserProxyFor(ZBateson\MailMimeParser\Parser\PartBuilder $partBuilder)
 

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
  • return ?\ParserPartProxy The created ParserPartProxy tied to a new IMessagePart and associated IParser.
public prependParser(ZBateson\MailMimeParser\Parser\IParser $parser) : self
 

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

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

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

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