original_string: public static function makePeriodFromQueryParams($timezone, $period, $date)
      {
          if (empty($timezone)) {
              $timezone = 'UTC';
          }
  
          if ($period == 'range') {
              self::checkPeriodIsEnabled('range');
              $oPeriod = new Range('range', $date, $timezone, Date::factory('today', $timezone));
          } else {
              if (!($date instanceof Date)) {
                  if ($date == 'now' || $date == 'today') {
                      $date = date('Y-m-d', Date::factory('now', $timezone)->getTimestamp());
                  } elseif ($date == 'yesterday' || $date == 'yesterdaySameTime') {
                      $date = date('Y-m-d', Date::factory('now', $timezone)->subDay(1)->getTimestamp());
                  }
                  $date = Date::factory($date);
              }
              $oPeriod = Factory::build($period, $date);
          }
          return $oPeriod;
      }
code: public static function makePeriodFromQueryParams($timezone, $period, $date)
      {
          if (empty($timezone)) {
              $timezone = 'UTC';
          }
  
          if ($period == 'range') {
              self::checkPeriodIsEnabled('range');
              $oPeriod = new Range('range', $date, $timezone, Date::factory('today', $timezone));
          } else {
              if (!($date instanceof Date)) {
                  if ($date == 'now' || $date == 'today') {
                      $date = date('Y-m-d', Date::factory('now', $timezone)->getTimestamp());
                  } elseif ($date == 'yesterday' || $date == 'yesterdaySameTime') {
                      $date = date('Y-m-d', Date::factory('now', $timezone)->subDay(1)->getTimestamp());
                  }
                  $date = Date::factory($date);
              }
              $oPeriod = Factory::build($period, $date);
          }
          return $oPeriod;
      }
code_tokens: public static function makePeriodFromQueryParams ( $ timezone , $ period , $ date ) { if ( empty ( $ timezone ) ) { $ timezone = 'UTC' ; } if ( $ period == 'range' ) { self :: checkPeriodIsEnabled ( 'range' ) ; $ oPeriod = new Range ( 'range' , $ date , $ timezone , Date :: factory ( 'today' , $ timezone ) ) ; } else { if ( ! ( $ date instanceof Date ) ) { if ( $ date == 'now' || $ date == 'today' ) { $ date = date ( 'Y-m-d' , Date :: factory ( 'now' , $ timezone ) -> getTimestamp ( ) ) ; } elseif ( $ date == 'yesterday' || $ date == 'yesterdaySameTime' ) { $ date = date ( 'Y-m-d' , Date :: factory ( 'now' , $ timezone ) -> subDay ( 1 ) -> getTimestamp ( ) ) ; } $ date = Date :: factory ( $ date ) ; } $ oPeriod = Factory :: build ( $ period , $ date ) ; } return $ oPeriod ; }
docstring: Creates a Period instance using a period, date and timezone.
  
  @param string $timezone The timezone of the date. Only used if `$date` is `'now'`, `'today'`,
  `'yesterday'` or `'yesterdaySameTime'`.
  @param string $period The period string: `"day"`, `"week"`, `"month"`, `"year"`, `"range"`.
  @param string $date The date or date range string. Can be a special value including
  `'now'`, `'today'`, `'yesterday'`, `'yesterdaySameTime'`.
  @return \Piwik\Period
docstring_tokens: Creates a Period instance using a period date and timezone .