1 | <?php |
||
17 | class StreamWrapper |
||
18 | { |
||
19 | /** |
||
20 | * @var bool |
||
21 | */ |
||
22 | private static $registered = false; |
||
23 | |||
24 | /** |
||
25 | * Uris associated with StreamInterfaces. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | private static $uris = []; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private static $modes = [ |
||
35 | 'r' => 33060, |
||
36 | 'rb' => 33060, |
||
37 | 'r+' => 33206, |
||
38 | 'rb+' => 33206, |
||
39 | 'w' => 33188, |
||
40 | 'wb' => 33188 |
||
41 | ]; |
||
42 | |||
43 | /** |
||
44 | * @var StreamInterface |
||
45 | */ |
||
46 | private $stream = null; |
||
47 | |||
48 | /** |
||
49 | * @var int |
||
50 | */ |
||
51 | private $mode = 0; |
||
52 | |||
53 | /** |
||
54 | * Stream context. |
||
55 | * |
||
56 | * @var resource |
||
57 | */ |
||
58 | public $context = null; |
||
59 | |||
60 | /** |
||
61 | * Check if StreamInterface ended. |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 3 | public function stream_eof() |
|
69 | |||
70 | /** |
||
71 | * Open pre-mocked StreamInterface by it's unique uri. |
||
72 | * |
||
73 | * @param string $path |
||
74 | * @param int $mode |
||
75 | * @param int $options |
||
76 | * @param string &$opened_path |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | 3 | public function stream_open($path, $mode, $options, &$opened_path) |
|
93 | |||
94 | /** |
||
95 | * Read data from StreamInterface. |
||
96 | * |
||
97 | * @param int $count |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | 3 | public function stream_read($count) |
|
105 | |||
106 | /** |
||
107 | * Seek into StreamInterface. |
||
108 | * |
||
109 | * @param int $offset |
||
110 | * @param int $whence = SEEK_SET |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | 1 | public function stream_seek($offset, $whence = SEEK_SET) |
|
122 | |||
123 | /** |
||
124 | * Get StreamInterface stats. |
||
125 | * |
||
126 | * @see stat() |
||
127 | * @return array|null |
||
128 | */ |
||
129 | 3 | public function stream_stat() |
|
133 | |||
134 | /** |
||
135 | * Get StreamInterface position. |
||
136 | * |
||
137 | * @return int |
||
138 | */ |
||
139 | 1 | public function stream_tell() |
|
145 | |||
146 | /** |
||
147 | * Write content into StreamInterface. |
||
148 | * |
||
149 | * @param string $data |
||
150 | * |
||
151 | * @return int |
||
152 | */ |
||
153 | 1 | public function stream_write($data) |
|
157 | |||
158 | /** |
||
159 | * Get stats based on wrapped StreamInterface by it's mocked uri. |
||
160 | * |
||
161 | * @see stat() |
||
162 | * |
||
163 | * @param string $path |
||
164 | * @param int $flags |
||
165 | * |
||
166 | * @return array|null |
||
167 | */ |
||
168 | 1 | public function url_stat($path, $flags) |
|
176 | |||
177 | /** |
||
178 | * Helper method used to correctly resolve StreamInterface stats. |
||
179 | * |
||
180 | * @param StreamInterface $stream |
||
181 | * |
||
182 | * @return array |
||
183 | */ |
||
184 | 3 | private function getStreamStats(StreamInterface $stream) |
|
213 | |||
214 | /** |
||
215 | * Register stream wrapper. |
||
216 | */ |
||
217 | 3 | public static function register() |
|
226 | |||
227 | /** |
||
228 | * Register StreamInterface and get unique url for it. |
||
229 | * |
||
230 | * @param StreamInterface $stream |
||
231 | * |
||
232 | * @return string |
||
233 | */ |
||
234 | 3 | public static function localFilename(StreamInterface $stream) |
|
243 | |||
244 | /** |
||
245 | * Check if given uri points to one of wrapped streams. |
||
246 | * |
||
247 | * @param string $uri |
||
248 | * |
||
249 | * @return bool |
||
250 | */ |
||
251 | 1 | public static function isWrapped($uri) |
|
255 | |||
256 | /** |
||
257 | * Create StreamInterface associated resource. |
||
258 | * |
||
259 | * @param StreamInterface $stream |
||
260 | * |
||
261 | * @return resource |
||
262 | * @throws WrapperException |
||
263 | */ |
||
264 | 1 | public static function getResource(StreamInterface $stream) |
|
281 | |||
282 | /** |
||
283 | * Free uri dedicated to specified StreamInterface. Method is useful for long living |
||
284 | * applications. |
||
285 | * |
||
286 | * @param string|StreamInterface $uri String uri or StreamInterface. |
||
287 | */ |
||
288 | 1 | public static function releaseUri($uri) |
|
296 | } |
||
297 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.