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.

public __construct(ZBateson\MailMimeParser\Stream\StreamFactory $streamFactory, ZBateson\MailMimeParser\Parser\Proxy\ParserPartProxy $parserProxy)
public __destruct()
public getBinaryContentStream(?string $transferEncoding = NULL) : ?Psr\Http\Message\StreamInterface
public getContentStream(?string $transferEncoding, ?string $fromCharset, ?string $toCharset)
public getStream()
public hasContent() : bool
public ZBateson\MailMimeParser\Message\PartStreamContainer::reset()

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

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

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

public update(SplSubject $subject) : void
protected ZBateson\MailMimeParser\Message\PartStreamContainer::$charsetStream = NULL
  • var \StreamInterface attached charset stream to $decodedStream
protected $contentParseRequested = false
  • var bool false if the content for the part represented by this container
    has not yet been requested from the parser.
protected ZBateson\MailMimeParser\Message\PartStreamContainer::$contentStream = NULL
  • var \StreamInterface a stream containing this part's content
protected ZBateson\MailMimeParser\Message\PartStreamContainer::$decodedStream = NULL
  • var \StreamInterface the content stream after attaching transfer encoding
    streams to $contentStream.
protected $detachParsedStream = false
  • var bool true if the stream should be detached when this container is
    destroyed (thereby not closing the stream).
protected $parsedStream = NULL
  • var \StreamInterface the original stream for a parsed message, used when
    the message hasn't changed
protected $parserProxy = NULL
  • var \ParserPartProxy The parser proxy to ferry requests to on-demand.
protected $partUpdated = false
  • var bool set to true if the part's been updated since it was created.
protected ZBateson\MailMimeParser\Message\PartStreamContainer::$stream = NULL
  • var \StreamInterface stream containing the part's headers, content and
protected ZBateson\MailMimeParser\Message\PartStreamContainer::$streamFactory = NULL
  • var \StreamFactory used to apply psr7 stream decorators to the
    attached StreamInterface based on encoding.
protected ZBateson\MailMimeParser\Message\PartStreamContainer::attachCharsetFilter(string $fromCharset, string $toCharset) : self

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) : self

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

  • param string $transferEncoding
protected requestParsedContentStream() : self

Requests content from the parser if not previously requested, and calls

protected requestParsedStream() : self

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).

© 2023 Bruce Wells
Search Namespaces \ Classes