Erebot  latest
A modular IRC bot for PHP 5.3+
StreamWrapperBase.php
1 <?php
2 /*
3  This file is part of Erebot, a modular IRC bot written in PHP.
4 
5  Copyright © 2010 François Poirotte
6 
7  Erebot is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Erebot is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Erebot. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 // @codingStandardsIgnoreFile
22 namespace Erebot;
23 
28 abstract class StreamWrapperBase
29 {
31  const STREAM_USE_PATH = STREAM_USE_PATH;
32 
41  const STREAM_REPORT_ERRORS = STREAM_REPORT_ERRORS;
42 
55  const STREAM_URL_STAT_LINK = STREAM_URL_STAT_LINK;
56 
66  const STREAM_URL_STAT_QUIET = STREAM_URL_STAT_QUIET;
67 
69  const SEEK_SET = SEEK_SET;
70 
72  const SEEK_CUR = SEEK_CUR;
73 
75  const SEEK_END = SEEK_END;
76 
84  public function __construct()
85  {
86  }
87 
96  abstract public function stream_close();
97 
109  abstract public function stream_eof();
110 
145  abstract public function stream_open($path, $mode, $options, &$openedPath);
146 
176  public function stream_read($count)
177  {
178  return false;
179  }
180 
212  public function stream_seek($offset, $whence)
213  {
214  return false;
215  }
216 
231  public function stream_stat()
232  {
233  return array();
234  }
235 
245  abstract public function stream_tell();
246 
268  public function url_stat($path, $flags)
269  {
270  return array();
271  }
272 }
__construct()
Constructs a new instance of this stream wrapper.
Definition: CLI.php:21
url_stat($path, $flags)
Retrieve information about a file.
const SEEK_END
Set position to end-of-file plus offset.
stream_seek($offset, $whence)
Seeks to specific location in a stream.
stream_read($count)
Read from stream.
const SEEK_SET
Set position equal to offset bytes.
const STREAM_USE_PATH
If path is relative, search for the resource using the include_path.
const SEEK_CUR
Set position to current location plus offset.
const STREAM_URL_STAT_LINK
For links, whether to return information about the link itself or the resource it links to...
const STREAM_URL_STAT_QUIET
Whether to report errors in Erebot::StreamWrapperBase::url_stat() or not.
stream_stat()
Retrieve information about a file resource.
const STREAM_REPORT_ERRORS
Whether the stream wrapper should report errors or not.
Abstract class for a minimal PHP stream wrapper.