AbstractPromise
in package
implements
PromiseInterface
Abstract HTTP promise class
Tags
Table of Contents
Interfaces
- PromiseInterface
- HTTP promise interface
Constants
- CANCELLED = 'CANCELLED'
- FULFILLED = 'FULFILLED'
- PENDING = 'PENDING'
- Status constants
- REJECTED = 'REJECTED'
Properties
- $cancel : CallableObject|null
- Cancel callable
- $failure : CallableObject|null
- Failure callable
- $finally : CallableObject|null
- Cancel callable
- $promiser : Client|CurlMulti|null
- Client Promiser
- $state : string
- Current state
- $success : array<string|int, mixed>
- Success callables
Methods
- cancel() : void
- Cancel method
- catch() : AbstractPromise
- Method to set failure callable (alias)
- finally() : AbstractPromise
- Method to set finally callable (alias)
- forward() : AbstractPromise
- Forward method
- getCancel() : CallableObject|null
- Method to get cancel callable
- getFailure() : CallableObject|null
- Method to get failure callable
- getFinally() : CallableObject|null
- Method to get finally callable
- getPromiser() : Client|CurlMulti
- Method to get client promiser
- getState() : string
- Method to get current state
- getSuccess() : array<string|int, mixed>|CallableObject|null
- Method to get success callable
- hasCancel() : bool
- Method to check cancel callable
- hasFailure() : bool
- Method to check failure callable
- hasFinally() : bool
- Method to check finally callable
- hasPromiser() : bool
- Method to check client promiser
- hasState() : bool
- Method to check current state
- hasSuccess() : bool
- Method to check success callable
- isCancelled() : bool
- Determine is the promise is cancelled
- isFulfilled() : bool
- Determine is the promise is fulfilled
- isPending() : bool
- Determine is the promise is pending
- isRejected() : bool
- Determine is the promise is rejected
- resolve() : void
- Resolve method
- setCancel() : AbstractPromise
- Method to set cancel callable
- setFailure() : AbstractPromise
- Method to set failure callable
- setFinally() : PromiseInterface
- Method to set finally callable
- setPromiser() : PromiseInterface
- Method to set client promiser
- setState() : AbstractPromise
- Method to set current state
- setSuccess() : AbstractPromise
- Method to set success callable
- then() : AbstractPromise
- Then method
- wait() : Response|array<string|int, mixed>|null
- Wait method
Constants
CANCELLED
public
mixed
CANCELLED
= 'CANCELLED'
FULFILLED
public
mixed
FULFILLED
= 'FULFILLED'
PENDING
Status constants
public
string
PENDING
= 'PENDING'
REJECTED
public
mixed
REJECTED
= 'REJECTED'
Properties
$cancel
Cancel callable
protected
CallableObject|null
$cancel
= null
$failure
Failure callable
protected
CallableObject|null
$failure
= null
$finally
Cancel callable
protected
CallableObject|null
$finally
= null
$promiser
Client Promiser
protected
Client|CurlMulti|null
$promiser
= null
$state
Current state
protected
string
$state
= self::PENDING
$success
Success callables
protected
array<string|int, mixed>
$success
= []
Methods
cancel()
Cancel method
public
abstract cancel() : void
catch()
Method to set failure callable (alias)
public
catch(mixed $failure[, bool $resolve = false ]) : AbstractPromise
Parameters
- $failure : mixed
- $resolve : bool = false
Return values
AbstractPromisefinally()
Method to set finally callable (alias)
public
finally(mixed $finally[, bool $resolve = false ]) : AbstractPromise
Parameters
- $finally : mixed
- $resolve : bool = false
Return values
AbstractPromiseforward()
Forward method
public
forward(PromiseInterface $nextPromise[, int $i = 0 ]) : AbstractPromise
Parameters
- $nextPromise : PromiseInterface
- $i : int = 0
Return values
AbstractPromisegetCancel()
Method to get cancel callable
public
getCancel() : CallableObject|null
Return values
CallableObject|nullgetFailure()
Method to get failure callable
public
getFailure() : CallableObject|null
Return values
CallableObject|nullgetFinally()
Method to get finally callable
public
getFinally() : CallableObject|null
Return values
CallableObject|nullgetPromiser()
Method to get client promiser
public
getPromiser() : Client|CurlMulti
Return values
Client|CurlMultigetState()
Method to get current state
public
getState() : string
Return values
stringgetSuccess()
Method to get success callable
public
getSuccess([int|null $i = null ]) : array<string|int, mixed>|CallableObject|null
Parameters
- $i : int|null = null
Return values
array<string|int, mixed>|CallableObject|nullhasCancel()
Method to check cancel callable
public
hasCancel() : bool
Return values
boolhasFailure()
Method to check failure callable
public
hasFailure() : bool
Return values
boolhasFinally()
Method to check finally callable
public
hasFinally() : bool
Return values
boolhasPromiser()
Method to check client promiser
public
hasPromiser() : bool
Return values
boolhasState()
Method to check current state
public
hasState() : bool
Return values
boolhasSuccess()
Method to check success callable
public
hasSuccess([int|null $i = null ]) : bool
Parameters
- $i : int|null = null
Return values
boolisCancelled()
Determine is the promise is cancelled
public
isCancelled() : bool
Return values
boolisFulfilled()
Determine is the promise is fulfilled
public
isFulfilled() : bool
Return values
boolisPending()
Determine is the promise is pending
public
isPending() : bool
Return values
boolisRejected()
Determine is the promise is rejected
public
isRejected() : bool
Return values
boolresolve()
Resolve method
public
abstract resolve() : void
setCancel()
Method to set cancel callable
public
setCancel(mixed $cancel) : AbstractPromise
Parameters
- $cancel : mixed
Return values
AbstractPromisesetFailure()
Method to set failure callable
public
setFailure(mixed $failure) : AbstractPromise
Parameters
- $failure : mixed
Return values
AbstractPromisesetFinally()
Method to set finally callable
public
setFinally(mixed $finally) : PromiseInterface
Parameters
- $finally : mixed
Return values
PromiseInterfacesetPromiser()
Method to set client promiser
public
setPromiser(Client|CurlMulti $promiser) : PromiseInterface
Parameters
Return values
PromiseInterfacesetState()
Method to set current state
public
setState(string $state) : AbstractPromise
Parameters
- $state : string
Tags
Return values
AbstractPromisesetSuccess()
Method to set success callable
public
setSuccess(mixed $success) : AbstractPromise
Parameters
- $success : mixed
Tags
Return values
AbstractPromisethen()
Then method
public
then(mixed $success[, bool $resolve = false ]) : AbstractPromise
Parameters
- $success : mixed
- $resolve : bool = false
Return values
AbstractPromisewait()
Wait method
public
abstract wait([bool $unwrap = true ]) : Response|array<string|int, mixed>|null
Parameters
- $unwrap : bool = true