StreamWrapper
Allows PSR-7 streams to be used as PHP streams.
class StreamWrapperBased on Guzzle PSR7 stream wrapper and MongoDB's PHP library stream wrapper.
- Copyright
- 2015-2016 Appertly
- License
- Apache-2.0
Instance Properties
| Name | Type | Summary |
|---|---|---|
$context | resource | The stream context |
Instance Methods
| Returns | Signature and Description |
|---|---|
bool | |
void | stream_open(, , , ) |
string | stream_read() |
bool | stream_seek(, ) |
array<arraykey,int> | |
int | |
int | stream_write() |
Static Methods
| Returns | Signature and Description |
|---|---|
resource | getResource()Gets a PHP stream resource for the provided PSR-7 stream. |
void | register()Registers this stream wrapper |
void | Unregisters this stream wrapper |
Property Details
$context
public
resource $contextThe stream context
Method Details
getResource
public static function
getResource(StreamInterface $stream)Gets a PHP stream resource for the provided PSR-7 stream.
| Name | Type | Description |
|---|---|---|
$stream | StreamInterface | The stream to wrap |
| Type | Description |
|---|---|
resource | The generated resource |
| Type | Conditions |
|---|---|
InvalidArgumentException | if stream is not readable or writable |
register
public static function
register()Registers this stream wrapper
stream_eof
public function
stream_eof()| Type | Description |
|---|---|
bool |
stream_open
public function
stream_open(string $path, string $mode, int $options, ?string &"$opened_path)| Name | Type | Description |
|---|---|---|
$path | string | |
$mode | string | |
$options | int | |
$opened_path | ?string |
| Type | Description |
|---|---|
void |
stream_read
public function
stream_read(int $count)| Name | Type | Description |
|---|---|---|
$count | int |
| Type | Description |
|---|---|
string |
stream_seek
public function
stream_seek(int $offset, int $whence = SEEK_SET)| Name | Type | Description |
|---|---|---|
$offset | int | |
$whence | int |
| Type | Description |
|---|---|
bool |
stream_stat
public function
stream_stat()| Type | Description |
|---|---|
array<arraykey,int> |
stream_tell
public function
stream_tell()| Type | Description |
|---|---|
int |
stream_write
public function
stream_write(string $data)| Name | Type | Description |
|---|---|---|
$data | string |
| Type | Description |
|---|---|
int |
unregister
public static function
unregister()Unregisters this stream wrapper