original_string: private function hadWebsiteTrafficSinceMidnightInTimezone($idSite)
      {
          $timezone = Site::getTimezoneFor($idSite);
  
          $nowInTimezone      = Date::factory('now', $timezone);
          $midnightInTimezone = $nowInTimezone->setTime('00:00:00');
  
          $secondsSinceMidnight = $nowInTimezone->getTimestamp() - $midnightInTimezone->getTimestamp();
  
          $secondsSinceLastArchive = $this->getSecondsSinceLastArchive();
          if ($secondsSinceLastArchive < $secondsSinceMidnight) {
              $secondsBackToLookForVisits = $secondsSinceLastArchive;
              $sinceInfo = "(since the last successful archiving)";
          } else {
              $secondsBackToLookForVisits = $secondsSinceMidnight;
              $sinceInfo = "(since midnight)";
          }
  
          $from = Date::now()->subSeconds($secondsBackToLookForVisits)->getDatetime();
          $to   = Date::now()->addHour(1)->getDatetime();
  
          $dao = new RawLogDao();
          $hasVisits = $dao->hasSiteVisitsBetweenTimeframe($from, $to, $idSite);
  
          if ($hasVisits) {
              $this->logger->info("- tracking data found for website id $idSite since $from UTC $sinceInfo");
          } else {
              $this->logger->info("- no new tracking data for website id $idSite since $from UTC $sinceInfo");
          }
  
          return $hasVisits;
      }
code: private function hadWebsiteTrafficSinceMidnightInTimezone($idSite)
      {
          $timezone = Site::getTimezoneFor($idSite);
  
          $nowInTimezone      = Date::factory('now', $timezone);
          $midnightInTimezone = $nowInTimezone->setTime('00:00:00');
  
          $secondsSinceMidnight = $nowInTimezone->getTimestamp() - $midnightInTimezone->getTimestamp();
  
          $secondsSinceLastArchive = $this->getSecondsSinceLastArchive();
          if ($secondsSinceLastArchive < $secondsSinceMidnight) {
              $secondsBackToLookForVisits = $secondsSinceLastArchive;
              $sinceInfo = "(since the last successful archiving)";
          } else {
              $secondsBackToLookForVisits = $secondsSinceMidnight;
              $sinceInfo = "(since midnight)";
          }
  
          $from = Date::now()->subSeconds($secondsBackToLookForVisits)->getDatetime();
          $to   = Date::now()->addHour(1)->getDatetime();
  
          $dao = new RawLogDao();
          $hasVisits = $dao->hasSiteVisitsBetweenTimeframe($from, $to, $idSite);
  
          if ($hasVisits) {
              $this->logger->info("- tracking data found for website id $idSite since $from UTC $sinceInfo");
          } else {
              $this->logger->info("- no new tracking data for website id $idSite since $from UTC $sinceInfo");
          }
  
          return $hasVisits;
      }
code_tokens: private function hadWebsiteTrafficSinceMidnightInTimezone ( $ idSite ) { $ timezone = Site :: getTimezoneFor ( $ idSite ) ; $ nowInTimezone = Date :: factory ( 'now' , $ timezone ) ; $ midnightInTimezone = $ nowInTimezone -> setTime ( '00:00:00' ) ; $ secondsSinceMidnight = $ nowInTimezone -> getTimestamp ( ) - $ midnightInTimezone -> getTimestamp ( ) ; $ secondsSinceLastArchive = $ this -> getSecondsSinceLastArchive ( ) ; if ( $ secondsSinceLastArchive < $ secondsSinceMidnight ) { $ secondsBackToLookForVisits = $ secondsSinceLastArchive ; $ sinceInfo = "(since the last successful archiving)" ; } else { $ secondsBackToLookForVisits = $ secondsSinceMidnight ; $ sinceInfo = "(since midnight)" ; } $ from = Date :: now ( ) -> subSeconds ( $ secondsBackToLookForVisits ) -> getDatetime ( ) ; $ to = Date :: now ( ) -> addHour ( 1 ) -> getDatetime ( ) ; $ dao = new RawLogDao ( ) ; $ hasVisits = $ dao -> hasSiteVisitsBetweenTimeframe ( $ from , $ to , $ idSite ) ; if ( $ hasVisits ) { $ this -> logger -> info ( "- tracking data found for website id $idSite since $from UTC $sinceInfo" ) ; } else { $ this -> logger -> info ( "- no new tracking data for website id $idSite since $from UTC $sinceInfo" ) ; } return $ hasVisits ; }
docstring: Detects whether a site had visits since midnight in the websites timezone
  
  @param $idSite
  @return bool
docstring_tokens: Detects whether a site had visits since midnight in the websites timezone