private function fillGapsInMetricsData(bool $tsAscending, array $allTimeUnits, array $originalTimeUnits, array &$metricsData): void
    {
        $zeroArray = array_fill_keys($allTimeUnits, 0);
        foreach ($metricsData as $key => $metric) {
            $metricsData[$key]['values'] = array_combine($originalTimeUnits, $metric['values']);
            $metricsData[$key]['values'] += $zeroArray;
            if ($tsAscending) {
                ksort($metricsData[$key]['values']);
            } else {
                krsort($metricsData[$key]['values']);
            }
            // Keep original numerical indexes.
            $metricsData[$key]['values'] = array_values($metricsData[$key]['values']);
        }
    }
private function fillGapsInMetricsData(bool $tsAscending, array $allTimeUnits, array $originalTimeUnits, array &$metricsData): void
    {
        $zeroArray = array_fill_keys($allTimeUnits, 0);
        foreach ($metricsData as $key => $metric) {
            $metricsData[$key]['values'] = array_combine($originalTimeUnits, $metric['values']);
            $metricsData[$key]['values'] += $zeroArray;
            if ($tsAscending) {
                ksort($metricsData[$key]['values']);
            } else {
                krsort($metricsData[$key]['values']);
            }
            // Keep original numerical indexes.
            $metricsData[$key]['values'] = array_values($metricsData[$key]['values']);
        }
    }
private function fillGapsInMetricsData ( bool $ tsAscending , array $ allTimeUnits , array $ originalTimeUnits , array & $ metricsData ) : void { $ zeroArray = array_fill_keys ( $ allTimeUnits , 0 ) ; foreach ( $ metricsData as $ key => $ metric ) { $ metricsData [ $ key ] [ 'values' ] = array_combine ( $ originalTimeUnits , $ metric [ 'values' ] ) ; $ metricsData [ $ key ] [ 'values' ] += $ zeroArray ; if ( $ tsAscending ) { ksort ( $ metricsData [ $ key ] [ 'values' ] ) ; } else { krsort ( $ metricsData [ $ key ] [ 'values' ] ) ; } // Keep original numerical indexes. $ metricsData [ $ key ] [ 'values' ] = array_values ( $ metricsData [ $ key ] [ 'values' ] ) ; } }
Fills the gaps between returned analytics numbers in the response of Apigee Edge.

Apigee Edge does not returns zeros for those time units (hours, days, etc.) when there were no metric data.

@param bool $tsAscending
TsAscending from StatsQuery.
@param array $allTimeUnits
All time units in the given time interval.
@param array $originalTimeUnits
Returned time units by Apigee Edge.
@param array $metricsData
Returned metrics data by Apigee Edge.
Fills the gaps between returned analytics numbers in the response of Apigee Edge .