Piwik\DataTable\Filter\PivotByDimension::getPivotTableDefaultRowFromColumnSummary PHP Method

getPivotTableDefaultRowFromColumnSummary() private method

private getPivotTableDefaultRowFromColumnSummary ( $columnSet, $othersRowLabel )
    private function getPivotTableDefaultRowFromColumnSummary($columnSet, $othersRowLabel)
    {
        // sort columns by sum (to ensure deterministic ordering)
        arsort($columnSet);
        // limit columns if necessary (adding aggregate Others column at end)
        if ($this->pivotByColumnLimit > 0 && count($columnSet) > $this->pivotByColumnLimit) {
            $columnSet = array_slice($columnSet, 0, $this->pivotByColumnLimit - 1, $preserveKeys = true);
            $columnSet[$othersRowLabel] = 0;
        }
        // remove column sums from array so it can be used as a default row
        $columnSet = array_map(function () {
            return false;
        }, $columnSet);
        // make sure label column is first
        $columnSet = array('label' => false) + $columnSet;
        return $columnSet;
    }