示例#1
0
 /**
  * @param TrackableCampaignInterface $campaign
  * @param Impressions                $impressions
  *
  * @return string
  */
 private function getVisibilityText(TrackableCampaignInterface $campaign, Impressions $impressions)
 {
     if ($this->impressionsOperator->areImpressionsEnabled()) {
         if ($impressions->canBeIncreasedToday()) {
             $text = 'Popup is showed in normal mode. This is impression ' . ($impressions->getForToday() + 1) . ' out of ' . $campaign->getMaxImpressionPerDay() . ' for today';
         } else {
             $text = 'Popup is not showed in normal mode. The ' . $campaign->getMaxImpressionPerDay() . ' impressions for today  were exhausted.';
         }
     } else {
         $text = 'Popup is not showed in normal mode. All impressions were disabled.';
     }
     ob_start();
     require_once __DIR__ . '/../templates/debug.php';
     $content = ob_get_clean();
     return $content;
 }
示例#2
0
 /**
  * Returns the count of remaining impressions for the user for today aka. how many times the campaign can still be
  * shown for the user today.
  *
  * @return int
  */
 private function getRemainingForToday()
 {
     $maxImpressionForToday = $this->campaign->getMaxImpressionPerDay();
     $remainingForToday = $maxImpressionForToday - $this->getForToday();
     if ($remainingForToday > $this->getRemainingTotal()) {
         $remainingForToday = $this->getRemainingTotal();
     }
     return $remainingForToday;
 }