From f95e5ba5b65b8fe035b30f3a172b2f3379680e2a Mon Sep 17 00:00:00 2001 From: Mcsky Date: Fri, 13 Dec 2019 13:44:37 +0100 Subject: [PATCH] Add stream_set_option method with required structure. But without real implementations --- .../HttpClient/Response/StreamWrapper.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Symfony/Component/HttpClient/Response/StreamWrapper.php b/src/Symfony/Component/HttpClient/Response/StreamWrapper.php index 59fd118e86e0..5faf047b2ade 100644 --- a/src/Symfony/Component/HttpClient/Response/StreamWrapper.php +++ b/src/Symfony/Component/HttpClient/Response/StreamWrapper.php @@ -178,6 +178,28 @@ public function stream_read(int $count) return ''; } + public function stream_set_option(int $option, int $arg1, ?int $arg2): bool + { + if (null === $this->handle || 'stream' !== get_resource_type($this->handle)) { + trigger_error(sprintf('The "$handle" property of "%s" need to be a stream.', __CLASS__), E_USER_WARNING); + + return false; + } + + switch ($option) { + case STREAM_OPTION_BLOCKING: + return \stream_set_blocking($this->handle, $arg1); + case STREAM_OPTION_READ_TIMEOUT: + return \stream_set_timeout($this->handle, $arg1, $arg2); + case STREAM_OPTION_WRITE_BUFFER: + return \stream_set_write_buffer($this->handle, $arg1); + default: + trigger_error(sprintf('The option "%s" is unknown for "stream_set_option" method', $option), E_ERROR); + + return false; + } + } + public function stream_tell(): int { return $this->offset;