Documentation

StringWrapper
in package

A stream wrapper that will treat a native PHP string as a stream.

Tags
author

Chuck Hagenbuch chuck@horde.org

author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2007-2017 Horde LLC

license

http://www.horde.org/licenses/bsd BSD

Table of Contents

WRAPPER_NAME  = 'horde-stream-wrapper-string'
$context  : resource
The current context.
$pos  : int
String position.
$string  : string
The string.
$id  : int
Unique ID tracker for the streams.
getStream()  : resource|false
Create a stream from a PHP string.
stream_close()  : void
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-string'

Properties

$id

Unique ID tracker for the streams.

private static int $id = 0

Methods

getStream()

Create a stream from a PHP string.

public static getStream(string &$string) : resource|false
Parameters
$string : string

A PHP string variable.

Tags
since
2.1.0
Return values
resource|false

A PHP stream pointing to the variable.

stream_close()

public stream_close() : void
Tags
see
streamWrapper::stream_close()
Return values
void

stream_eof()

public stream_eof() : bool
Tags
see
streamWrapper::stream_eof()
Return values
bool

stream_open()

public stream_open(string $path, string $mode, int $options, string|null &$opened_path) : bool
Parameters
$path : string
$mode : string
$options : int
$opened_path : string|null
Tags
see
streamWrapper::stream_open()
Return values
bool

stream_read()

public stream_read(int $count) : string
Parameters
$count : int
Tags
see
streamWrapper::stream_read()
Return values
string

stream_seek()

public stream_seek(int $offset[, int $whence = SEEK_SET ]) : bool
Parameters
$offset : int
$whence : int = SEEK_SET
Tags
see
streamWrapper::stream_seek()
Return values
bool

stream_stat()

public stream_stat() : array<string|int, int>
Tags
see
streamWrapper::stream_stat()
Return values
array<string|int, int>

stream_tell()

public stream_tell() : int
Tags
see
streamWrapper::stream_tell()
Return values
int

stream_write()

public stream_write(string $data) : int
Parameters
$data : string
Tags
see
streamWrapper::stream_write()

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.

Return values
int

Search results