azure-storage-common/src/Common/Middlewares/HistoryMiddleware.php
protected function onFulfilled(RequestInterface $request, array $options)
    {
        $reflection = $this;
        return function (ResponseInterface $response) use (
            $reflection,
            $request,
            $options
        ) {
            $reflection->addHistory([
                'request'  => $request,
                'response' => $response,
                'options'  => $options
            ]);
            return $response;
        };
    }
protected function onFulfilled(RequestInterface $request, array $options)
    {
        $reflection = $this;
        return function (ResponseInterface $response) use (
            $reflection,
            $request,
            $options
        ) {
            $reflection->addHistory([
                'request'  => $request,
                'response' => $response,
                'options'  => $options
            ]);
            return $response;
        };
    }
This function will be invoked after the request is sent, if
the promise is fulfilled.

@param  RequestInterface $request the request sent.
@param  array            $options the options that the request sent with.

@return callable