src/Middleware/RequestTimeMiddleware.php
protected function getOnStatsCallback($initialOnStats, $requestId) : \Closure
    {
        return function (TransferStats $stats) use ($initialOnStats, $requestId) {
            if (is_callable($initialOnStats)) {
                call_user_func($initialOnStats, $stats);
            }

            $this->dataCollector->addTotalTime((float)$stats->getTransferTime());

            if ($requestId && $this->logger instanceof Logger) {
                $this->logger->addTransferTimeByRequestId($requestId, (float)$stats->getTransferTime());
            }
        };
    }
protected function getOnStatsCallback($initialOnStats, $requestId) : \Closure
    {
        return function (TransferStats $stats) use ($initialOnStats, $requestId) {
            if (is_callable($initialOnStats)) {
                call_user_func($initialOnStats, $stats);
            }

            $this->dataCollector->addTotalTime((float)$stats->getTransferTime());

            if ($requestId && $this->logger instanceof Logger) {
                $this->logger->addTransferTimeByRequestId($requestId, (float)$stats->getTransferTime());
            }
        };
    }
protected function getOnStatsCallback ( $ initialOnStats , $ requestId ) : \ Closure { return function ( TransferStats $ stats ) use ( $ initialOnStats , $ requestId ) { if ( is_callable ( $ initialOnStats ) ) { call_user_func ( $ initialOnStats , $ stats ) ; } $ this -> dataCollector -> addTotalTime ( ( float ) $ stats -> getTransferTime ( ) ) ; if ( $ requestId && $ this -> logger instanceof Logger ) { $ this -> logger -> addTransferTimeByRequestId ( $ requestId , ( float ) $ stats -> getTransferTime ( ) ) ; } } ; }
Create callback for on_stats options.
If request has on_stats option, it will be called inside of this callback.

@param null|callable $initialOnStats
@param null|string $requestId

@return \Closure
Create callback for on_stats options . If request has on_stats option it will be called inside of this callback .