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

__construct() public method

Constructor.
public __construct ( DataTable $table, string $report, string $pivotByDimension, string | false $pivotColumn, false | integer $pivotByColumnLimit = false, boolean $isFetchingBySegmentEnabled = true )
$table Piwik\DataTable The table to pivot.
$report string The ID of the report being pivoted, eg, `'Referrers.getKeywords'`.
$pivotByDimension string The ID of the dimension to pivot by, eg, `'Referrers.Keyword'`.
$pivotColumn string | false The metric that should be displayed in the pivot table, eg, `'nb_visits'`. If `false`, the first non-label column is used.
$pivotByColumnLimit false | integer The number of columns to limit the pivot table to.
$isFetchingBySegmentEnabled boolean Whether to allow fetching by segment.
    public function __construct($table, $report, $pivotByDimension, $pivotColumn, $pivotByColumnLimit = false, $isFetchingBySegmentEnabled = true)
    {
        parent::__construct($table);
        Log::debug("PivotByDimension::%s: creating with [report = %s, pivotByDimension = %s, pivotColumn = %s, " . "pivotByColumnLimit = %s, isFetchingBySegmentEnabled = %s]", __FUNCTION__, $report, $pivotByDimension, $pivotColumn, $pivotByColumnLimit, $isFetchingBySegmentEnabled);
        $this->pivotColumn = $pivotColumn;
        $this->pivotByColumnLimit = $pivotByColumnLimit ?: self::getDefaultColumnLimit();
        $this->isFetchingBySegmentEnabled = $isFetchingBySegmentEnabled;
        $namesToId = Metrics::getMappingFromNameToId();
        $this->metricIndexValue = isset($namesToId[$this->pivotColumn]) ? $namesToId[$this->pivotColumn] : null;
        $this->setPivotByDimension($pivotByDimension);
        $this->setThisReportMetadata($report);
        $this->checkSupportedPivot();
    }