Represents the result of an action that may, or may not, have occurred yet.
| package |
Default |
|---|
__construct()
cause() : \Exception
\Exceptionthe cause or null if the operation succeeded.
complete( $arg0 = null) : void
this method is deprecated
complete()
Set the result. Any handler will be called, if there is one, and the future will be marked as completed.
param $result [mixed] the result
this method is deprecated
complete($result)
| deprecated |
|---|
mixed
completer() : callable
| deprecated | |
|---|---|
callablean handler completing this future
compose( $arg0) : \io\vertx\jphp\core\Future<U>
When this future (the one on which compose is called) succeeds, the mapper will be called with
the completed value and this mapper returns another future object. This returned future completion will complete
the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
callable
\io\vertx\jphp\core\Futurethe composed future
fail( $arg0) : void
param $cause [\Exception] the failure cause
this method is deprecated
fail($cause)
Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.
param $failureMessage [string] the failure message
this method is deprecated
fail($failureMessage)
| deprecated |
|---|
string | \Exception
failed() : boolean
booleantrue if it failed or false otherwise
failedFuture( $arg0) : \io\vertx\jphp\core\Future<T>
param $t [\Exception] the failure cause as a Throwable failedFuture($t)
Create a failed future with the specified failure message.
param $failureMessage [string] the failure message failedFuture($failureMessage)
string | \Exception
\io\vertx\jphp\core\Futurethe future
future( $arg0 = null) : \io\vertx\jphp\core\Future<T>
this method is deprecated
future()
Create a future that hasn't completed yet and that is passed to the handler before it is returned.
param $handler [callable] the handler future($handler)
callable
\io\vertx\jphp\core\Futurethe future
isComplete() : boolean
booleantrue if completed, false if not
map( $arg0) : \io\vertx\jphp\core\Future<U>
When this future succeeds, the mapper will be called with the completed value and this mapper
returns a value. This value will complete the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the returned future and the mapper
will not be called.
param $mapper [callable] the mapper function map($mapper)
Map the result of a future to a specific value.
When this future succeeds, this value will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
param $value [mixed] the value that eventually completes the mapped future map($value)
callable | mixed
\io\vertx\jphp\core\Futurethe mapped future
mapEmpty() : \io\vertx\jphp\core\Future<V>
This is a conveniency for future.map((T) null) or future.map((Void) null).
When this future succeeds, null will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
\io\vertx\jphp\core\Futurethe mapped future
otherwise( $arg0) : \io\vertx\jphp\core\Future<T>
When this future fails, the mapper will be called with the completed value and this mapper
returns a value. This value will complete the future returned by this method call.
If the mapper throws an exception, the returned future will be failed with this exception.
When this future succeeds, the result will be propagated to the returned future and the mapper
will not be called.
param $mapper [callable] the mapper function otherwise($mapper)
Map the failure of a future to a specific value.
When this future fails, this value will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
param $value [mixed] the value that eventually completes the mapped future otherwise($value)
callable | mixed
\io\vertx\jphp\core\Futurethe mapped future
otherwiseEmpty() : \io\vertx\jphp\core\Future<T>
This is a convenience for future.otherwise((T) null).
When this future fails, the null value will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
\io\vertx\jphp\core\Futurethe mapped future
recover( $arg0) : \io\vertx\jphp\core\Future<T>
If the mapper fails, then the returned future will be failed with this failure.
callable
\io\vertx\jphp\core\FutureA recovered future
result() : mixed
mixedthe result or null if the operation failed.
setHandler( $arg0) : $this
If the future has already been completed it will be called immediately. Otherwise it will be called when the future is completed.
callable
$thisa reference to this, so it can be used fluently
succeeded() : boolean
booleantrue if it succeded or false otherwise
succeededFuture( $arg0 = null) : \io\vertx\jphp\core\Future<T>
succeededFuture()
Created a succeeded future with the specified result.
param $result [mixed] the result succeededFuture($result)
mixed
\io\vertx\jphp\core\Futurethe future
tryComplete( $arg0 = null) : boolean
this method is deprecated
tryComplete()
Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.
param $result [mixed] the result
this method is deprecated
tryComplete($result)
| deprecated |
|---|
mixed
booleanfalse when the future is already completed
tryFail( $arg0) : boolean
param $cause [\Exception] the failure cause
this method is deprecated
tryFail($cause)
Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.
param $failureMessage [string] the failure message
this method is deprecated
tryFail($failureMessage)
| deprecated |
|---|
string | \Exception
booleanfalse when the future is already completed