BaseBridgeEvent

Represents an event that occurs on the event bus bridge.

Please consult the documentation for a full explanation.

package

Default

Methods

__construct

__construct() 

A Throwable describing failure. This will be null if the operation succeeded.

cause() : \Exception

Response

\Exception

the cause or null if the operation succeeded.

Set a null result. Any handler will be called, if there is one, and the future will be marked as completed.

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 [boolean] the result complete($result)

Arguments

$arg0

boolean

completer

completer() : callable

Response

callable

an handler completing this future

Compose this future with a <code>mapper</code> function.<p>

compose( $arg0,  $arg1 = null) : \io\vertx\jphp\ext\bridge\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)

Arguments

$arg0

callable

$arg1

Future

Response

\io\vertx\jphp\ext\bridge\Future

the composed future

Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.

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)

Arguments

$arg0

string | \Exception

Did it fail?

failed() : boolean

Response

boolean

true if it failed or false otherwise

Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is no message involved. If the returned message is modified, @see \io\vertx\jphp\ext\bridge\BaseBridgeEvent::setRawMessage should be called with the new message.

getRawMessage() : array

Response

array

the raw JSON message for the event

Has the future completed? <p> It's completed if it's either succeeded or failed.

isComplete() : boolean

Response

boolean

true if completed, false if not

Apply a <code>mapper</code> function on this future.<p>

map( $arg0) : \io\vertx\jphp\ext\bridge\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)

Arguments

$arg0

callable | mixed

Response

\io\vertx\jphp\ext\bridge\Future

the mapped future

Map the result of a future to <code>null</code>.<p>

mapEmpty() : \io\vertx\jphp\ext\bridge\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.

Response

\io\vertx\jphp\ext\bridge\Future

the mapped future

Apply a <code>mapper</code> function on this future.<p>

otherwise( $arg0) : \io\vertx\jphp\ext\bridge\Future<Boolean>

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 [boolean] the value that eventually completes the mapped future otherwise($value)

Arguments

$arg0

callable | boolean

Response

\io\vertx\jphp\ext\bridge\Future

the mapped future

Map the failure of a future to <code>null</code>.<p>

otherwiseEmpty() : \io\vertx\jphp\ext\bridge\Future<Boolean>

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.

Response

\io\vertx\jphp\ext\bridge\Future

the mapped future

Handles a failure of this Future by returning the result of another Future.

recover( $arg0) : \io\vertx\jphp\ext\bridge\Future<Boolean>

If the mapper fails, then the returned future will be failed with this failure.

Arguments

$arg0

callable

Response

\io\vertx\jphp\ext\bridge\Future

A recovered future

The result of the operation. This will be null if the operation failed.

result() : boolean

Response

boolean

the result or null if the operation failed.

Set a handler for the result.

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.

Arguments

$arg0

callable

Response

$this

a reference to this, so it can be used fluently

Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is no message involved.

setRawMessage( $arg0) : $this

Arguments

$arg0

array

Response

$this

this reference, so it can be used fluently

Did it succeed?

succeeded() : boolean

Response

boolean

true if it succeded or false otherwise

Try to set the result. When it happens, any handler will be called, if there is one, and the future will be marked as completed.

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 [boolean] the result tryComplete($result)

Arguments

$arg0

boolean

Response

boolean

false when the future is already completed

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.

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)

Arguments

$arg0

string | \Exception

Response

boolean

false when the future is already completed

type

type() : string

Response

string

the type of the event