public static function finish(
        callable $handler,
        EasyHandle $easy,
        CurlFactoryInterface $factory
    ) {
        if (isset($easy->options['on_stats'])) {
            self::invokeStats($easy);
        }

        if (!$easy->response || $easy->errno) {
            return self::finishError($handler, $easy, $factory);
        }

        // Return the response if it is present and there is no error.
        $factory->release($easy);

        // Rewind the body of the response if possible.
        $body = $easy->response->getBody();
        if ($body->isSeekable()) {
            $body->rewind();
        }

        return new FulfilledPromise($easy->response);
    }
public static function finish(
        callable $handler,
        EasyHandle $easy,
        CurlFactoryInterface $factory
    ) {
        if (isset($easy->options['on_stats'])) {
            self::invokeStats($easy);
        }

        if (!$easy->response || $easy->errno) {
            return self::finishError($handler, $easy, $factory);
        }

        // Return the response if it is present and there is no error.
        $factory->release($easy);

        // Rewind the body of the response if possible.
        $body = $easy->response->getBody();
        if ($body->isSeekable()) {
            $body->rewind();
        }

        return new FulfilledPromise($easy->response);
    }
public static function finish ( callable $ handler , EasyHandle $ easy , CurlFactoryInterface $ factory ) { if ( isset ( $ easy -> options [ 'on_stats' ] ) ) { self :: invokeStats ( $ easy ) ; } if ( ! $ easy -> response || $ easy -> errno ) { return self :: finishError ( $ handler , $ easy , $ factory ) ; } // Return the response if it is present and there is no error. $ factory -> release ( $ easy ) ; // Rewind the body of the response if possible. $ body = $ easy -> response -> getBody ( ) ; if ( $ body -> isSeekable ( ) ) { $ body -> rewind ( ) ; } return new FulfilledPromise ( $ easy -> response ) ; }
Completes a cURL transaction, either returning a response promise or a
rejected promise.

@param callable             $handler
@param EasyHandle           $easy
@param CurlFactoryInterface $factory Dictates how the handle is released

@return \GuzzleHttp\Promise\PromiseInterface
Completes a cURL transaction either returning a response promise or a rejected promise .