class
Illuminate
/
Http
/
Client
/
ResponseSequence
ResponseSequence
Uses
Properties
protected
$responses array
The responses in the sequence.
Default: null
protected
$failWhenEmpty bool
Indicates that invoking this sequence when it is empty should throw an exception.
Default: true
protected
$emptyResponse GuzzleHttp\...\PromiseInterface
The response that should be returned when the sequence is empty.
Default: null
Methods
public
__construct ( array $responses ) : void
Create a new response sequence.
Parameters
- $responses array
public
push ( $body , int $status , array $headers ) : $this
Push a response to the sequence.
Parameters
- $body string|array|null
- $status int
- $headers array
public
pushStatus ( int $status , array $headers ) : $this
Push a response with the given status code to the sequence.
Parameters
- $status int
- $headers array
public
pushFile ( string $filePath , int $status , array $headers ) : $this
Push response with the contents of a file as the body to the sequence.
Parameters
- $filePath string
- $status int
- $headers array
public
pushResponse ( $response ) : $this
Push a response to the sequence.
Parameters
- $response mixed
public
whenEmpty ( $response ) : $this
Make the sequence return a default response when it is empty.
Parameters
- $response GuzzleHttp\...\PromiseInterface|Closure
public
dontFailWhenEmpty ( ) : $this
Make the sequence return a default response when it is empty.
public
isEmpty ( ) : bool
Indicate that this sequence has depleted all of its responses.
public
__invoke ( ) : mixed
Get the next response in the sequence.