/** * Resolves this promise with the given promise if this promise is still pending. * * @param \Icicle\Promise\PromiseInterface $result */ private function resolve(PromiseInterface $result) { if (null !== $this->result) { return; } $this->result = $result; $this->result->done($this->onFulfilled, $this->onRejected ?: new ThenQueue()); $this->onFulfilled = null; $this->onRejected = null; $this->onCancelled = null; }
/** * {@inheritdoc} */ public function done(callable $onFulfilled = null, callable $onRejected = null) { $this->result->done(null, $onRejected); }