예제 #1
0
파일: Hash.php 프로젝트: Eupeodes/gh
 private function getMultiple($max = 7, $outputFormat = 'json')
 {
     $output = [];
     $n = 0;
     $int = new \DateInterval('P1D');
     while (true) {
         $this->doCalc();
         if (is_null($this->output['east'])) {
             break;
         }
         $output[] = $this->output;
         $n++;
         if (!is_null($max) && $n >= $max) {
             break;
         }
         $this->date->add($int);
     }
     if (is_null($this->output['west'])) {
         \lib\Cache::tillDow();
     } else {
         \lib\Cache::permanent();
     }
     if (is_null($outputFormat)) {
         return $output;
     } else {
         switch ($outputFormat) {
             case 'json':
             default:
                 header('Content-Type: application/json');
                 echo json_encode($output);
         }
     }
 }