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