Piwik\Plugin\Report::getForDimension PHP Method

getForDimension() public static method

Finds a top level report that provides stats for a specific Dimension.
public static getForDimension ( Dimension $dimension ) : Report | null
$dimension Piwik\Columns\Dimension The dimension whose report we're looking for.
return Report | null The
    public static function getForDimension(Dimension $dimension)
    {
        return ComponentFactory::getComponentIf(__CLASS__, $dimension->getModule(), function (Report $report) use($dimension) {
            return !$report->isSubtableReport() && $report->getDimension() && $report->getDimension()->getId() == $dimension->getId();
        });
    }

Usage Example

Example #1
0
 private function setPivotByDimension($pivotByDimension)
 {
     $this->pivotByDimension = Dimension::factory($pivotByDimension);
     if (empty($this->pivotByDimension)) {
         throw new Exception("Invalid dimension '{$pivotByDimension}'.");
     }
     $this->pivotDimensionReport = Report::getForDimension($this->pivotByDimension);
 }
All Usage Examples Of Piwik\Plugin\Report::getForDimension