You are here

public function MandrillTestAPI::getTagsAllTimeSeries in Mandrill 8

Gets recent history for all tags.

Return value

array Array of tag history.

Overrides MandrillAPI::getTagsAllTimeSeries

File

src/MandrillTestAPI.php, line 103

Class

MandrillTestAPI
Overrides functions in the Mandrill API service for testing.

Namespace

Drupal\mandrill

Code

public function getTagsAllTimeSeries() {
  $time_series = array();
  $tags = $this
    ->getTagsTestData();
  foreach ($tags as $tag) {
    $stats = $tag['stats']['last_30_days'];
    if (!isset($time_series_data)) {
      $time_series_data = $stats;
      $time_series_data['time'] = date('Y-m-d H:i:s', time());
    }
    else {
      $time_series_data['sent'] += $stats['sent'];
      $time_series_data['hard_bounces'] += $stats['hard_bounces'];
      $time_series_data['soft_bounces'] += $stats['soft_bounces'];
      $time_series_data['rejects'] += $stats['rejects'];
      $time_series_data['complaints'] += $stats['complaints'];
      $time_series_data['unsubs'] += $stats['unsubs'];
      $time_series_data['opens'] += $stats['opens'];
      $time_series_data['unique_opens'] += $stats['unique_opens'];
      $time_series_data['clicks'] += $stats['clicks'];
      $time_series_data['unique_clicks'] += $stats['unique_clicks'];
    }
    $time_series[] = $time_series_data;
  }
  return $time_series;
}