1 | <?php |
||
21 | class Stream implements StreamInterface |
||
22 | { |
||
23 | /** @var resource The resource. */ |
||
24 | private $resource; |
||
25 | |||
26 | /** @var array The metadata. */ |
||
27 | private $metadata; |
||
28 | |||
29 | /** @var string[] The read modes. */ |
||
30 | private static $readModes = ['r', 'w+', 'r+', 'x+', 'c+', 'rb', 'w+b', 'r+b', 'x+b', 'c+b', 'rt', 'w+t', 'r+t', 'x+t', 'c+t', 'a+']; |
||
31 | |||
32 | /** @var string[] The write modes. */ |
||
33 | private static $writeModes = ['w', 'w+', 'rw', 'r+', 'x+', 'c+', 'wb', 'w+b', 'r+b', 'x+b', 'c+b', 'w+t', 'r+t', 'x+t', 'c+t', 'a', 'a+']; |
||
34 | |||
35 | /** |
||
36 | * Construct a Stream object with the given resource. |
||
37 | * |
||
38 | * @param resource $resource |
||
39 | */ |
||
40 | 69 | public function __construct($resource) |
|
49 | |||
50 | /** |
||
51 | * Destruct the Stream object. |
||
52 | */ |
||
53 | 6 | public function __destruct() |
|
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | 4 | public function __toString() |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 7 | public function close() |
|
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 13 | public function detach() |
|
100 | |||
101 | /** |
||
102 | * {@inheritdoc} |
||
103 | */ |
||
104 | 2 | public function getSize() |
|
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | 2 | public function tell() |
|
132 | |||
133 | /** |
||
134 | * {@inheritdoc} |
||
135 | */ |
||
136 | 1 | public function eof() |
|
140 | |||
141 | /** |
||
142 | * {@inheritdoc} |
||
143 | */ |
||
144 | 9 | public function isSeekable() |
|
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | 8 | public function seek($offset, $whence = SEEK_SET) |
|
162 | |||
163 | /** |
||
164 | * {@inheritdoc} |
||
165 | */ |
||
166 | 1 | public function rewind() |
|
170 | |||
171 | /** |
||
172 | * {@inheritdoc} |
||
173 | */ |
||
174 | 6 | public function isWritable() |
|
178 | |||
179 | /** |
||
180 | * {@inheritdoc} |
||
181 | */ |
||
182 | 5 | public function write($string) |
|
196 | |||
197 | /** |
||
198 | * {@inheritdoc} |
||
199 | */ |
||
200 | 8 | public function isReadable() |
|
204 | |||
205 | /** |
||
206 | * {@inheritdoc} |
||
207 | */ |
||
208 | 7 | public function read($length) |
|
222 | |||
223 | /** |
||
224 | * {@inheritdoc} |
||
225 | */ |
||
226 | 4 | public function getContents() |
|
230 | |||
231 | /** |
||
232 | * {@inheritdoc} |
||
233 | */ |
||
234 | 17 | public function getMetadata($key = null) |
|
242 | } |
||
243 |