@@ -178,6 +178,56 @@ public function stream_read(int $count)
178
178
return '' ;
179
179
}
180
180
181
+ public function stream_set_option (int $ option , int $ arg1 , ?int $ arg2 ): bool
182
+ {
183
+ if (null === $ this ->handle || 'stream ' !== get_resource_type ($ this ->handle )) {
184
+ trigger_error (sprintf ('The "$handle" property of "%s" need to be a stream. ' , __CLASS__ ), E_USER_WARNING );
185
+
186
+ return false ;
187
+ }
188
+
189
+ switch ($ option ) {
190
+ case STREAM_OPTION_BLOCKING :
191
+ return $ this ->stream_set_blocking ($ this ->handle , $ arg1 );
192
+ break ;
193
+ case STREAM_OPTION_READ_TIMEOUT :
194
+ return $ this ->stream_set_timeout ($ this ->handle , $ arg1 , $ arg2 );
195
+ break ;
196
+ case STREAM_OPTION_WRITE_BUFFER :
197
+ return $ this ->stream_set_write_buffer ($ this ->handle , $ arg1 );
198
+ break ;
199
+ default :
200
+ trigger_error (sprintf ('The option "%s" is unknown for "stream_set_option" method ' , $ option ), E_USER_WARNING );
201
+
202
+ return false ;
203
+ }
204
+ }
205
+
206
+ public function stream_set_blocking ($ stream , bool $ mode ): bool
207
+ {
208
+ if (true === $ mode ) {
209
+ trigger_error (sprintf ('Blocking mode is not supported yet with "%s" class. ' , __CLASS__ ), E_USER_WARNING );
210
+
211
+ return false ;
212
+ }
213
+
214
+ return true ;
215
+ }
216
+
217
+ public function stream_set_write_buffer ($ stream , int $ buffer ): int
218
+ {
219
+ trigger_error (sprintf ('Writting with "%s" class, is not supported yet. ' , __CLASS__ ), E_USER_WARNING );
220
+
221
+ return false ;
222
+ }
223
+
224
+ public function stream_set_timeout ($ stream , int $ seconds , int $ microseconds = 0 ): bool
225
+ {
226
+ trigger_error (sprintf ('Set timeout with "%s" class, is not supported yet. ' , __CLASS__ ), E_USER_WARNING );
227
+
228
+ return false ;
229
+ }
230
+
181
231
public function stream_tell (): int
182
232
{
183
233
return $ this ->offset ;
0 commit comments