From 81e7160357c187d3da9482fbf16775738e3627a8 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 26 May 2024 16:53:14 +0200 Subject: [PATCH] Remove optional parameter to flush() only used internally --- src/main/php/web/Response.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/php/web/Response.class.php b/src/main/php/web/Response.class.php index 0acc48ce..e9842bdd 100755 --- a/src/main/php/web/Response.class.php +++ b/src/main/php/web/Response.class.php @@ -121,16 +121,15 @@ private function begin($output) { /** * Flushes response * - * @param web.io.Output $output * @return void * @throws lang.IllegalStateException */ - public function flush($output= null) { + public function flush() { if ($this->flushed) { throw new IllegalStateException('Response already flushed'); } - $this->begin($output ?: $this->output); + $this->begin($this->output); } /** @@ -157,8 +156,13 @@ public function end() { * * @param int $size If omitted, uses chunked transfer encoding * @return io.streams.OutputStream + * @throws lang.IllegalStateException */ public function stream($size= null) { + if ($this->flushed) { + throw new IllegalStateException('Response already flushed'); + } + if (null === $size) { $output= $this->output->stream(); } else { @@ -166,7 +170,7 @@ public function stream($size= null) { $output= $this->output; } - $this->flush($output); + $this->begin($output); return $output; }