GuzzleHttp\Psr7 stream decoder decorator for quoted printable streams.
- author Zaahid Bateson
- Implements
Psr\Http\Message\StreamInterface Stringable - Traits
Methods |
public __call(string $method, array $args) Allow decorators to implement custom methods
|
public __construct(Psr\Http\Message\StreamInterface $stream)
|
public __get(string $name) Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).
|
public __toString() : string |
public close() : void
|
public detach()
|
public eof() : bool |
public getContents() : string |
public getMetadata( $key = NULL)
|
public getSize() : ?int Returns null, getSize isn't supported
|
public isReadable() : bool |
public isSeekable() : bool Overridden to return false |
public isWritable() : bool |
public read( $length) : string Reads up to $length decoded bytes from the underlying quoted-printable encoded stream and returns them.
|
public rewind() : void |
public seek( $offset, $whence = 0ZBateson\StreamDecorators\SEEK_SET) : void Not supported.
|
public tell() : int Overridden to return the position in the target encoding. |
public write( $string) : int Writes the passed string to the underlying stream after encoding it as quoted-printable. Note that reading and writing to the same stream without rewinding is not supported.
|
Methods |
protected createStream() : Psr\Http\Message\StreamInterface Implement in subclasses to dynamically create streams when requested.
|
Properties |
private string $lastLine = ''
|
private int $position = 0
|
private Psr\Http\Message\StreamInterface $stream
|
Methods |
private beforeClose() : void Writes out a final CRLF if the current line isn't empty. |
private decodeBlock(string $block) : string Decodes the passed $block of text. If the last or before last character is an '=' char, indicating the beginning of a quoted-printable encoded char, 1 or 2 additional bytes are read from the underlying stream respectively.
|
private readEncodedChars(int $length, string $pre = '') : string Reads $length chars from the underlying stream, prepending the past $pre to it first. If the characters read (including the prepended $pre) contain invalid quoted-printable characters, the underlying stream is rewound by the total number of characters ($length + strlen($pre)). The quoted-printable encoded characters are returned. If the characters read are invalid, '3D' is returned indicating an '=' character. |
private readRawDecodeAndAppend(int $length, string $str) : int Reads up to $length characters, appends them to the passed $str string, and returns the total number of characters read. -1 is returned if there are no more bytes to read. |