class ResponseSequence (View source)
protected array | $responses | The responses in the sequence. | |
protected bool | $failWhenEmpty | Indicates that invoking this sequence when it is empty should throw an exception. | |
protected PromiseInterface | $emptyResponse | The response that should be returned when the sequence is empty. |
void | __construct(array $responses) Create a new response sequence. | |
$this | push(string|array $body = '', int $status = 200, array $headers = []) Push a response to the sequence. | |
$this | pushStatus(int $status, array $headers = []) Push a response with the given status code to the sequence. | |
$this | pushFile(string $filePath, int $status = 200, array $headers = []) Push response with the contents of a file as the body to the sequence. | |
$this | pushResponse(mixed $response) Push a response to the sequence. | |
$this | whenEmpty(PromiseInterface|Closure $response) Make the sequence return a default response when it is empty. | |
$this | dontFailWhenEmpty() Make the sequence return a default response when it is empty. | |
bool | isEmpty() Indicate that this sequence has depleted all of its responses. | |
mixed | __invoke() Get the next response in the sequence. |
Create a new response sequence.
Push a response to the sequence.
Push a response with the given status code to the sequence.
Push response with the contents of a file as the body to the sequence.
Push a response to the sequence.
Make the sequence return a default response when it is empty.
Make the sequence return a default response when it is empty.
Indicate that this sequence has depleted all of its responses.
Get the next response in the sequence.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Http/Client/ResponseSequence.html