Ejemplo n.º 1
0
 private function _get30DaysStats()
 {
     $this->_stats['30d'] = new \stdClass();
     $this->_stats['30d']->totalQueued = 0;
     $this->_stats['30d']->totalTest = 0;
     $this->_stats['30d']->totalSent = 0;
     $this->_stats['30d']->totalFailed = 0;
     //so counting 30 days brings us to today
     $time = strtotime('-29 days 00:00:00');
     for ($i = 30; $i > 0; $i--) {
         $stats = $this->campaign->getStats((new \DateTime())->setTimestamp($time), (new \DateTime())->setTimestamp($time + 86399));
         $this->_stats['30d']->queued[] = $stats->queued;
         $this->_stats['30d']->test[] = $stats->test;
         $this->_stats['30d']->sent[] = $stats->sent;
         $this->_stats['30d']->failed[] = $stats->failed;
         $this->_stats['30d']->totalQueued += $stats->queued;
         $this->_stats['30d']->totalTest += $stats->test;
         $this->_stats['30d']->totalSent += $stats->sent;
         $this->_stats['30d']->totalFailed += $stats->failed;
         $time += 86400;
     }
 }