src/PromiseWithSD.php
protected function resolver(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
    {
        return function ($resolve, $reject, $notify) use ($onFulfilled, $onRejected, $onProgress) {
            if ($onProgress) {
                $progressHandler = function ($update) use ($notify, $onProgress) {
                    try {
                        $notify($onProgress($update), $this->sharedData);
                    } catch (\Throwable $e) {
                        $notify($e, $this->sharedData);
                    }
                };
            } else {
                $progressHandler = $notify;
            }

            $this->handlers[] = function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject, $progressHandler) {
                $promise
                    ->then($onFulfilled, $onRejected)
                    ->done($resolve, $reject, $progressHandler);
            };

            $this->progressHandlers[] = $progressHandler;
        };
    }
protected function resolver(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
    {
        return function ($resolve, $reject, $notify) use ($onFulfilled, $onRejected, $onProgress) {
            if ($onProgress) {
                $progressHandler = function ($update) use ($notify, $onProgress) {
                    try {
                        $notify($onProgress($update), $this->sharedData);
                    } catch (\Throwable $e) {
                        $notify($e, $this->sharedData);
                    }
                };
            } else {
                $progressHandler = $notify;
            }

            $this->handlers[] = function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject, $progressHandler) {
                $promise
                    ->then($onFulfilled, $onRejected)
                    ->done($resolve, $reject, $progressHandler);
            };

            $this->progressHandlers[] = $progressHandler;
        };
    }
protected function resolver ( callable $ onFulfilled = null , callable $ onRejected = null , callable $ onProgress = null ) { return function ( $ resolve , $ reject , $ notify ) use ( $ onFulfilled , $ onRejected , $ onProgress ) { if ( $ onProgress ) { $ progressHandler = function ( $ update ) use ( $ notify , $ onProgress ) { try { $ notify ( $ onProgress ( $ update ) , $ this -> sharedData ) ; } catch ( \ Throwable $ e ) { $ notify ( $ e , $ this -> sharedData ) ; } } ; } else { $ progressHandler = $ notify ; } $ this -> handlers [ ] = function ( ExtendedPromiseInterface $ promise ) use ( $ onFulfilled , $ onRejected , $ resolve , $ reject , $ progressHandler ) { $ promise -> then ( $ onFulfilled , $ onRejected ) -> done ( $ resolve , $ reject , $ progressHandler ) ; } ; $ this -> progressHandlers [ ] = $ progressHandler ; } ; }
Promise resolver callback generator
@param callable|null $onFulfilled
@param callable|null $onRejected
@param callable|null $onProgress
@return \Closure
Promise resolver callback generator