isValidReportForSite() public method

Verfies whether the given report exists for the given site.
public isValidReportForSite ( integer $idSite, string $apiMethodUniqueId ) : boolean
$idSite integer
$apiMethodUniqueId string For example 'MultiSites_getAll'
return boolean
コード例 #1
0
 /**
  * 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'));
     }
 }