Amp\Deferred class Deferred

Deferred is a container for a promise that is resolved using the resolve() and fail() methods of this object.

The contained promise may be accessed using the promise() method. This object should not be part of a public API, but used internally to create and resolve a promise.

Summary

Properties

Methods

Properties

Methods

__construct — public function __construct()
No documentation.
promise — public function promise(): Amp\Promise
No documentation.
resolve — public function resolve(mixed $value = null)

Fulfill the promise with the given value.

Type Parameter Description Default Value
mixed $value No documentation. null
fail — public function fail(Throwable $reason)

Fails the promise the the given reason.

Type Parameter Description Default Value
Throwable $reason No documentation. none
onResolve — public function onResolve(callable $onResolved)
No documentation.
Type Parameter Description Default Value
callable $onResolved No documentation. none