|
Erebot
latest
A modular IRC bot for PHP 5.3+
|
Abstract class for a minimal PHP stream wrapper. More...
Inheritance diagram for Erebot\StreamWrapperBase:Public Member Functions | |
| __construct () | |
| Constructs a new instance of this stream wrapper. More... | |
| stream_close () | |
| Close a resource. More... | |
| stream_eof () | |
| Tests for end-of-file on a file pointer. More... | |
| stream_open ($path, $mode, $options, &$openedPath) | |
| Opens file or URL. More... | |
| stream_read ($count) | |
| Read from stream. More... | |
| stream_seek ($offset, $whence) | |
| Seeks to specific location in a stream. More... | |
| stream_stat () | |
| Retrieve information about a file resource. More... | |
| stream_tell () | |
| Retrieve the current position of a stream. More... | |
| url_stat ($path, $flags) | |
| Retrieve information about a file. More... | |
Public Attributes | |
| const | SEEK_CUR = SEEK_CUR |
| Set position to current location plus offset. | |
| const | SEEK_END = SEEK_END |
| Set position to end-of-file plus offset. | |
| const | SEEK_SET = SEEK_SET |
| Set position equal to offset bytes. | |
| const | STREAM_REPORT_ERRORS = STREAM_REPORT_ERRORS |
| Whether the stream wrapper should report errors or not. More... | |
| const | STREAM_URL_STAT_LINK = STREAM_URL_STAT_LINK |
| For links, whether to return information about the link itself or the resource it links to. More... | |
| const | STREAM_URL_STAT_QUIET = STREAM_URL_STAT_QUIET |
| Whether to report errors in Erebot::StreamWrapperBase::url_stat() or not. More... | |
| const | STREAM_USE_PATH = STREAM_USE_PATH |
| If path is relative, search for the resource using the include_path. | |
Abstract class for a minimal PHP stream wrapper.
Definition at line 28 of file StreamWrapperBase.php.
| Erebot\StreamWrapperBase::__construct | ( | ) |
Constructs a new instance of this stream wrapper.
This method is called when opening the stream wrapper, right before Erebot::StreamWrapperBase::stream_open().
Definition at line 84 of file StreamWrapperBase.php.
|
abstract |
Close a resource.
This method is called in response to fclose(). All resources that were locked, or allocated, by the wrapper should be released.
|
abstract |
Tests for end-of-file on a file pointer.
This method is called in response to feof().
| bool | true if the read/write position is at the end of the stream and if no more data is available to be read, or false otherwise. |
|
abstract |
Opens file or URL.
This method is called immediately after the wrapper is initialized (f.e. by fopen() and file_get_contents()).
| string | $path | Specifies the URL that was passed to the original function. |
| string | $mode | The mode used to open the file, as detailed for fopen(). |
| int | $options | Holds additional flags set by the streams API. It can hold one or more of the flags defined in thisinterface, OR'd together. |
| string | $openedPath | If the path is opened successfully, and Erebot::StreamWrapperBase::STREAM_USE_PATH is set in $options, $opened_path should be set to the full path of the file/resource that was actually opened. |
| bool | true on success or false on failure. |
| Erebot\StreamWrapperBase::stream_read | ( | $count | ) |
Read from stream.
This method is called in response to fread() and fgets().
| int | $count | How many bytes of data from the current position should be returned. |
| string | If there are less than count bytes available, returns as many as are available. |
| false | If no more data is available, false should be returned. |
Definition at line 176 of file StreamWrapperBase.php.
| Erebot\StreamWrapperBase::stream_seek | ( | $offset, | |
| $whence | |||
| ) |
Seeks to specific location in a stream.
This method is called in response to fseek().
| int | $offset | The stream offset to seek to. |
| int | $whence | How the seek is to be interpreted. One of: |
| bool | true if the position was updated, false otherwise. |
Definition at line 212 of file StreamWrapperBase.php.
| Erebot\StreamWrapperBase::stream_stat | ( | ) |
Retrieve information about a file resource.
This method is called in response to fstat().
| array | Same as for http://php.net/manual/en/function.stat.php. |
Definition at line 231 of file StreamWrapperBase.php.
|
abstract |
Retrieve the current position of a stream.
This method is called in response to ftell().
| int | The current position of the stream. |
| Erebot\StreamWrapperBase::url_stat | ( | $path, | |
| $flags | |||
| ) |
Retrieve information about a file.
This method is called in response to all stat() related functions.
| string | $path | The file path or URL to stat. Note that in the case of a URL, it must be a :// delimited URL. Other URL forms are not supported. |
| int | $flags | Holds additional flags set by the streams API. It can hold one or more of the following values OR'd together: |
Definition at line 268 of file StreamWrapperBase.php.
| const Erebot\StreamWrapperBase::STREAM_REPORT_ERRORS = STREAM_REPORT_ERRORS |
Whether the stream wrapper should report errors or not.
If this flag is set, the wrapper is responsible for raising errors using trigger_error() during opening of the stream. If this flag is not set, it should not raise any errors.
Definition at line 41 of file StreamWrapperBase.php.
| const Erebot\StreamWrapperBase::STREAM_URL_STAT_LINK = STREAM_URL_STAT_LINK |
For links, whether to return information about the link itself or the resource it links to.
For resources with the ability to link to other resource (such as an HTTP Location: forward, or a filesystem symlink). This flag specified that only information about the link itself should be returned, not the resource pointed to by the link. This flag is set in response to calls to lstat(), is_link(), or filetype().
Definition at line 55 of file StreamWrapperBase.php.
| const Erebot\StreamWrapperBase::STREAM_URL_STAT_QUIET = STREAM_URL_STAT_QUIET |
Whether to report errors in Erebot::StreamWrapperBase::url_stat() or not.
If this flag is set, the wrapper should not raise any errors. If this flag is not set, it is responsible for reporting errors using the trigger_error() function during stating of the path.
Definition at line 66 of file StreamWrapperBase.php.