• Full name: \App\Shared\Http\StreamedResponse
  • Parent class: Response

Properties

callback

protected ?\Closure $callback

streamed

protected bool $streamed

headersSent

private bool $headersSent

Methods

__construct

public __construct(?callable $callback = null, int $status = 200, array $headers = []): mixed

Parameters:

Parameter Type Description
$callback ?callable
$status int The HTTP status code (200 "OK" by default)
$headers array

setCallback

Sets the PHP callback associated with this Response.

public setCallback(callable $callback): $this

Parameters:

Parameter Type Description
$callback callable

getCallback

public getCallback(): ?\Closure

sendHeaders

This method only sends the headers once.

public sendHeaders(positive-int|null $statusCode = null): $this

Parameters:

Parameter Type Description
$statusCode positive-int|null The status code to use, override the statusCode property if set and not null

sendContent

This method only sends the content once.

public sendContent(): $this

setContent

public setContent(?string $content): $this

Parameters:

Parameter Type Description
$content ?string

Throws:

when the content is not null - LogicException


getContent

public getContent(): string|false