Open Journal Systems  3.3.0
Http\Client\Promise\HttpFulfilledPromise Class Reference
Inheritance diagram for Http\Client\Promise\HttpFulfilledPromise:
Http\Promise\Promise

Public Member Functions

 __construct (ResponseInterface $response)
 
 getState ()
 
 then (callable $onFulfilled=null, callable $onRejected=null)
 
 wait ($unwrap=true)
 

Additional Inherited Members

- Data Fields inherited from Http\Promise\Promise
const FULFILLED = 'fulfilled'
 
const PENDING = 'pending'
 
const REJECTED = 'rejected'
 

Detailed Description

Definition at line 9 of file HttpFulfilledPromise.php.

Constructor & Destructor Documentation

◆ __construct()

Http\Client\Promise\HttpFulfilledPromise::__construct ( ResponseInterface  $response)
Parameters
ResponseInterface$response

Definition at line 22 of file HttpFulfilledPromise.php.

Member Function Documentation

◆ getState()

Http\Client\Promise\HttpFulfilledPromise::getState ( )

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

Returns
string
}

Implements Http\Promise\Promise.

Definition at line 46 of file HttpFulfilledPromise.php.

References Http\Promise\Promise\FULFILLED.

◆ then()

Http\Client\Promise\HttpFulfilledPromise::then ( callable  $onFulfilled = null,
callable  $onRejected = null 
)

{Adds behavior for when the promise is resolved or rejected (response will be available, or error happens).If you do not care about one of the cases, you can set the corresponding callable to null The callback will be called when the value arrived and never more than once.

Parameters
callable$onFulfilledCalled when a response will be available.
callable$onRejectedCalled when an exception occurs.
Returns
Promise A new resolved promise with value of the executed callback (onFulfilled / onRejected).
}

Implements Http\Promise\Promise.

Definition at line 30 of file HttpFulfilledPromise.php.

◆ wait()

Http\Client\Promise\HttpFulfilledPromise::wait (   $unwrap = true)

{Wait for the promise to be fulfilled or rejected.When this method returns, the request has been resolved and if callables have been specified, the appropriate one has terminated.When $unwrap is true (the default), the response is returned, or the exception thrown on failure. Otherwise, nothing is returned or thrown.

Parameters
bool$unwrapWhether to return resolved value / throw reason or not
Returns
mixed Resolved value, null if $unwrap is set to false
Exceptions
}

Implements Http\Promise\Promise.

Definition at line 54 of file HttpFulfilledPromise.php.


The documentation for this class was generated from the following file: