MessagePartStream
extends MessagePartStreamDecorator
in package
implements
SplObserver, StreamInterface
Provides a readable stream for a MessagePart.
Tags
Interfaces, Classes, Traits and Enums
- SplObserver
- StreamInterface
Table of Contents
- $appendStream : AppendStream|null
- $part : IMessagePart
- $stream : StreamInterface|null
- $streamFactory : StreamFactory
- $throwExceptionReadingPartContentFromUnsupportedCharsets : bool
- __construct() : mixed
- __destruct() : mixed
- read() : string
- Overridden to wrap exceptions in MessagePartReadException which provides 'getPart' to inspect the part the error occurs on.
- update() : void
- createStream() : StreamInterface
- Creates the underlying stream lazily when required.
- getBoundaryAndChildStreams() : array<string|int, StreamInterface>
- Creates an array of streams based on the attached part's mime boundary and child streams.
- getStreamsArray() : array<string|int, StreamInterface>
- Returns an array of Psr7 Streams representing the attached part and it's direct children.
- getCharsetDecoratorForStream() : StreamInterface
- Attaches and returns a CharsetStream decorator to the passed $stream.
Properties
$appendStream
protected
AppendStream|null
$appendStream
= null
$part
protected
IMessagePart
$part
The part to read from.
$stream
protected
StreamInterface|null
$stream
$streamFactory
protected
StreamFactory
$streamFactory
For creating needed stream decorators.
$throwExceptionReadingPartContentFromUnsupportedCharsets
protected
bool
$throwExceptionReadingPartContentFromUnsupportedCharsets
if false, saving a content stream with an unsupported charset will be written in the default charset, otherwise the stream will be created with the unsupported charset, and an exception will be thrown when read from.
Methods
__construct()
public
__construct(StreamFactory $sdf, IMessagePart $part, bool $throwExceptionReadingPartContentFromUnsupportedCharsets) : mixed
Parameters
- $sdf : StreamFactory
- $part : IMessagePart
- $throwExceptionReadingPartContentFromUnsupportedCharsets : bool
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —read()
Overridden to wrap exceptions in MessagePartReadException which provides 'getPart' to inspect the part the error occurs on.
public
read(int $length) : string
Parameters
- $length : int
Tags
Return values
string —update()
public
update(SplSubject $subject) : void
Parameters
- $subject : SplSubject
Return values
void —createStream()
Creates the underlying stream lazily when required.
protected
createStream() : StreamInterface
Return values
StreamInterface —getBoundaryAndChildStreams()
Creates an array of streams based on the attached part's mime boundary and child streams.
protected
getBoundaryAndChildStreams(IMimePart $part) : array<string|int, StreamInterface>
Parameters
- $part : IMimePart
-
passed in because $this->part is declared as IMessagePart
Return values
array<string|int, StreamInterface> —getStreamsArray()
Returns an array of Psr7 Streams representing the attached part and it's direct children.
protected
getStreamsArray() : array<string|int, StreamInterface>
Return values
array<string|int, StreamInterface> —getCharsetDecoratorForStream()
Attaches and returns a CharsetStream decorator to the passed $stream.
private
getCharsetDecoratorForStream(StreamInterface $stream) : StreamInterface
If the current attached IMessagePart doesn't specify a charset, $stream is returned as-is.
Parameters
- $stream : StreamInterface