生成一个日期数组
@param $from
@param $to
@param string $step
@param string $outputFormat
@return array
760447
public static function pf_date_indexed($from, $to, $step = '+1 day', $outputFormat = 'Y-m-d') {
        $dates = array();
        $current = strtotime($from);
        $last = strtotime($to);
        while($current <= $last) {
            $dates[] = date($outputFormat, $current);
            $current = strtotime($step, $current);
        }
        return $dates;
    }
1287519
public static function convert($input, $from, $to)
    {
        if (!method_exists(self::class, $to)) {
            return $input;
        }
        
        if (in_array($from, ['camel', 'pascal'])) {
            $converted = self::$from($input);
            $converted = preg_replace('/([a-z])([A-Z])/', '$1 $2', $converted);
            $converted = preg_replace('/(\D)?(\d+)(\D)?/', '$1 $2 $3', $converted);
            return self::$to($converted);
        }
        
        if (method_exists(self::class, $from)) {
            return self::$to(self::$from($input));
        }
        
        return self::$to($input);
    }
961073
public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result)
    {
        /** @var JUnitOutputPrinter $outputPrinter */
        $outputPrinter = $formatter->getOutputPrinter();

        $message = $step->getKeyword() . ' ' . $step->getText();

        if ($result instanceof ExceptionResult && $result->hasException()) {
            $message .= ': ' . $this->exceptionPresenter->presentException($result->getException());
        }

        $attributes = array('message' => $message);

        switch ($result->getResultCode()) {
            case TestResult::FAILED:
                $outputPrinter->addTestcaseChild('failure', $attributes);
                break;

            case TestResult::PENDING:
                $attributes['type'] = 'pending';
                $outputPrinter->addTestcaseChild('error', $attributes);
                break;

            case StepResult::UNDEFINED:
                $attributes['type'] = 'undefined';
                $outputPrinter->addTestcaseChild('error', $attributes);
                break;
        }
    }
983321
public function printStepList(OutputPrinter $printer, $intro, $resultCode, array $stepStats)
    {
        if (!count($stepStats)) {
            return;
        }

        $style = $this->resultConverter->convertResultCodeToString($resultCode);
        $intro = $this->translator->trans($intro, array(), 'output');

        $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style));

        foreach ($stepStats as $num => $stepStat) {
            if ($stepStat instanceof StepStatV2) {
                $this->printStepStat($printer, $num + 1, $stepStat, $style);
            } elseif ($stepStat instanceof StepStat) {
                $this->printStat($printer, $stepStat->getText(), $stepStat->getPath(), $style, $stepStat->getStdOut(), $stepStat->getError());
            }
        }
    }
1082618
public static function to_timezone(string $date, $from='UTC', $to='UTC') {
		ref\format::to_timezone($date, $from, $to);
		return $date;
	}
815510
private function _replace($from, $to) : array
    {
        $values = $this->getValues();
        foreach($values as $key => $value)
        {
            if ($value === $from)
            {
                $values[$key] = $to;
            }
        }
        return $values;
    }
1267243
public function getLikeCountByDate($from, $to = null): int
    {
        return Like::countByDate($this, $from, $to);
    }
369642
public static function convert($date, $from = 'UTC', $to = 'UTC', $format = null)
    {
        $format = $format ?: self::$format;

        $from = new \DateTimeZone($from);
        $to   = new \DateTimeZone($to);
        $date = new static($date, $from);

        $date = $date->setTimezone($to);

        return $date->format($format, true);
    }
1130507
public function getCommitsBetween(string $from, string $to) : array
    {
        $cmd = (new Commits($this->repo->getRoot()))->byRevision($from, $to)
                                                    ->prettyFormat(Commits\Jsonized::FORMAT);

        $result = $this->runner->run($cmd, new Commits\Jsonized());
        return $result->getFormattedOutput();
    }
1310154
public function formatDiff(DateTimeInterface $from, DateTimeInterface $to)
    {
        static $units = array(
            'y' => 'year',
            'm' => 'month',
            'd' => 'day',
            'h' => 'hour',
            'i' => 'minute',
            's' => 'second'
        );

        $diff = $to->diff($from);

        foreach ($units as $attribute => $unit) {
            $count = $diff->$attribute;
            if (0 !== $count) {
                return $this->doGetDiffMessage($count, $diff->invert, $unit);
            }
        }

        return $this->getEmptyDiffMessage();
    }
