Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\StreamWrapper;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Defines a generic PHP stream wrapper interface.
|
Chris@0
|
7 *
|
Chris@0
|
8 * @see http://php.net/manual/class.streamwrapper.php
|
Chris@0
|
9 */
|
Chris@0
|
10 interface PhpStreamWrapperInterface {
|
Chris@0
|
11
|
Chris@0
|
12 /**
|
Chris@0
|
13 * @return bool
|
Chris@0
|
14 */
|
Chris@0
|
15 public function dir_closedir();
|
Chris@0
|
16
|
Chris@0
|
17 /**
|
Chris@0
|
18 * @return bool
|
Chris@0
|
19 */
|
Chris@0
|
20 public function dir_opendir($path, $options);
|
Chris@0
|
21
|
Chris@0
|
22 /**
|
Chris@0
|
23 * @return string
|
Chris@0
|
24 */
|
Chris@0
|
25 public function dir_readdir();
|
Chris@0
|
26
|
Chris@0
|
27 /**
|
Chris@0
|
28 * @return bool
|
Chris@0
|
29 */
|
Chris@0
|
30 public function dir_rewinddir();
|
Chris@0
|
31
|
Chris@0
|
32 /**
|
Chris@0
|
33 * @return bool
|
Chris@0
|
34 */
|
Chris@0
|
35 public function mkdir($path, $mode, $options);
|
Chris@0
|
36
|
Chris@0
|
37 /**
|
Chris@0
|
38 * @return bool
|
Chris@0
|
39 */
|
Chris@0
|
40 public function rename($path_from, $path_to);
|
Chris@0
|
41
|
Chris@0
|
42 /**
|
Chris@0
|
43 * @return bool
|
Chris@0
|
44 */
|
Chris@0
|
45 public function rmdir($path, $options);
|
Chris@0
|
46
|
Chris@0
|
47 /**
|
Chris@0
|
48 * Retrieve the underlying stream resource.
|
Chris@0
|
49 *
|
Chris@0
|
50 * This method is called in response to stream_select().
|
Chris@0
|
51 *
|
Chris@0
|
52 * @param int $cast_as
|
Chris@0
|
53 * Can be STREAM_CAST_FOR_SELECT when stream_select() is calling
|
Chris@0
|
54 * stream_cast() or STREAM_CAST_AS_STREAM when stream_cast() is called for
|
Chris@0
|
55 * other uses.
|
Chris@0
|
56 *
|
Chris@0
|
57 * @return resource|false
|
Chris@0
|
58 * The underlying stream resource or FALSE if stream_select() is not
|
Chris@0
|
59 * supported.
|
Chris@0
|
60 *
|
Chris@0
|
61 * @see stream_select()
|
Chris@0
|
62 * @see http://php.net/manual/streamwrapper.stream-cast.php
|
Chris@0
|
63 */
|
Chris@0
|
64 public function stream_cast($cast_as);
|
Chris@0
|
65
|
Chris@0
|
66 /**
|
Chris@0
|
67 * Closes stream.
|
Chris@0
|
68 */
|
Chris@0
|
69 public function stream_close();
|
Chris@0
|
70
|
Chris@0
|
71 /**
|
Chris@0
|
72 * @return bool
|
Chris@0
|
73 */
|
Chris@0
|
74 public function stream_eof();
|
Chris@0
|
75
|
Chris@0
|
76 /**
|
Chris@0
|
77 * @return bool
|
Chris@0
|
78 */
|
Chris@0
|
79 public function stream_flush();
|
Chris@0
|
80
|
Chris@0
|
81 /**
|
Chris@0
|
82 * @return bool
|
Chris@0
|
83 */
|
Chris@0
|
84 public function stream_lock($operation);
|
Chris@0
|
85
|
Chris@0
|
86 /**
|
Chris@0
|
87 * Sets metadata on the stream.
|
Chris@0
|
88 *
|
Chris@0
|
89 * @param string $path
|
Chris@0
|
90 * A string containing the URI to the file to set metadata on.
|
Chris@0
|
91 * @param int $option
|
Chris@0
|
92 * One of:
|
Chris@0
|
93 * - STREAM_META_TOUCH: The method was called in response to touch().
|
Chris@0
|
94 * - STREAM_META_OWNER_NAME: The method was called in response to chown()
|
Chris@0
|
95 * with string parameter.
|
Chris@0
|
96 * - STREAM_META_OWNER: The method was called in response to chown().
|
Chris@0
|
97 * - STREAM_META_GROUP_NAME: The method was called in response to chgrp().
|
Chris@0
|
98 * - STREAM_META_GROUP: The method was called in response to chgrp().
|
Chris@0
|
99 * - STREAM_META_ACCESS: The method was called in response to chmod().
|
Chris@0
|
100 * @param mixed $value
|
Chris@0
|
101 * If option is:
|
Chris@0
|
102 * - STREAM_META_TOUCH: Array consisting of two arguments of the touch()
|
Chris@0
|
103 * function.
|
Chris@0
|
104 * - STREAM_META_OWNER_NAME or STREAM_META_GROUP_NAME: The name of the owner
|
Chris@0
|
105 * user/group as string.
|
Chris@0
|
106 * - STREAM_META_OWNER or STREAM_META_GROUP: The value of the owner
|
Chris@0
|
107 * user/group as integer.
|
Chris@0
|
108 * - STREAM_META_ACCESS: The argument of the chmod() as integer.
|
Chris@0
|
109 *
|
Chris@0
|
110 * @return bool
|
Chris@0
|
111 * Returns TRUE on success or FALSE on failure. If $option is not
|
Chris@0
|
112 * implemented, FALSE should be returned.
|
Chris@0
|
113 *
|
Chris@0
|
114 * @see http://php.net/manual/streamwrapper.stream-metadata.php
|
Chris@0
|
115 */
|
Chris@0
|
116 public function stream_metadata($path, $option, $value);
|
Chris@0
|
117
|
Chris@0
|
118 /**
|
Chris@0
|
119 * @return bool
|
Chris@0
|
120 */
|
Chris@0
|
121 public function stream_open($path, $mode, $options, &$opened_path);
|
Chris@0
|
122
|
Chris@0
|
123 /**
|
Chris@0
|
124 * @return string
|
Chris@0
|
125 */
|
Chris@0
|
126 public function stream_read($count);
|
Chris@0
|
127
|
Chris@0
|
128 /**
|
Chris@0
|
129 * Seeks to specific location in a stream.
|
Chris@0
|
130 *
|
Chris@0
|
131 * This method is called in response to fseek().
|
Chris@0
|
132 *
|
Chris@0
|
133 * The read/write position of the stream should be updated according to the
|
Chris@0
|
134 * offset and whence.
|
Chris@0
|
135 *
|
Chris@0
|
136 * @param int $offset
|
Chris@0
|
137 * The byte offset to seek to.
|
Chris@0
|
138 * @param int $whence
|
Chris@0
|
139 * Possible values:
|
Chris@0
|
140 * - SEEK_SET: Set position equal to offset bytes.
|
Chris@0
|
141 * - SEEK_CUR: Set position to current location plus offset.
|
Chris@0
|
142 * - SEEK_END: Set position to end-of-file plus offset.
|
Chris@0
|
143 * Defaults to SEEK_SET.
|
Chris@0
|
144 *
|
Chris@0
|
145 * @return bool
|
Chris@0
|
146 * TRUE if the position was updated, FALSE otherwise.
|
Chris@0
|
147 *
|
Chris@0
|
148 * @see http://php.net/manual/streamwrapper.stream-seek.php
|
Chris@0
|
149 */
|
Chris@0
|
150 public function stream_seek($offset, $whence = SEEK_SET);
|
Chris@0
|
151
|
Chris@0
|
152 /**
|
Chris@0
|
153 * Change stream options.
|
Chris@0
|
154 *
|
Chris@0
|
155 * This method is called to set options on the stream.
|
Chris@0
|
156 *
|
Chris@0
|
157 * @param int $option
|
Chris@0
|
158 * One of:
|
Chris@0
|
159 * - STREAM_OPTION_BLOCKING: The method was called in response to
|
Chris@0
|
160 * stream_set_blocking().
|
Chris@0
|
161 * - STREAM_OPTION_READ_TIMEOUT: The method was called in response to
|
Chris@0
|
162 * stream_set_timeout().
|
Chris@0
|
163 * - STREAM_OPTION_WRITE_BUFFER: The method was called in response to
|
Chris@0
|
164 * stream_set_write_buffer().
|
Chris@0
|
165 * @param int $arg1
|
Chris@0
|
166 * If option is:
|
Chris@0
|
167 * - STREAM_OPTION_BLOCKING: The requested blocking mode:
|
Chris@0
|
168 * - 1 means blocking.
|
Chris@0
|
169 * - 0 means not blocking.
|
Chris@0
|
170 * - STREAM_OPTION_READ_TIMEOUT: The timeout in seconds.
|
Chris@0
|
171 * - STREAM_OPTION_WRITE_BUFFER: The buffer mode, STREAM_BUFFER_NONE or
|
Chris@0
|
172 * STREAM_BUFFER_FULL.
|
Chris@0
|
173 * @param int $arg2
|
Chris@0
|
174 * If option is:
|
Chris@0
|
175 * - STREAM_OPTION_BLOCKING: This option is not set.
|
Chris@0
|
176 * - STREAM_OPTION_READ_TIMEOUT: The timeout in microseconds.
|
Chris@0
|
177 * - STREAM_OPTION_WRITE_BUFFER: The requested buffer size.
|
Chris@0
|
178 *
|
Chris@0
|
179 * @return bool
|
Chris@0
|
180 * TRUE on success, FALSE otherwise. If $option is not implemented, FALSE
|
Chris@0
|
181 * should be returned.
|
Chris@0
|
182 */
|
Chris@0
|
183 public function stream_set_option($option, $arg1, $arg2);
|
Chris@0
|
184
|
Chris@0
|
185 /**
|
Chris@0
|
186 * @return array
|
Chris@0
|
187 */
|
Chris@0
|
188 public function stream_stat();
|
Chris@0
|
189
|
Chris@0
|
190 /**
|
Chris@0
|
191 * @return int
|
Chris@0
|
192 */
|
Chris@0
|
193 public function stream_tell();
|
Chris@0
|
194
|
Chris@0
|
195 /**
|
Chris@0
|
196 * Truncate stream.
|
Chris@0
|
197 *
|
Chris@0
|
198 * Will respond to truncation; e.g., through ftruncate().
|
Chris@0
|
199 *
|
Chris@0
|
200 * @param int $new_size
|
Chris@0
|
201 * The new size.
|
Chris@0
|
202 *
|
Chris@0
|
203 * @return bool
|
Chris@0
|
204 * TRUE on success, FALSE otherwise.
|
Chris@0
|
205 */
|
Chris@0
|
206 public function stream_truncate($new_size);
|
Chris@0
|
207
|
Chris@0
|
208 /**
|
Chris@0
|
209 * @return int
|
Chris@0
|
210 */
|
Chris@0
|
211 public function stream_write($data);
|
Chris@0
|
212
|
Chris@0
|
213 /**
|
Chris@0
|
214 * @return bool
|
Chris@0
|
215 */
|
Chris@0
|
216 public function unlink($path);
|
Chris@0
|
217
|
Chris@0
|
218 /**
|
Chris@0
|
219 * @return array
|
Chris@0
|
220 */
|
Chris@0
|
221 public function url_stat($path, $flags);
|
Chris@0
|
222
|
Chris@0
|
223 }
|