class StepResult implements IteratorAggregate

Properties

protected StepResponse): void> $callbacks
protected StepResponse|null $response
protected bool $resolved
protected StreamEvent[] $buffered

Methods

__construct(Generator|StepResponse|null $source, PendingStep|null $step = null, StepContext|null $context = null, int|null $startedAt = null)

Create a buffered or streamed step result.

static StepResult
stop()

Create a result that ends the run before the model is called.

then(Closure $callback)

Register a callback to run once the step's response is available.

getIterator()

Iterate the stream to its end or call response(); a partial iteration cannot be resumed.

bool
streamed()

Determine whether the step response is backed by a stream.

bool
stopped()

Determine whether middleware stopped the run instead of taking the step.

response()

Get the step's response, or null when a stream ended without one.

void
resolve(mixed $response)

Resolve the step response and invoke registered callbacks.

Details

at line 34
__construct(Generator|StepResponse|null $source, PendingStep|null $step = null, StepContext|null $context = null, int|null $startedAt = null)

Create a buffered or streamed step result.

Parameters

Generator|StepResponse|null $source

null when middleware stopped the run

PendingStep|null $step

the step as sent to the model; null when middleware supplied the response itself

StepContext|null $context
int|null $startedAt

at line 45
static StepResult stop()

Create a result that ends the run before the model is called.

Return Value

StepResult

at line 55
StepResult then(Closure $callback)

Register a callback to run once the step's response is available.

Parameters

Closure $callback

Return Value

StepResult

at line 71
Generator getIterator()

Iterate the stream to its end or call response(); a partial iteration cannot be resumed.

Return Value

Generator

at line 101
bool streamed()

Determine whether the step response is backed by a stream.

Return Value

bool

at line 109
bool stopped()

Determine whether middleware stopped the run instead of taking the step.

Return Value

bool

at line 117
StepResponse|null response()

Get the step's response, or null when a stream ended without one.

Return Value

StepResponse|null

at line 129
protected void resolve(mixed $response)

Resolve the step response and invoke registered callbacks.

Parameters

mixed $response

Return Value

void