Exemplo n.º 1
0
 private function createUser(\stdClass $data)
 {
     $user = new User();
     $user->setUsername($data->username);
     $user->setPublicId($data->public_id);
     $user->setReputation($data->reputation);
     $user->setHourlyQuota($data->hourly_quota);
     $user->setBacklog($data->backlog);
     $user->setCreatedAt(new \DateTime($data->created_at));
     foreach (array('today', 'last_7_days', 'last_30_days', 'last_60_days', 'last_90_days', 'all_time') as $range) {
         $summaryData = $data->stats->{$range};
         $summary = new Summary();
         $summary->setRange($range);
         $summary->setSent($summaryData->sent);
         $summary->setHardBounces($summaryData->hard_bounces);
         $summary->setSoftBounces($summaryData->soft_bounces);
         $summary->setRejects($summaryData->rejects);
         $summary->setComplaints($summaryData->complaints);
         $summary->setUnsubs($summaryData->unsubs);
         $summary->setOpens($summaryData->opens);
         $summary->setUniqueOpens($summaryData->unique_opens);
         $summary->setClicks($summaryData->clicks);
         $summary->setUniqueClicks($summaryData->unique_clicks);
         $user->addStat($summary);
     }
     return $user;
 }
Exemplo n.º 2
0
 private function createTag(\stdClass $data)
 {
     $tag = new Tag();
     $tag->setClicks($data->clicks);
     $tag->setComplaints($data->complaints);
     $tag->setHardBounces($data->hard_bounces);
     $tag->setOpens($data->opens);
     $tag->setRejects($data->rejects);
     $tag->setSent($data->sent);
     $tag->setSoftBounces($data->soft_bounces);
     $tag->setTag($data->tag);
     $tag->setUnsubs($data->unsubs);
     if (isset($data->stats)) {
         foreach (array('today', 'last_7_days', 'last_30_days', 'last_60_days', 'last_90_days') as $range) {
             $summaryData = $data->stats->{$range};
             $summary = new Summary();
             $summary->setRange($range);
             $summary->setSent($summaryData->sent);
             $summary->setHardBounces($summaryData->hard_bounces);
             $summary->setSoftBounces($summaryData->soft_bounces);
             $summary->setRejects($summaryData->rejects);
             $summary->setComplaints($summaryData->complaints);
             $summary->setUnsubs($summaryData->unsubs);
             $summary->setOpens($summaryData->opens);
             $summary->setUniqueOpens($summaryData->unique_opens);
             $summary->setClicks($summaryData->clicks);
             $summary->setUniqueClicks($summaryData->unique_clicks);
             $tag->addStat($summary);
         }
     }
     return $tag;
 }