28 if (0 >= $maxLineLength || 76 < $maxLineLength) {
33 $base64ReadBufferRemainderBytes = null;
43 $readBytes = $os->
read(8192);
44 $atEOF = ($readBytes ===
false);
47 $streamTheseBytes = $base64ReadBufferRemainderBytes;
49 $streamTheseBytes = $base64ReadBufferRemainderBytes.$readBytes;
51 $base64ReadBufferRemainderBytes = null;
52 $bytesLength = strlen($streamTheseBytes);
54 if ($bytesLength === 0) {
61 $excessBytes = $bytesLength % 3;
62 if ($excessBytes !== 0) {
63 $base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);
64 $streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);
68 $encoded = base64_encode($streamTheseBytes);
69 $encodedTransformed =
'';
70 $thisMaxLineLength = $maxLineLength - $remainder - $firstLineOffset;
72 while ($thisMaxLineLength < strlen(
$encoded)) {
73 $encodedTransformed .= substr(
$encoded, 0, $thisMaxLineLength).
"\r\n";
76 $thisMaxLineLength = $maxLineLength;
80 if (0 < $remainingLength = strlen(
$encoded)) {
81 $remainder += $remainingLength;
86 $is->
write($encodedTransformed);