Documentation

HttpFulfilledPromise
in package
implements Promise

FinalYes

Table of Contents

Interfaces

Promise
Promise represents a value that may not be available yet, but will be resolved at some point in future.

Properties

$response  : ResponseInterface

Methods

__construct()  : mixed
getState()  : string
Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
then()  : Promise
Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).
wait()  : mixed
Wait for the promise to be fulfilled or rejected.

Properties

Methods

getState()

Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.

public getState() : string
Return values
string

then()

Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).

public then([callable $onFulfilled = null ][, callable $onRejected = null ]) : Promise
Parameters
$onFulfilled : callable = null

called when a response will be available

$onRejected : callable = null

called when an exception occurs

Return values
Promise

a new resolved promise with value of the executed callback (onFulfilled / onRejected)

wait()

Wait for the promise to be fulfilled or rejected.

public wait([mixed $unwrap = true ]) : mixed
Parameters
$unwrap : mixed = true

Whether to return resolved value / throw reason or not

Return values
mixed

Resolved value, null if $unwrap is set to false


        
On this page

Search results