Piwik\Archive::getPluginForReport PHP Method

getPluginForReport() private static method

Returns the name of the plugin that archives a given report.
private static getPluginForReport ( string $report ) : string
$report string Archive data name, eg, `'nb_visits'`, `'DevicesDetection_...'`, etc.
return string Plugin name.
    private static function getPluginForReport($report)
    {
        // Core metrics are always processed in Core, for the requested date/period/segment
        if (in_array($report, Metrics::getVisitsMetricNames())) {
            $report = 'VisitsSummary_CoreMetrics';
        } elseif (strpos($report, 'Goal_') === 0) {
            $report = 'Goals_Metrics';
        } elseif (strrpos($report, '_returning') === strlen($report) - strlen('_returning')) {
            // HACK
            $report = 'VisitFrequency_Metrics';
        }
        $plugin = substr($report, 0, strpos($report, '_'));
        if (empty($plugin) || !\Piwik\Plugin\Manager::getInstance()->isPluginActivated($plugin)) {
            throw new \Exception("Error: The report '{$report}' was requested but it is not available at this stage." . " (Plugin '{$plugin}' is not activated.)");
        }
        return $plugin;
    }