Copied!

A part stream container that proxies requests for content streams to a parser to read the content.

Keeps reference to the original stream a part was parsed from, using that stream as the part's stream instead of the PartStreamContainer's MessagePartStream (which dynamically creates a stream from an IMessagePart) unless the part changed.

The ParserPartStreamContainer must also be attached to its underlying part with SplSubject::attach() so the ParserPartStreamContainer gets notified of any changes.

CloneableInstantiable
Methods
public __construct(Psr\Log\LoggerInterface $logger, ZBateson\MailMimeParser\Stream\StreamFactory $streamFactory, ZBateson\MbWrapper\MbWrapper $mbWrapper, bool $throwExceptionReadingPartContentFromUnsupportedCharsets, ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy $parserProxy)
public __destruct()
public ZBateson\MailMimeParser\ErrorBag::addError(string $message, string $psrLogLevel, ?Throwable $exception = NULL) : static
public ZBateson\MailMimeParser\ErrorBag::getAllErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : array
public getBinaryContentStream(ZBateson\MailMimeParser\Message\IMessagePart $part, ?string $transferEncoding = NULL) : ?Psr\Http\Message\StreamInterface
public getContentStream(ZBateson\MailMimeParser\Message\IMessagePart $part, ?string $transferEncoding, ?string $fromCharset, ?string $toCharset) : ?Psr\Http\Message\StreamInterface
public ZBateson\MailMimeParser\ErrorBag::getErrorLoggingContextName() : string
 

Returns the class name. Override to identify objects in logs.

public ZBateson\MailMimeParser\ErrorBag::getErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : array
public getStream() : Psr\Http\Message\StreamInterface
public ZBateson\MailMimeParser\ErrorBag::hasAnyErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : bool
public hasContent() : bool
public ZBateson\MailMimeParser\ErrorBag::hasErrors(bool $validate = false, string $minPsrLevel = 'error'Psr\Log\LogLevel::ERROR) : bool
public ZBateson\MailMimeParser\Message\PartStreamContainer::reset() : static
 

Resets cached encoding and charset streams, and rewinds the stream.

public setContentStream(?Psr\Http\Message\StreamInterface $contentStream = NULL) : static
public ZBateson\MailMimeParser\Message\PartStreamContainer::setStream(Psr\Http\Message\StreamInterface $stream) : static
 

Sets the part's stream containing the part's headers, content, and children.

public update(SplSubject $subject) : void
Properties
protected ?Psr\Http\Message\StreamInterface ZBateson\MailMimeParser\Message\PartStreamContainer::$charsetStream = NULL
 
  • var \StreamInterface attached charset stream to $decodedStream
protected bool $contentParseRequested = false
 
  • var bool false if the content for the part represented by this container has not yet been requested from the parser.
protected ?Psr\Http\Message\StreamInterface ZBateson\MailMimeParser\Message\PartStreamContainer::$contentStream = NULL
 
  • var \StreamInterface a stream containing this part's content
protected ?Psr\Http\Message\StreamInterface ZBateson\MailMimeParser\Message\PartStreamContainer::$decodedStream = NULL
 
  • var \StreamInterface the content stream after attaching transfer encoding streams to $contentStream.
protected bool ZBateson\MailMimeParser\Message\PartStreamContainer::$detachParsedStream = false
 
  • var bool true if the stream should be detached when this container is destroyed.
protected Psr\Log\LoggerInterface ZBateson\MailMimeParser\ErrorBag::$logger
protected readonly ZBateson\MbWrapper\MbWrapper ZBateson\MailMimeParser\Message\PartStreamContainer::$mbWrapper
protected ?Psr\Http\Message\StreamInterface $parsedStream = NULL
 
  • var \StreamInterface|null the original stream for a parsed message, used when the message hasn't changed
protected readonly ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy $parserProxy
protected bool $partUpdated = false
 
  • var bool set to true if the part's been updated since it was created.
protected Psr\Http\Message\StreamInterface ZBateson\MailMimeParser\Message\PartStreamContainer::$stream
 
  • var \StreamInterface stream containing the part's headers, content and children
protected readonly ZBateson\MailMimeParser\Stream\StreamFactory ZBateson\MailMimeParser\Message\PartStreamContainer::$streamFactory
protected readonly bool ZBateson\MailMimeParser\Message\PartStreamContainer::$throwExceptionReadingPartContentFromUnsupportedCharsets
Methods
protected ZBateson\MailMimeParser\Message\PartStreamContainer::attachCharsetFilter(string $fromCharset, string $toCharset) : static
 

Attaches a charset conversion filter to the attached content handle, for the passed arguments.

  • param string $fromCharset the character set the content is encoded in
  • param string $toCharset the target encoding to return
protected ZBateson\MailMimeParser\Message\PartStreamContainer::attachTransferEncodingFilter(?string $transferEncoding) : static
 

Attaches a decoding filter to the attached content handle, for the passed $transferEncoding.

protected ZBateson\MailMimeParser\Message\PartStreamContainer::getErrorBagChildren() : array
protected requestParsedContentStream() : static
 

Requests content from the parser if not previously requested, and calls PartStreamContainer::setContentStream().

protected requestParsedStream() : static
 

Ensures the parser has parsed the entire part, and sets $this->parsedStream to the original parsed stream (or a limited part of it corresponding to the current part this stream container belongs to).

protected ZBateson\MailMimeParser\ErrorBag::validate() : void
 

Perform any extra validation and call 'addError'.

getErrors and getAllErrors call validate() if their $validate parameter is true. validate() is only called once on an object with getErrors getAllErrors.

© 2026 Bruce Wells
Search Namespaces \ Classes
Configuration