public function done(callable $onFulfilled = null, callable $onRejected = null)
{
if (null !== $this->result) {
return $this->result()->done($onFulfilled, $onRejected);
}
$this->handlers[] = function (ExtendedPromiseInterface $promise) use($onFulfilled, $onRejected) {
$promise->done($onFulfilled, $onRejected);
};
}
public function fromPromise(Promise $promise) { $json = null; $promise->done(function ($data) use(&$json) { $json = $data; }); return new \Zend\Diactoros\Response\JsonResponse($json); }