PartStreamFilterManager
Manages attached stream filters for a MessagePart's content resource handle.
The attached stream filters are: o Content-Transfer-Encoding filter to manage decoding from a supported encoding: quoted-printable, base64 and x-uuencode. o Charset conversion filter to convert to UTF-8
Tags
Table of Contents
- $charsetStream : StreamInterface
- $decodedStream : StreamInterface
- $stream : StreamInterface
- $charset : array<string|int, mixed>
- $encoding : array<string|int, mixed>
- $streamFactory : StreamFactory
- __construct() : mixed
- Sets up filter names used for stream_filter_append
- getBinaryStream() : StreamInterface
- Checks what transfer-encoding decoder stream is attached on the underlying stream, and resets it if the requested arguments differ.
- getContentStream() : StreamInterface
- Checks what transfer-encoding decoder stream and charset conversion stream are currently attached on the underlying stream, and resets them if the requested arguments differ from the currently assigned ones.
- reset() : mixed
- Resets cached encoding and charset streams, and rewinds the stream.
- setStream() : mixed
- Sets the URL used to open the content resource handle.
- attachCharsetFilter() : mixed
- Attaches a charset conversion filter to the attached content handle, for the passed arguments.
- attachTransferEncodingFilter() : mixed
- Attaches a decoding filter to the attached content handle, for the passed $transferEncoding.
- isCharsetFilterChanged() : bool
- Returns true if the attached stream filter used for charset conversion on the current handle is different from the one needed based on the passed arguments.
- isTransferEncodingFilterChanged() : bool
- Returns true if the attached stream filter used for decoding the content on the current handle is different from the one passed as an argument.
- resetCharsetStream() : mixed
- Resets just the charset stream, and rewinds the decodedStream.
Properties
$charsetStream
protected
StreamInterface
$charsetStream
$decodedStream
protected
StreamInterface
$decodedStream
$stream
protected
StreamInterface
$stream
$charset
private
array<string|int, mixed>
$charset
= ['from' => null, 'to' => null, 'filter' => null]
$encoding
private
array<string|int, mixed>
$encoding
= ['type' => null, 'filter' => null]
$streamFactory
private
StreamFactory
$streamFactory
Methods
__construct()
Sets up filter names used for stream_filter_append
public
__construct(StreamFactory $streamFactory) : mixed
Parameters
- $streamFactory : StreamFactory
Return values
mixed —getBinaryStream()
Checks what transfer-encoding decoder stream is attached on the underlying stream, and resets it if the requested arguments differ.
public
getBinaryStream(string $transferEncoding) : StreamInterface
Parameters
- $transferEncoding : string
Return values
StreamInterface —getContentStream()
Checks what transfer-encoding decoder stream and charset conversion stream are currently attached on the underlying stream, and resets them if the requested arguments differ from the currently assigned ones.
public
getContentStream(string $transferEncoding, string $fromCharset, string $toCharset) : StreamInterface
Parameters
- $transferEncoding : string
- $fromCharset : string
-
the character set the content is encoded in
- $toCharset : string
-
the target encoding to return
Return values
StreamInterface —reset()
Resets cached encoding and charset streams, and rewinds the stream.
public
reset() : mixed
Return values
mixed —setStream()
Sets the URL used to open the content resource handle.
public
setStream([StreamInterface $stream = null ]) : mixed
The function also closes the currently attached handle if any.
Parameters
- $stream : StreamInterface = null
Return values
mixed —attachCharsetFilter()
Attaches a charset conversion filter to the attached content handle, for the passed arguments.
protected
attachCharsetFilter(string $fromCharset, string $toCharset) : mixed
Parameters
- $fromCharset : string
-
the character set the content is encoded in
- $toCharset : string
-
the target encoding to return
Return values
mixed —attachTransferEncodingFilter()
Attaches a decoding filter to the attached content handle, for the passed $transferEncoding.
protected
attachTransferEncodingFilter(string $transferEncoding) : mixed
Parameters
- $transferEncoding : string
Return values
mixed —isCharsetFilterChanged()
Returns true if the attached stream filter used for charset conversion on the current handle is different from the one needed based on the passed arguments.
private
isCharsetFilterChanged(string $fromCharset, string $toCharset) : bool
Parameters
- $fromCharset : string
- $toCharset : string
Return values
bool —isTransferEncodingFilterChanged()
Returns true if the attached stream filter used for decoding the content on the current handle is different from the one passed as an argument.
private
isTransferEncodingFilterChanged(string $transferEncoding) : bool
Parameters
- $transferEncoding : string
Return values
bool —resetCharsetStream()
Resets just the charset stream, and rewinds the decodedStream.
private
resetCharsetStream() : mixed