/**
* Checks whether a report + metric exists for
* the given idSites and if the a dimension is
* given (requires report_condition, report_matched)
*
* @param int $idSite
* @param string $apiMethodUniqueId for example MultiSites.getAll
* @param string $metric
* @throws \Exception
* @return boolean
*/
public function checkApiMethodAndMetric($idSite, $apiMethodUniqueId, $metric)
{
if (empty($apiMethodUniqueId) || false === strpos($apiMethodUniqueId, '_')) {
throw new Exception(Piwik::translate('CustomAlerts_InvalidReport'));
}
$processedReport = new ProcessedReport();
if (!$processedReport->isValidReportForSite($idSite, $apiMethodUniqueId)) {
throw new Exception(Piwik::translate('CustomAlerts_InvalidReport'));
}
if (!$processedReport->isValidMetricForReport($metric, $idSite, $apiMethodUniqueId)) {
throw new Exception(Piwik::translate('CustomAlerts_InvalidMetric'));
}
}