UUDecodeStreamFilter extends php_user_filter
Stream filter converts uuencoded text to its raw binary.
Tags
Table of Contents
- STREAM_FILTER_NAME = 'mailmimeparser-uudecode'
- Name used when registering with stream_filter_register.
- $leftover : string
- filter() : int
- Filter implementation converts encoding before returning PSFS_PASS_ON.
- filterBucketLines() : string
- Filters the lines in the passed $lines array, returning a concatenated string of decoded lines.
- filterLine() : string
- Filters a single line of encoded input. Returns NULL if the end has been reached.
- getLines() : array<string|int, string>
- Returns an array of complete lines (including line endings) from the passed $bucket object.
- isEmptyOrStartLine() : bool
- Returns true if the passed $line is empty or matches the beginning header pattern for a uuencoded message.
- isEndLine() : bool
- Returns true if the passed $line is either a backtick character '`' or the string 'end' signifying the end of the uuencoded message.
Constants
STREAM_FILTER_NAME
Name used when registering with stream_filter_register.
public
mixed
STREAM_FILTER_NAME
= 'mailmimeparser-uudecode'
Properties
$leftover
private
string
$leftover
= ''
Methods
filter()
Filter implementation converts encoding before returning PSFS_PASS_ON.
public
filter(resource $in, resource $out, int &$consumed, bool $closing) : int
Parameters
- $in : resource
- $out : resource
- $consumed : int
- $closing : bool
Return values
int —filterBucketLines()
Filters the lines in the passed $lines array, returning a concatenated string of decoded lines.
private
filterBucketLines(array<string|int, mixed> $lines, int &$consumed) : string
Parameters
- $lines : array<string|int, mixed>
- $consumed : int
Return values
string —filterLine()
Filters a single line of encoded input. Returns NULL if the end has been reached.
private
filterLine(string $line) : string
Parameters
- $line : string
Return values
string —the decoded line
getLines()
Returns an array of complete lines (including line endings) from the passed $bucket object.
private
getLines(object $bucket) : array<string|int, string>
If the last line on $bucket is incomplete, it's assigned to $this->leftover and prepended to the first element of the first line in the next call to getLines.
Parameters
- $bucket : object
Return values
array<string|int, string> —isEmptyOrStartLine()
Returns true if the passed $line is empty or matches the beginning header pattern for a uuencoded message.
private
isEmptyOrStartLine(string $line) : bool
Parameters
- $line : string
Return values
bool —isEndLine()
Returns true if the passed $line is either a backtick character '`' or the string 'end' signifying the end of the uuencoded message.
private
isEndLine(string $line) : bool
Parameters
- $line : string