Merge branch 'stream-response' of https://github.com/flightphp/core into stream-response

pull/547/head
Austin Collier 11 months ago
commit ea8eb37480

@ -1,5 +1,5 @@
{ {
"php.suggest.basic": false, "php.suggest.basic": false,
"editor.detectIndentation": false, "editor.detectIndentation": false,
"editor.insertSpaces": true "editor.insertSpaces": true
} }

@ -63,15 +63,11 @@ class Route
/** /**
* The middleware to be applied to the route * The middleware to be applied to the route
* *
* @var array<int,callable|object> * @var array<int, callable|object>
*/ */
public array $middleware = []; public array $middleware = [];
/** /** Whether the response for this route should be streamed. */
* Whether the response for this route should be streamed.
*
* @var boolean
*/
public bool $is_streamed = false; public bool $is_streamed = false;
/** /**
@ -193,7 +189,7 @@ class Route
/** /**
* Hydrates the route url with the given parameters * Hydrates the route url with the given parameters
* *
* @param array<string,mixed> $params the parameters to pass to the route * @param array<string, mixed> $params the parameters to pass to the route
*/ */
public function hydrateUrl(array $params = []): string public function hydrateUrl(array $params = []): string
{ {
@ -226,9 +222,7 @@ class Route
/** /**
* Sets the route middleware * Sets the route middleware
* *
* @param array<int,callable>|callable $middleware * @param array<int, callable>|callable $middleware
*
* @return self
*/ */
public function addMiddleware($middleware): self public function addMiddleware($middleware): self
{ {
@ -245,12 +239,13 @@ class Route
* *
* @param array<string, mixed> $headers a key value of headers to set before the stream starts. * @param array<string, mixed> $headers a key value of headers to set before the stream starts.
* *
* @return self * @return $this
*/ */
public function streamWithHeaders(array $headers): self public function streamWithHeaders(array $headers): self
{ {
$this->is_streamed = true; $this->is_streamed = true;
$this->streamed_headers = $headers; $this->streamed_headers = $headers;
return $this; return $this;
} }
} }

Loading…
Cancel
Save