/**
  * @inheritdoc
  */
 public function save(Impressions $impressions)
 {
     $allData = $this->getAllData();
     $array = [$this->getTodaysImpressionsKey() => $impressions->getForToday(), self::TOTAL_IMPRESSIONS_KEY => $impressions->getTotal()];
     $allData[$impressions->getCampaignTrackingId()] = $array;
     $encodedCookieData = $this->encode($allData);
     $this->dataResolver->setCookie(DataResolver::COOKIE_NAME, $encodedCookieData, time() + $this->getCookieLifetime(), '/');
 }
 /**
  * @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;
 }
 /**
  * @param Impressions $impressions
  */
 public function increase(Impressions $impressions)
 {
     $impressions->increment();
     $this->impressionsRepository->save($impressions);
 }