CombineWrapper
in package
A stream wrapper that will combine multiple strings/streams into a single stream. Stream Wrappers implement method signatures defined in the builtin class streamWrapper but they do not need to inherit from it. Not all methods of streamWrapper need to be implemented. We follow the signatures as defined in the php manual
Tags
Table of Contents
Constants
- WRAPPER_NAME = 'horde-stream-wrapper-combine'
Properties
- $context : resource
- Context.
- $ateof : bool
- Have we reached EOF?
- $data : array<string|int, mixed>
- Array that holds the various streams.
- $datapos : int
- The current position in the data array.
- $length : int
- The combined length of the stream.
- $position : int
- The current position in the string.
- $id : int
- Unique ID tracker for the streams.
Methods
- getStream() : resource|false
- Create a stream from multiple data sources.
- stream_eof() : bool
- stream_open() : bool
- stream_read() : string
- stream_seek() : bool
- stream_stat() : array<string|int, int>
- stream_tell() : int
- stream_write() : int
Constants
WRAPPER_NAME
public
mixed
WRAPPER_NAME
= 'horde-stream-wrapper-combine'
Properties
$context
Context.
public
resource
$context
$ateof
Have we reached EOF?
protected
bool
$ateof
= false
$data
Array that holds the various streams.
protected
array<string|int, mixed>
$data
= []
$datapos
The current position in the data array.
protected
int
$datapos
= 0
$length
The combined length of the stream.
protected
int
$length
= 0
$position
The current position in the string.
protected
int
$position
= 0
$id
Unique ID tracker for the streams.
private
static int
$id
= 0
Methods
getStream()
Create a stream from multiple data sources.
public
static getStream(array<string|int, mixed> $data) : resource|false
Parameters
- $data : array<string|int, mixed>
-
An array of strings and/or streams to combine into a single stream.
Tags
Return values
resource|false —A PHP stream.
stream_eof()
public
stream_eof() : bool
Tags
Return values
boolstream_open()
public
stream_open(string $path, string $mode, int $options[, string|null &$opened_path = null ]) : bool
Parameters
- $path : string
- $mode : string
- $options : int
- $opened_path : string|null = null
Tags
Return values
bool —success
stream_read()
public
stream_read(int $count) : string
Parameters
- $count : int
-
streamWrapper reference signature says it always returns string However the docs say further: If there are less than count byte If no more data is available, return either false or an empty string.
We follow the stricter interface and return empty string. This may break deriving class when upgrading from H5.
Tags
Return values
stringstream_seek()
public
stream_seek(int $offset, int $whence) : bool
Parameters
- $offset : int
- $whence : int
-
SEEK_SET, SEEK_CUR, or SEEK_END
Tags
Return values
boolstream_stat()
public
stream_stat() : array<string|int, int>
Tags
Return values
array<string|int, int>stream_tell()
public
stream_tell() : int
Tags
Return values
intstream_write()
public
stream_write(string $data) : int
Parameters
- $data : string
-
Previous versions returned int|false.
streamWrapper reference signature says it always returns int Should return the number of bytes that were successfully stored, or 0 if none could be stored.
This may break deriving class when upgrading from H5.