コード例 #1
0
 /**
  * @param MemberActivity $memberActivity
  * @param EmailCampaignStatistics $emailCampaignStatistics
  */
 protected function incrementStatistics(MemberActivity $memberActivity, EmailCampaignStatistics $emailCampaignStatistics)
 {
     switch ($memberActivity->getAction()) {
         case MemberActivity::ACTIVITY_SENT:
             $marketingListItem = $emailCampaignStatistics->getMarketingListItem();
             $marketingListItem->setLastContactedAt($memberActivity->getActivityTime());
             $marketingListItem->setContactedTimes((int) $marketingListItem->getContactedTimes() + 1);
             break;
         case MemberActivity::ACTIVITY_OPEN:
             $emailCampaignStatistics->incrementOpenCount();
             break;
         case MemberActivity::ACTIVITY_CLICK:
             $emailCampaignStatistics->incrementClickCount();
             break;
         case MemberActivity::ACTIVITY_BOUNCE:
             $emailCampaignStatistics->incrementBounceCount();
             break;
         case MemberActivity::ACTIVITY_ABUSE:
             $emailCampaignStatistics->incrementAbuseCount();
             break;
         case MemberActivity::ACTIVITY_UNSUB:
             $emailCampaignStatistics->incrementUnsubscribeCount();
             break;
     }
 }