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
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 complete($result)
mixed
completer() : callable
callablean handler completing this future
compose( $arg0, $arg1 = null) : \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.
param $mapper [callable] the mapper function compose($mapper)
Compose this future with a provided next future.
When this (the one on which compose is called) future succeeds, the handler will be called with
the completed value, this handler should complete the next future.
If the handler throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the next future and the handler
will not be called.
param $handler [callable] the handler param $next [Future] the next future compose($handler, $next)
callable
Future
\io\vertx\jphp\core\Futurethe composed future
fail( $arg0) : void
param $cause [\Exception] the failure cause 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 fail($failureMessage)
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>
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
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 tryComplete($result)
mixed
booleanfalse when the future is already completed
tryFail( $arg0) : boolean
param $cause [\Exception] the failure cause 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 tryFail($failureMessage)
string | \Exception
booleanfalse when the future is already completed