original_string: public static function getRelativeToEndDate($period, $lastN, $endDate, $site)
      {
          $timezone = $site->getTimezone();
          $last30Relative = new Range($period, $lastN, $timezone);
  
          if (strpos($endDate, '-') === false) {
              // eg today, yesterday, ... needs the timezone
              $endDate = Date::factoryInTimezone($endDate, $timezone);
          } else {
              $endDate = Date::factory($endDate);
          }
          $last30Relative->setDefaultEndDate($endDate);
  
          $date = $last30Relative->getDateStart()->toString() . "," . $last30Relative->getDateEnd()->toString();
          return $date;
      }
code: public static function getRelativeToEndDate($period, $lastN, $endDate, $site)
      {
          $timezone = $site->getTimezone();
          $last30Relative = new Range($period, $lastN, $timezone);
  
          if (strpos($endDate, '-') === false) {
              // eg today, yesterday, ... needs the timezone
              $endDate = Date::factoryInTimezone($endDate, $timezone);
          } else {
              $endDate = Date::factory($endDate);
          }
          $last30Relative->setDefaultEndDate($endDate);
  
          $date = $last30Relative->getDateStart()->toString() . "," . $last30Relative->getDateEnd()->toString();
          return $date;
      }
code_tokens: public static function getRelativeToEndDate ( $ period , $ lastN , $ endDate , $ site ) { $ timezone = $ site -> getTimezone ( ) ; $ last30Relative = new Range ( $ period , $ lastN , $ timezone ) ; if ( strpos ( $ endDate , '-' ) === false ) { // eg today, yesterday, ... needs the timezone $ endDate = Date :: factoryInTimezone ( $ endDate , $ timezone ) ; } else { $ endDate = Date :: factory ( $ endDate ) ; } $ last30Relative -> setDefaultEndDate ( $ endDate ) ; $ date = $ last30Relative -> getDateStart ( ) -> toString ( ) . "," . $ last30Relative -> getDateEnd ( ) -> toString ( ) ; return $ date ; }
docstring: Returns a date range string given a period type, end date and number of periods
  the range spans over.
  
  @param string $period The sub period type, `'day'`, `'week'`, `'month'` and `'year'`.
  @param int $lastN The number of periods of type `$period` that the result range should
  span.
  @param string $endDate The desired end date of the range.
  @param \Piwik\Site $site The site whose timezone should be used.
  @return string The date range string, eg, `'2012-01-02,2013-01-02'`.
  @api
docstring_tokens: Returns a date range string given a period type end date and number of periods the range spans over .