You are here

public function MandrillReportsService::getUrls in Mandrill 8

Gets URLs formatted for reports.

Return value

array

File

modules/mandrill_reports/src/MandrillReportsService.php, line 134
Contains \Drupal\mandrill_reports\MandrillReportsService.

Class

MandrillReportsService
Mandrill Reports service.

Namespace

Drupal\mandrill_reports

Code

public function getUrls() {
  $cache = \Drupal::cache('mandrill');
  $cached_urls = $cache
    ->get('urls');
  if (!empty($cached_urls)) {
    return $cached_urls->data;
  }
  $data = array();
  $urls = $this->mandrill_api
    ->getURLs();
  foreach ($urls as $url) {
    if (isset($url['url'])) {
      $data[$url['url']] = $url;
      $data[$url['url']]['time_series'] = $this->mandrill_api
        ->getURLTimeSeries($url['url']);
    }
  }
  $cache
    ->set('urls', $data);
  return $data;
}