1172711
public static function DateRangeDiff(string $from, string $to)
    {
        $date_Range = new \Phunc\DateRange\DateRange();
        $date_Range->fillFromString($from, $to);
        $date_Range->getFrom()->hour(0)->minute(0)->second(0);
        $date_Range->getTo()->hour(24); //->minute(59)->second(59);
        return $date_Range->diffInDays();
    }
230490
public function compare(string $from, string $to): array
    {
        $compare = (new Compare($this->repo->getRoot()))->revisions($from, $to)
                                                        ->ignoreWhitespacesAtEndOfLine();

        $result = $this->runner->run($compare, new Compare\FullDiffList());

        return $result->getFormattedOutput();
    }
703425
protected function publishFile($from, $to)
    {
        if ($this->files->exists($to) || !$this->files->exists($from)) {
            return false;
        }

        $this->files->copy($from, $to);
        $this->info('Stub published: ' . basename($to));

        return true;
    }
598463
public function getValueFromOtherStep($fromStep, $key)
    {
        // load the steps in the cache, if this one doesn't exist
        if (!array_key_exists('steps_' . $fromStep, $this->step_data_cache)) {
            $steps = self::get()->filter('SessionID', $this->form->session->ID);

            if ($steps) {
                foreach ($steps as $step) {
                    $this->step_data_cache['steps_' . $step->ClassName] = $step->loadData();
                }
            }
        }

        // check both as PHP isn't recursive
        if (isset($this->step_data_cache['steps_' . $fromStep])) {
            if (isset($this->step_data_cache['steps_' . $fromStep][$key])) {
                return $this->step_data_cache['steps_' . $fromStep][$key];
            }
        }

        return null;
    }
641599
public function getWorkoutsFromTo(\DateTime $from, \DateTime $to)
    {
        return $this->getWorkouts([
            'after' => $from->format('c'),
            'before' => $to->format('c'),
        ]);
    }
991324
public static function getRate($from, $to) {
    // Check if currencies exists
    if (!Connect2PayCurrencyHelper::currencyIsAvailable($from) || !Connect2PayCurrencyHelper::currencyIsAvailable($to)) {
      return null;
    }

    // Build the request URL
    $url = Connect2PayCurrencyHelper::$APIIO_SERVICE_URL . date("Y-m-d") . "?base=" . $from . "&symbols=" . $to;

    // Do the request
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    if (Connect2PayCurrencyHelper::$proxy_host != null && Connect2PayCurrencyHelper::$proxy_port != null) {
      curl_setopt($curl, CURLOPT_PROXY, Connect2PayCurrencyHelper::$proxy_host);
      curl_setopt($curl, CURLOPT_PROXYPORT, Connect2PayCurrencyHelper::$proxy_port);

      if (Connect2PayCurrencyHelper::$proxy_username != null && Connect2PayCurrencyHelper::$proxy_password != null) {
        curl_setopt($curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
        curl_setopt($curl, CURLOPT_PROXYUSERPWD,
            Connect2PayCurrencyHelper::$proxy_username . ":" . Connect2PayCurrencyHelper::$proxy_password);
      }
    }

    $json = trim(curl_exec($curl));
    $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    curl_close($curl);

    if ($httpCode == 200) {
      // Parse the CSV, we should only have a number, check this
      $obj = json_decode($json, true);

      if (is_array($obj) && array_key_exists("rates", $obj) && array_key_exists($to, $obj['rates']) &&
          preg_match('/^[0-9.]+$/', $obj['rates'][$to])) {
        return $obj['rates'][$to];
      }
    }

    return null;
  }
228709
public static function _convertTZ ($date, $to, $format = 'Y-m-d H:i:s', $from = 'UTC')
	{
		
		$date = new \DateTime ($date, new \DateTimeZone ($from));
		$date->setTimezone (new \DateTimeZone ($to));
		
		return $date->format ($format);
		
	}